Robotics StackExchange | Archived questions

ROSCORE doesn't start on ROS_MASTER

Hi everyone. I am new to ROS and its large community.

My question may be simple but after a thorough research on internet, I cannot find an answer to my problem. Basically, I have a host laptop (GS63) and ros master (Husky). The details are below:

Husky: 192.168.131.1

 GS63: 192.168.131.99
 ROS_MASTER_URI=http//:192.168.131.1:11311/
 ROS_IP=192.168.131.99

The problem is whenever I run:

roscore

on my Husky, I get the following error:

... logging to /home/administrator/.ros/log/8c8dd558-f641-11ec-893a-675445159788/roslaunch-Cypector-1649.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://Cypector:41833/
ros_comm version 1.15.14

PARAMETERS
 * /rosdistro: noetic
 * /rosversion: 1.15.14

NODES

RLException: roscore cannot run as another roscore/master is already running. 
Please kill other roscore/master processes before relaunching.
The ROS_MASTER_URI is http://Cypector:11311/
The traceback for the exception was written to the log file

I know that I have to kill other roscore processes. But there are no any other roscore processes running at the moment. Even so, I killed all of them by running:

killall -9 roscore

and

killall -9 rosmaster

After this, when I run:

roscore

I still get the same error:

RLException: roscore cannot run as another roscore/master is already running.  Please kill other roscore/master processes before relaunching. The ROS_MASTER_URI is http://Cypector:11311/ The traceback for the exception was written to the log file

I have no idea what is going on and cannot find an solution to this loop. Please help.

Thanks

Asked by furkan on 2022-06-27 13:08:58 UTC

Comments

Answers

Check ROS environment variables on host and husky with

printenv | grep ROS

Did you set ROS_IP and ROS_MASTER on husky too?

Maybe you have some other process that spawns roscore when it dies.

EDIT:

I created these scripts for exactly this reason.

Asked by martinerk0 on 2022-06-28 05:30:53 UTC

Comments

Hi!

After running the below code on host:

My printenv | grep ROS

Here are my variables:

ROS_VERSION=1
ROS_PYTHON_VERSION=3
ROS_PACKAGE_PATH=/home/furkan/husky_noetic_ws/src:/opt/ros/noetic/share
ROSLISP_PACKAGE_DIRECTORIES=/home/furkan/husky_noetic_ws/devel/share/common-lisp
ROS_IP=192.168.131.99
ROS_ETC_DIR=/opt/ros/noetic/etc/ros
ROS_MASTER_URI=http://Cypector:11311
ROS_ROOT=/opt/ros/noetic/share/ros
ROS_DISTRO=noetic

After running the below code on husky:

My printenv | grep ROS

ROS_VERSION=1
ROS_PYTHON_VERSION=3
ROS_PACKAGE_PATH=/home/administrator/husky_noetic_ws/src:/opt/ros/noetic/share
ROSLISP_PACKAGE_DIRECTORIES=/home/administrator/husky_noetic_ws/devel/share/common-lisp
ROS_ROBOT_MODEL=husky
ROS_IP=192.168.131.1
ROS_ETC_DIR=/opt/ros/noetic/etc/ros
ROS_ROBOT_SERIAL_NO=A200-0744
ROS_MASTER_URI=http://localhost:11311
ROS_ROOT=/opt/ros/noetic/share/ros
ROS_DISTRO=noetic

I don't think there is any discrepancy in the variables...

Asked by furkan on 2022-06-28 07:59:27 UTC

Comments

Yeah, that's not correct, you need to change it to: on host: ROS_MASTER_URI=http://192.168.131.99:11311

and on husky: ROS_MASTER_URI=http://192.168.131.99:11311

I can share script for setting these variables if you want, If this solved your issue, accept my answer thanks :)

Asked by martinerk0 on 2022-06-28 10:32:10 UTC

I've changed the

ROS_MASTER_URI=http://192.168.131.99:11311

in both host and husky. But I still get the same error when I run roscore on husky.

RLException: roscore cannot run as another roscore/master is already running. 
Please kill other roscore/master processes before relaunching.
The ROS_MASTER_URI is http://Cypector:11311/
The traceback for the exception was written to the log file

By the way, I changed them by just running in both husky and host

export ROS_MASTER_URI=http://192.168.131.99:11311

Then I also confirmed that they've changed by running

printenv | grep ROS

Asked by furkan on 2022-06-28 10:53:57 UTC

Is really roscore not running on both machines? What is output of on both machines?

ps -aux | grep roscore

Try opening new terminals or source ~/.bashrc. If you ssh into remote you need to source bashrc to update variables

Asked by martinerk0 on 2022-06-28 10:59:25 UTC

Output on Husky:

adminis+    1950  0.0  0.0   9208   724 pts/0    S+   09:06   0:00 grep --color=auto roscore

Output on laptop:

furkan     84839  0.0  0.0   9040   720 pts/0    S+   09:06   0:00 grep --color=auto roscore

Additionally, I talked to someone from Clearpath Robotics that the in this particular Husky, Roscore does not need to be started since it automatically starts everytime the robot is on.

Asked by furkan on 2022-06-29 08:08:40 UTC