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

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 close merge delete