Robotics StackExchange | Archived questions

Provide CLI roslaunch with XML <group> tag.

I would like to perform a roslaunch from the command line which replicates the < group> tag from the XML roslaunch syntax.

Is this possible?

For example, say I wanted to run the a launch file, spawnmavrosinstance.launch, which creates the following topics:

/topic1
/topic2
...

With the roslaunch XML format I could create a launch file with the tag:

<launch>    
      <group ns="uav1">
            <include file="$(find ardupilot_gazebo)/launch/spawn_mavros_instance.launch">
                <arg name="fcu_url" value="udp://127.0.0.1:14551@" />
            </include>
      </group>
</launch>

which creates topics with the following namespace:

/uav1/topic1
/uav1/topic2
...

I am using ROS Melodic on Ubuntu 18.04.

Asked by nealevanstrn on 2019-12-09 16:14:40 UTC

Comments

are you asking how to roslaunch a .launch file in a namespace?

If so: you should be able to do that using ROS_NAMESPACE=<your_namespace> roslaunch ....

Asked by gvdhoorn on 2019-12-09 18:22:44 UTC

Yes that works for my use case.

Thank You

Asked by nealevanstrn on 2019-12-09 18:37:25 UTC

Alternatively you could also add an argument to the launch file for the namespace.

<launch>    
      <arg name="name" default="uav1"/>
      <group ns="$(arg name)">
        ...
      </group>
</launch>

You could just do roslaunch ardupilot_gazebo mavros_namespace_instance.launch name:=uav1 and just replace the argument in the command line.

Asked by Reamees on 2019-12-10 03:47:57 UTC

Answers