multiple robots and ros_control
I am trying to spawn two different robot models, one is a robotic arm (lwr kuka) and the other is a robotic hand manipulator (allegro hand), with their own controllers. I can load and control both robots independently from one another at the moment. See the figure bellow for an idea of the setup. My goal is to be able to control these two connected robots with their own separate controllers.
I have seen the discussion regarding spawning multiple turtle-bots, but my situation is different. I want the two robots (arm and hand) to be connect by a link (from arm eof to hand base) but controlled separately. Here is the description of my launch file robots.lauch:
<launch>
<!-- LWR KUKA ROBOT -->
<group ns="lwr">
<param name="robot_description" command="$(find xacro)/xacro.py $(find pkg)/urdf/kuka_init.xacro" />
<include file="$(find pkg)/launch/launch/lwr_kuka.launch" >
<arg name="init_pose" value="-x 0 -y 0 -z 0" />
<arg name="robot_name" value="lwr" />
</include>
</group>
<!-- ALLEGRO HAND ROBOT-->
<group ns="ahand">
<param name="robot_description" command="$(find xacro)/xacro.py $(find pkg)/urdf/ahand_init.xacro" />
<include file="$(find pkg)/launch/launch/ahand.launch" >
<arg name="init_pose" value="-x 0 -y 0 -z 0.2" />
<arg name="robot_name" value="ahand" />
</include>
</group>
</launch>
Here are two launch files of the independent robots lwr_kuka.lauch
<launch>
<arg name="robot_name" default="lwr"/>
<arg name="init_pose"/>
<arg name="use_joint_state_publisher" default="true"/>
<node name="spawn_kuka_model" pkg="gazebo_ros" type="spawn_model"
args="$(arg init_pose) -urdf -param /lwr/robot_description -model $(arg robot_name)"
respawn="false" output="screen" />
</launch>
and ahand.launch
<launch>
<arg name="robot_name" default="ahand"/>
<arg name="init_pose"/>
<node name="spawn_ahand_model" pkg="gazebo_ros" type="spawn_model"
args="$(arg init_pose) -urdf -param /ahand/robot_description -model $(arg robot_name)"
respawn="false" output="screen" />
</launch>
To connect both of them I tried to change the parent link in my ahand_init.xacro to be the last link of the robot arm.
<robot name="ahand" xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:include filename="$(find allegro_hand_description)/urdf/hand.xacro"/>
<link name="lwr_7_link"/>
<xacro:ahand prefix="ahand" parent_link="lwr_7_link" xyz="0.0 0 0.2" rpy="0 0 0" left="1"/>
</robot>
This not a workable solution. It seems that the full description of the robot (both arm and hand) have be defined in a single .xacro file and cannot be combine in a roslaunch file. Is this an accurate observation ? It would be great if a robot could be assembled in the roslaunch file, especially when considering multiple possible end-effectors.
Since this did not work, the back up solution is to have a kuka_ahand.xacro file which combines the two models. The problem is then shifted in how to important two controllers for one urdf robot description. I would appreciate suggestions on how to do this. I would like to have two separate .yaml files and controllers which get loaded in the launch file. Is this possible ?
Proposed solution 1) connect ahand_base_link and lwr_link with a static tf broadcaster. (Edit: only works (possibly) when consider ...