What is scope in roslaunch? (default machine not changing)

asked 2015-04-06 11:21:29 -0600

thebyohazard gravatar image

The roslaunch XML machine tag wiki page states that

"The default setting only applies to nodes defined later in the same scope."

So what exactly are roslaunch scopes? I'm not getting the behaviour I'd expect.

My use case: I wish to launch a launch file on a different machine. (related enhancement requests: a,b)

main.launch

<launch>
    <arg name="local_b" default="false"/>

    <group ns="sub">
        <include file="$(find a)/launch/a.launch"/>
        <include file="$(find b)/launch/b.launch">
            <arg name="launch_locally" value="$(arg local_b)"/>
        </include>
        <include file="$(find c)/launch/c.launch"/>
    </group>

    <node pkg="main" name="main" type="main" respawn="true"/>
</launch>

b.launch

<launch>
    <arg name="launch_locally" default="true"/>

    <machine unless="$(arg launch_locally)" name="b" address="b_pc" default="true" env-loader="/path/to/env.sh" user="user"/>

    <include file="$(find b)/launch/b_other.launch"/>
    <node pkg="b" name="b" type="b" respawn="true"/>
</launch>

b.launch standalone works as I want. I can launch remotely or locally by providing the parameter.

However, when I use b.launch in main.launch, the machine never goes out of scope. Everything in c as well as main gets run on the remote machine. I've tried adding the ns attribute for the include for b, and I've tried pushing the include in another group. No change.

It only works if the include for b is the very last thing launched, which is okay, but stylistically it takes away from the logical flow of the nodes to launch, so I'd like to know how to fix it. Am I doing something wrong?

edit retag flag offensive close merge delete

Comments

In the context of remap, param or env tags, 'scope' means what you'd expect. So this looks like a roslaunch bug for failing to perform as documented.

Mike Ferenduros gravatar image Mike Ferenduros  ( 2019-04-10 06:01:15 -0600 )edit

I'm experiencing the same issue. Have you reported it?

peci1 gravatar image peci1  ( 2020-02-15 23:07:22 -0600 )edit
1

still a problem for me too, bug seems to have been reported here: https://github.com/ros/ros_comm/issue...

zlackoff gravatar image zlackoff  ( 2020-09-23 13:27:18 -0600 )edit