Spawning multiple robots with diff_drive_controller
Target: I am trying to spawn multiple robots in Gazebo and also using ros_control, for this I group each one like in the launch files bellow.
Problem(s): No odometry, tf points to only one robot: base_link, no control on the joints
<arg name="paused" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="gui" default="true"/>
<arg name="headless" default="false"/>
<arg name="debug" default="false"/>
<arg name="model" default="$(find multiple_robots_sim)/urdf/robot.xacro"/>
<arg name="rvizconfig" default="$(find multiple_robots_sim)/rviz/urdf.rviz" />
<param name="robot_description" command="$(find xacro)/xacro --inorder $(arg model)"/>
<rosparam command="load" file="$(find multiple_robots_sim)/config/control.yaml" />
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" />
<!-- BEGIN ROBOT 1-->
<group ns="robot1">
<!--param name="tf_prefix" value="atlas1_tf" /-->
<include file="$(find multiple_robots_sim)/launch/one_robot.launch" >
<arg name="init_pose" value="-z 1.0" />
<arg name="robot_name" value="robot2" />
</include>
</group>
<!-- BEGIN ROBOT 2-->
<group ns="robot2">
<!--param name="tf_prefix" value="atlas2_tf" /-->
<include file="$(find multiple_robots_sim)/launch/one_robot.launch" >
<arg name="init_pose" value="-x 2.0 -z 1.0" />
<arg name="robot_name" value="robot2" />
</include>
</group>
and one_robot.launch looks like
<launch>
<arg name="robot_name"/>
<arg name="init_pose"/>
<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model"
args="$(arg init_pose) -unpause -urdf -model $(arg robot_name) -param /robot_description" respawn="false" output="screen" />
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen">
<param name="publish_frequency" type="double" value="30.0" />
</node>
<node name="controller_spawner" pkg="controller_manager" type="spawner"
args="robot_joint_state_controller
robot_diff_drive_controller
robot_arm_controller
--shutdown-timeout 3"/>
<node name="rqt_robot_steering" pkg="rqt_robot_steering" type="rqt_robot_steering">
<param name="default_topic" value="$(arg robot_name)/robot_dif_drive_controller/cmd_vel"/>
</node>
</launch>
So everything works if i have just one robot and no grouping. I can get the odometry and the controller can control the joints. After I add the groups the controller is no longer accounted for.
There is a problem with namespaces but i cannot figure it out.
I would like to see the robots in gazebo and rviz.
UPDATE I managed to resolve the controllers problem; See here.
But I still have the odometry problem for multiple robots in rviz. DO i need to do some transforms?