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.
<launch>
<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)"/>
</node>
<!-- 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
<launch>
<!-- 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"/>
</include>
</group>
<!-- 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"/>
</include>
</group>
<!-- 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"/>
</include>
</group>
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
/robot_1/odom
,/robot_2/odom
and/robot_3/odom
. $\endgroup$