Provide CLI roslaunch with XML <group> tag.

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

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 imagegvdhoorn ( 2019-12-09 17:22:44 -0600 )edit

Yes that works for my use case.

Thank You

nealevanstrn gravatar imagenealevanstrn ( 2019-12-09 17:37:25 -0600 )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 imageReamees ( 2019-12-10 02:47:57 -0600 )edit