Roslaunch group ns and remapping

Hello,

There is two ways to change topics in the launch file:

  • using group ns (<group ns="t1"> <node ..... > </group>)
  • using remapping for node

I have tried both methods. But the first method is not always working. For example, I’ve tried to run the turtlebot3_teleop_key node within a group namespace. But still, it publishes to /cmd_vel topic. But when I use remapping, it works (publishes /t1/cmd_vel).

I want to know why sometimes using does not work, or what are the requirements?

<launch>
  <arg name="model" default="$(env TURTLEBOT3_MODEL)"/>
  <arg name="name_space" default="t1"/>

  <group ns = "$(arg name_space)">
    <param name="model" value="$(arg model)"/>
    <node pkg="turtlebot3_teleop" type="turtlebot3_teleop_key" name="turtlebot3_teleop"  output="screen">
      <!--remap from="/cmd_vel" to="/$(arg name_space)/cmd_vel"/-->
    </node>
  </group>

</launch>

@m.haghbeigi I just tried the format you used for the group ns method and it worked fine with me. I did see, however, that ‘rostopic list’ did return a ‘/cmd_vel’ topic since there were already subscribers to that topic. Maybe this is what you’re seeing? Try running ‘rostopic list | grep cmd_vel’ and see what you get. Also, could post your roslaunch file please?

@daniel.v.molina1 First I launched a turtlebot3 simulation in the Gazebo (with group namespace). So the robot in simulation subscribes to /t1/cmd_vel. but when I launch this teleop launch file (without remap), it doesn’t publish /t1/cmd_vel.

@m.haghbeigi I wonder if it has to do the the way you are starting your simulation? I just copy and pasted your launch file and it perfectly fine for me numerous times. I’m posting my gazebo launch file so that we can compare our methods.

  1 <?xml version="1.0"?>
  2 <launch>
  3 <!-- these are the arguments you can pass this launch file, for example paused:=true -->
  4 <arg name="paused" default="false"/>
  5 <arg name="use_sim_time" default="true"/>
  6 <arg name="gui" default="true"/>
  7 <arg name="headless" default="false"/>
  8 <arg name="debug" default="false"/>
  9 <arg name="model" default="$(find turtlebot3_description)/urdf/turtlebot3_burger.urdf.xacro"/>
 10 
 11 <include file="$(find gazebo_ros)/launch/empty_world.launch">
 12   <arg name="world_name" value="$(find little_rover)/worlds/home.world"/>
 13   <arg name="debug" value="$(arg debug)" />
 14   <arg name="gui" value="$(arg gui)" />
 15   <arg name="paused" value="$(arg paused)"/>
 16   <arg name="use_sim_time" value="$(arg use_sim_time)"/>
 17   <arg name="headless" value="$(arg headless)"/>
 18 </include>
 19 
 20 <!-- Load the URDF into the ROS Parameter Server -->
 21 <param name="robot_description" command="$(find xacro)/xacro $(arg model)"/>
 22 
 23 <node ns="t1" name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" args="-z 0 -unpause -urdf -model model -param /robot_description"/>
 24 
 25 </launch>

1 Like