Remap topic doesn't work - Multiple Robots

asked 2019-03-23 08:49:42 -0500

moni213 gravatar image

updated 2019-03-23 09:07:00 -0500

Hello, Based on the tutorial here, I tried to create my launches to run multiple robots in gazebo. Each robot has a node [called stopper] that takes care to move it. I want that each robot will move separately, so I will publish to {robot_name}/cmd_vel_mux/input/teleop topic.

when running "rostopic info /cmd_vel_mux/input/teleop" I noticed that I have only mobile_base_nodelet_manager as subscriber, with no publisher (the publisher exists into {robot_name}/cmd_vel_mux/input/teleop topic. Therefore, I used remap but it still doesn't work and the same problem appears.


<?xml version="1.0"?>

   <arg name="robot_name"/>
   <arg name="init_pose"/>
   <remap from="scan" to="$(arg robot_name)/scan"/>
   <remap from="cmd_vel_mux/input/teleop" to="$(arg robot_name)/cmd_vel_mux/input/teleop"/>

   <node name="spawn_minibot_model" pkg="gazebo_ros" type="spawn_model"
     args="$(arg init_pose) -urdf -param /robot_description -model $(arg robot_name)"
    respawn="false" output="screen" />

    <!-- Launch stopper node -->
    <node name="stopper" pkg="stopper" type="stopper" output="screen" args="$(arg robot_name)">


 <?xml version="1.0"?>
  <!-- No namespace here as we will share this description. 
         Access with slash at the beginning -->
  <param name="robot_description"
          command="$(find xacro)/ $(find turtlebot_description)/robots/kobuki_hexagons_asus_xtion_pro.urdf.xacro"/>

 <!-- BEGIN ROBOT 1-->
 <group ns="robot1">
    <param name="tf_prefix" value="robot1_tf" />
    <include file="$(find stopper)/launch/one_robot.launch" >
      <arg name="init_pose" value="-x 1 -y 1 -z 0" />
      <arg name="robot_name"  value="Robot1" />

 <!-- BEGIN ROBOT 2-->
 <group ns="robot2">
    <param name="tf_prefix" value="robot2_tf" />
   <include file="$(find stopper)/launch/one_robot.launch" >
     <arg name="init_pose" value="-x -1 -y 1 -z 0" />
     <arg name="robot_name"  value="Robot2" />


   <?xml version="1.0"?>
      <param name="/use_sim_time" value="true" />

      <!-- include our robots -->
      <include file="$(find stopper)/launch/robots.launch"/>

      <!-- start world -->
      <include file="$(find turtlebot_gazebo)/launch/turtlebot_world.launch"/>       
  • As it looks, I tried to remap in one_robot.launch, but it still didn't work as I mentioned previous. I notice that the remap works only if I do it in multiple_robots.launch, but it's not really possible for me, because there we don't know the robot names, but just in one_robot.launch.

I would like to get your help to solve this issue, I spent a lot of time on this. Thank you very much!

edit retag flag offensive close merge delete


Does someone can help? Thank you.

moni213 gravatar imagemoni213 ( 2019-03-26 08:15:42 -0500 )edit