ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I'm kind of a newbie myself, but I'm working on a similar problem and it looks like what's happening here is that your robot_description includes both robots. The first launch file calls two versions of the spawn_husky.launch file: one for each robot. Each robot then loads a description here:
<param name="robot_description" command="$(find xacro)/xacro.py '$(env HUSKY_GAZEBO_DESCRIPTION)'
Where the environment variable points to the description.gazebo.xacro file. This file then opens the controller plug-in for both robots. But since you're calling this part of the code twice, this might be where the problems are coming from. Just a thought though. But here's the way I've done it:
In the spawn_husky file
<param name="robot_description" command="$(find xacro)/xacro.py '$(find husky_gazebo)/urdf/$(arg namespace)description.gazebo.xacro'
laser_enabled:=$(arg laser_enabled)
ur5_enabled:=$(arg ur5_enabled)
kinect_enabled:=$(arg kinect_enabled)
" />
Then I have husky1description.gazebo.xacro and husky2description.gazebo.xacro which look like this:
<robot name="husky_robot_gazebo" xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:arg name="laser_enabled" default="true" />
<xacro:arg name="ur5_enabled" default="false" />
<xacro:arg name="kinect_enabled" default="false" />
<xacro:include filename="$(find mtu_husky_description)/urdf/husky.urdf.xacro" />
<xacro:include filename="$(find mtu_husky_gazebo)/urdf/husky1.gazebo.xacro" />
<!-- Gazebo plugin for ROS Control -->
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/husky1</robotNamespace>
</plugin>
</gazebo>
<xacro:husky_robot />
<xacro:husky_robot_gazebo />
</robot>
This works for me and allows control of both robots independently. However, I've having an issue where it's caused the "odom" frame to stop being published. So let me know if anyone has been able to figure that one out.