Ask Your Question

Revision history [back]

I have managed to make it working following Stefan's and Adolfo's suggestions. I will summarise two important points for anybody in the future who would like to combine two robots together which have separate controllers.

  • Both robot description files have to be combined into a single URDF (lwr_ahand_init.xacro in my case which combines the lwr kuka and allegro hand) before being called in a launch file.
  • Take care of namespaces which are defined in .yaml control config files, when you spawn a controller manager it will take a default namespace which was specified at the top of your .yaml file.

In Stephan's solution the description of the robot components are in a single .yaml file. We can however keep the description of both robots in two separate catkin projects and combine them in a third project. My robots.launch file changed as follows (see the original problem description for the previous form):

<launch>
    <!-- LWR KUKA & HAND ROBOT -->
    <group ns="lwr">
        <param name="robot_description"                                                                   command="$(find xacro)/xacro.py $(find table_world)/urdf/lwr_ahand_init.xacro" />
            <include file="$(find table_world)/launch/launch/lwr_ahand.launch" >
                <arg name="init_pose" value="-x 0 -y 0 -z 0" />
                <arg name="robot_name"  value="lwr" />
            </include>
    </group>
</launch>

This is the first part. The second involves loading the two .yaml control files of each respective robot and spawn them in control manager.

<launch>
<rosparam ns="lwr" file="$(find lwr_control)/config/lwr_control.yaml" command="load"/>
<rosparam ns="lwr" file="$(find ahand_control)/config/ahand_control.yaml" command="load"/>

<node ns="lwr" name="controller_spawner" pkg="controller_manager" type="spawner"             
          output="screen" 
          args="lwr/joint_state_controller lwr/OneTaskInverseKinematics 
               ahand/TaskInverseKinematics" /> 

<node  name="controller_spawner_stopped" pkg="controller_manager" type="spawner" 
        output="screen"  args="--stopped $(arg stopped_controllers)"/> 

</launch>

I loaded the two config files into there own namespace /lwr and /ahand respectively. I tried to have a different namespace for the controller_spawner but nothing else than lwr seems to work. In this setting I can control both the hand and the robot with their own controllers and I don't need to merge the .yaml files. The control topics (rostopic list) are now:

  • /lwr/lwr/OneTaskInverseKinematics
  • /lwr/ahand/TaskInverseKinematics