I'm in the process of creating a coordination system for a multi robot system. For that i currently have created a ROS based simulation in gazebo using Rosbot2.0 (Robot physically available as well). Following are the launch files i used.

Template launch file for a single robot.

<arg name="tf_prefix" default=""/>
<arg name="init_pose" default="-x 0.5 -y 0.5 -z 0 -R 0 -P 0 -Y 0"/>

<!-- Load the joint space controller -->
<rosparam command="load" file="$(find joint_state_controller)/joint_state_controller.yaml" />
<node name="joint_state_controller_spawner" pkg="controller_manager" type="spawner" output="screen" args="joint_state_controller" />

<!-- load the model of the robot" -->
<param name="robot_description" command="$(find xacro)/xacro '$(find rosbot_description)/urdf/rosbot.xacro' robot_namespace:=$(arg tf_prefix)"/>

<!-- Spawn the robot_state_publisher with the desired tf_prefix -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" output="screen">
    <param name="tf_prefix" value="$(arg tf_prefix)"/>

<!-- Spawn the robot in the desired pose given by "init_pose" variable" -->
<node name="rosbot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen" args="$(arg init_pose) -urdf -param robot_description -model $(arg tf_prefix)"/>

<node pkg="tf" type="static_transform_publisher" name="map_publisher" args="0 0 0 0 0 0 map $(arg tf_prefix)/map 100"/>
<node pkg="tf" type="static_transform_publisher" name="imu_publisher" args="0 0 0.02 0 0 0 $(arg tf_prefix)/base_link $(arg tf_prefix)/imu_link 100"/>

Multi robot launch file

<!-- BEGIN ROBOT 1-->
<group ns="rosbot1">
    <include file="$(find rosbot_description)/launch/single_rosbot.launch" >
        <arg name="init_pose" value="-x 0.5 -y 0.5 -z 0 -R 0 -P 0 -Y 0" />
        <arg name="tf_prefix" value="rosbot1"/>

<!-- BEGIN ROBOT 2-->
<group ns="rosbot2">
    <include file="$(find rosbot_description)/launch/single_rosbot.launch" >
        <arg name="init_pose" value="-x 4.5 -y 0.5 -z 0 -R 0 -P 0 -Y 1.57" />
        <arg name="tf_prefix" value="rosbot2"/>

<!-- BEGIN ROBOT 2-->
<group ns="rosbot3">
    <include file="$(find rosbot_description)/launch/single_rosbot.launch" >
        <arg name="init_pose" value="-x 0.5 -y 4.5 -z 0 -R 0 -P 0 -Y 0" />
        <arg name="tf_prefix" value="rosbot3"/>

With these files i can load the robots into the simulation without an issue.

My target is to create a multi robot coordination system that can work with robots without knowing their initial position. So to follow that premise, when simulated, each robot's odometry and TF both needs to be zero. But with the above approach,

  • robot 1 starting position 0.5 0.5 0
  • robot 2 starting position 4.5 0.5 0
  • robot 3 starting position 0.5 4.5 0

are reflected as is in odom and TF.

Is there a way to keep the robots as mentioned above and still has the odom and TF to 0 0 0.

To add to that, what i need to do is simulate real world where robots start position is considered origin. In rosbot real world usage, they use rosbot_ekf to generate the odom so each robot start from 0 0 0 but actually in seperate position. I'm looking for a way to simulate that. Thanks

  • $\begingroup$ I don't think I completely understand your question. Having said that, you might want to consider spawning the bots in different namespaces i.e. /robot_1/odom, /robot_2/odom and /robot_3/odom. $\endgroup$
    – skpro19
    Jun 9, 2021 at 15:08
  • $\begingroup$ I had already done that. It seems i cannot explain this finer than above because i keep writing the same thing. But it seemed to be an issue with the rosbot model. once i switched to turtlebot it worked without an issue $\endgroup$ Jul 5, 2021 at 11:30

1 Answer 1


Usually, robot's float a topic (eg /mobile_base/commands/reset_odometry for TurtleBot) to reset the odometry.

The URDF for the Rosbot2.0 uses Skid Steer plugin. This plugin does not expose a method for resetting the odometry of the robot. So you can't reset odometry by calling a topic or from launch file.

But nothing stops you from internally keeping track of the robot's initial offset/transform and correcting this initial transform manually. Or else, you can use a different robot model that supports resetting odometry (Turtlebot).

  • $\begingroup$ Seems like ill have to change the robot. Thanks $\endgroup$ May 27, 2021 at 20:03
  • $\begingroup$ @KalanaRatnayake If the above answers your question, consider marking it as accepted answer (by checking/clicking the tick mark). $\endgroup$
    – vyi
    May 30, 2021 at 21:27
  • $\begingroup$ Done. As an update, I moved from ROSBot to Turtlebot and it works like a charm now. $\endgroup$ Jul 5, 2021 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.