ROS Master is running. Can't run 'rosinit'

6 visualizaciones (últimos 30 días)
Michael Midence
Michael Midence el 20 de Feb. de 2020
Comentada: Cam Salzberger el 14 de Abr. de 2021
Why can I not initialize a ROS core with 'rosinit'? I receive the following error:
'>>rosinit
The ROS master is already running on port 11311. Try connecting to this master or creating a new ROS master that uses a
different port.'
Upon trying 'rosshutdown' and attempting 'rosinit' again I recieve the same error:
'>> rosshutdown
>> rosinit
The ROS master is already running on port 11311. Try connecting to this master or creating a new ROS master that uses a
different port.'
What are the next steps I should try to get this running correctly?

Respuestas (2)

Cam Salzberger
Cam Salzberger el 21 de Feb. de 2020
Editada: Cam Salzberger el 21 de Feb. de 2020
Hey Michael,
It sounds like there is already a ROS Master running on your machine on the port 11311, but (probably) not having been created within your current MATLAB session. My assumption is that you have started a roscore/roslaunch script from another terminal, or have another MATLAB instance running that has run rosinit.
If you want to connect to it, provide the Master URI to rosinit. If you don't want that Master running, shut it down from the appropriate terminal or other MATLAB instance. If you can't find any other terminal or MATLAB instance running, close down MATLAB and check your process monitor (task manager) to see if there are any hanging processes running that shouldn't be.
If you are looking to have two instances of MATLAB running with two different ROS networks at the same time on the same machine, I recommend using the ros.Core API to start the Master, specifying different ports. Then you should be able to either connect to that Master with rosinit, specifying the URI to that specific Master, or use ros.Node to connect directly (and ros.Publisher, ros.Subscriber, etc. to set up your communications for that node).
-Cam
  2 comentarios
Arun Ravindran
Arun Ravindran el 1 de Jun. de 2020
Editada: Arun Ravindran el 1 de Jun. de 2020
I am using MATLAB R2020a (Trial version) and i also get the same error.
>> rosinit
The ROS master is already running on port 11311. Try connecting to this master or creating a new ROS
master that uses a different port.
All i did was to start MATLAB and run rosinit
....................
core= ros.Core
Error using ros.Core/launchPublicCore (line 166)
The ROS master is already running on port 11311. Try connecting to this master or creating a new ROS
master that uses a different port.
Error in ros.Core (line 86)
loopBackError = obj.launchPublicCore(port);
...................................
>> core = ros.Core(12000)
Error using ros.Core/launchPublicCore (line 166)
The ROS master is already running on port 12000. Try connecting to this master or creating a new ROS
master that uses a different port.
Error in ros.Core (line 86)
loopBackError = obj.launchPublicCore(port);
................................................
I am behind a company proxy.
Cam Salzberger
Cam Salzberger el 1 de Jun. de 2020
That definitely seems like an issue. i don't know for sure whether or not the company proxy may have something to do with the issue.
I would suggest contacting technical support at this point. They should be able to get more in-depth with your particular machine, and can walk through the internal code with you, and get more information out of the error.
-Cam

Iniciar sesión para comentar.


Johannes Møgster
Johannes Møgster el 14 de Abr. de 2021
for what it`s worth, rosinit would freeze on me too, ros.Core(11311) told me ROS was already running (it was not) and to try another port, tried ros.Core(11312) worked fine.
Seemed like something was running on 11311, so I opened cmd, netstat -a -n -o, found the PID of something that was running on 11311, opened task manager, details, found the PID and stopped whatever was running. rosinit worked again. Same error after reboot though.
Does anyone know how to avoid stuff blocking my precious 11311 port?
  1 comentario
Cam Salzberger
Cam Salzberger el 14 de Abr. de 2021
If you can determine what program it was, you may be able to change its settings to use a different port. If not, or if it doesn't have settings, any computer-wide setting done to block programs from using 11311 would also block ROS.
There's nothing particular special about 11311 other than it being the default port. Feel free to use any port that works for you, so long as your other ROS machines target it.

Iniciar sesión para comentar.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by