ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

How to tell remote machines not to start separate roscores when using roslaunch? (Fuerte regression?)

asked 2012-06-15 06:03:50 -0600

dk gravatar image

updated 2014-01-28 17:12:41 -0600

ngrennan gravatar image

Hi

My goal is to start nodes on different machines using roslaunch while all the nodes should communicate to one master. This worked in electric. In fuerte the same process starts now a master for each machine. I guess something has changed, what do I need to do to fix it?

I created a sample launchfile that looks like this:

<launch>
    <machine name="m3" address="marvin-3" default="true"/>
    <machine name="m4" address="marvin-4" default="true"/>

    <group >
        <node name="m" pkg="turtlesim" type="mimic" respawn="false" machine="m4"/>
        <node name="t" pkg="turtlesim" type="turtlesim_node" respawn="false" machine="m3"/>
    </group>
</launch>

I start my launch-script in the following way:

user@marvin-3:~$ export ROS_MASTER_URI="http://marvin-3:11311"
user@marvin-3:~$ roslaunch myLaunch.launch

The output I get looks like this:

user@marvin-3:~$ roslaunch myLaunch.launch 
... logging to /home/user/.ros/log/827ebf04-b705-11e1-85a7-bcaec524ca66/roslaunch-marvin-3-23516.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://marvin-3:51304/
remote[marvin-4-0] starting roslaunch
remote[marvin-4-0]: creating ssh connection to marvin-4:22
launching remote roslaunch child with command: [/opt/ros/fuerte/env.sh roslaunch -c marvin-4-0 -u http://marvin-3:51304/ --run_id 827ebf04-b705-11e1-85a7-bcaec524ca66]
remote[marvin-4-0]: ssh connection created

SUMMARY
========

PARAMETERS
 * /rosdistro
 * /rosversion

MACHINES
 * m3
 * m4

NODES
  /
    t (turtlesim/turtlesim_node)
    m (turtlesim/mimic)

auto-starting new master
Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
process[master]: started with pid [23535]
ROS_MASTER_URI=http://marvin-3:11311

setting /run_id to 827ebf04-b705-11e1-85a7-bcaec524ca66
Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
process[rosout-1]: started with pid [23548]
started core service [/rosout]
Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
process[t-2]: started with pid [23560]
[marvin-4-0]: launching nodes...
[marvin-4-0]: auto-starting new master
[marvin-4-0]: process[master]: started with pid [27764]
[marvin-4-0]: ROS_MASTER_URI=http://localhost:11311
[marvin-4-0]: setting /run_id to 827ebf04-b705-11e1-85a7-bcaec524ca66
[marvin-4-0]: process[m-1]: started with pid [27778]
[marvin-4-0]: ... done launching nodes

In the line

[marvin-4-0]: ROS_MASTER_URI=http://localhost:11311

things are starting to go wrong. This should be rather set to marvin-3 (that is why I set ROS_MASTER_URI before running the launch script).

I realize (and confirmed) that I can set the ROS_MASTER_URI using a custom env-loader on my target machine. But that seems to be very complicated. This also leads to an explosion of the number of env-scripts needed.

I tried to look into the tutorial Roslaunch tips for larger projects. But that seems outdated.

Does someone have a better solution for me here?

Dirk

edit retag flag offensive close merge delete

5 Answers

Sort by ยป oldest newest most voted
1

answered 2012-07-06 10:39:31 -0600

dk gravatar image

It seems this is actually a bug which has been fixed in svn and which will be pushed out with the next version of ros-fuerte-ros-comm (1.8.14). See here https://code.ros.org/trac/ros/ticket/3990

edit flag offensive delete link more
1

answered 2020-01-28 12:08:59 -0600

TomPe gravatar image

I know this is very old but I just had a similar struggle with the setup myself (on melodic) and thought I would share my problem and solution. On my master I had ROS_MASTER_URI=http://localhost:11311 and on my remote I used ROS_MASTER_URI=http:/ctrl-pc:11311. This is fine for normal operation but if you use roslaunch with machine to run nodes on your remote device it will overwrite ROS_MASTER_URI on your remote pc with the one set on your master (the one you execute your launch file from), which ends up to be localhost, thus roslaunch will start a new roscore. Using export ROS_MASTER_URI=http:/ctrl-pc:11311 on both machines solved the problem. Tl;dr: do not use localhost in ROS_MASTER_URI.

edit flag offensive delete link more
0

answered 2012-08-21 18:00:54 -0600

Process server0 started with pid 27764 . I am getting this error in process list of EP. My igswd_mt(IGS Watchdog) status is running but jstart (J2EE Server) is all the time showing starting the process. please give some solution.

edit flag offensive delete link more
0

answered 2012-06-15 06:18:14 -0600

updated 2012-06-15 06:19:51 -0600

The best way to do what you want to do is to run roscore on just one machine, and add the ROS_MASTER_URI variable to the other nodes to point to that machine.

Suppose roscore is running on host "example", then you can add to your .bashrc file the following line:

export ROS_MASTER_URI=http://example:11311

11311 is the default port, I assume you haven't changed it. Have a look at this tutorial http://www.ros.org/wiki/ROS/Tutorials/MultipleMachines

edit flag offensive delete link more

Comments

Hi clausqr, Thanks for your answer here. I had a bit of problems posting my question (I accidentally posted the question with only the first paragraph in there) and then took a long time to fix that. So you answered before I could correct for that. Sorry,

dk gravatar image dk  ( 2012-06-15 06:33:37 -0600 )edit

My goal would be to not have to fix the place where the master runs in this way. I would like to have the flexibility to decide that within the launch process (i.e. the machine the launch is started on). That is also the way this worked in electric. Bug or feature?

dk gravatar image dk  ( 2012-06-15 06:38:47 -0600 )edit
1

Also, setting ROS_MASTER_URI in .bashrc will not influence the ROS_MASTER_URI roslaunch processes on remote machines use. Roslaunch doesn't load the .bashrc file since it doesn't run an interactive shell.

Lorenz gravatar image Lorenz  ( 2012-06-15 20:39:42 -0600 )edit
0

answered 2012-06-15 07:28:23 -0600

ahendrix gravatar image

Setting default="true" for both machines seems like a bad idea. I suspect that doing so is confusing the algorithm that sets the master URI.

See: http://www.ros.org/wiki/roslaunch/XML/machine

edit flag offensive delete link more

Comments

Thanks. Initially I did not get from the description that this is what "default" does. Unfortunately the functionality seems to be broken. I tried all possible true/false permutations for the two values and I tried setting the remote one to never. Neither changed anything.

dk gravatar image dk  ( 2012-06-15 08:52:09 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2012-06-15 06:03:50 -0600

Seen: 8,556 times

Last updated: Aug 21 '12