Provide CLI roslaunch with XML <group> tag.

asked 2019-12-09 15:14:40 -0500

nealevanstrn gravatar image

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, spawn_mavros_instance.launch, which creates the following topics:

/topic1
/topic2
...

With the roslaunch XML format I could create a launch file with the <group> 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.

edit retag flag offensive close merge delete

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 ....

gvdhoorn gravatar image gvdhoorn  ( 2019-12-09 17:22:44 -0500 )edit

Yes that works for my use case.

Thank You

nealevanstrn gravatar image nealevanstrn  ( 2019-12-09 17:37:25 -0500 )edit

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.

Reamees gravatar image Reamees  ( 2019-12-10 02:47:57 -0500 )edit