Combining URDF-files with tf (static_transform)
Hello, I'm struggling with combining different urdf files (robots). I had some problems when I added everything in one urdf file ( http://answers.gazebosim.org/question... ) so I tried another attempt. I split it up in two different urdf files and made a static transform between the two links.
This is my launch file
<?xml version="1.0" ?>
<launch>
<!-- LAUNCH INTERFACE -->
<!-- The robot name is required for gazebo to spawn a model. -->
<arg name="robot_name" default="kuka-lwr-gripper"/>
<!-- The recommended way of specifying the URDF file is to pass it in
directly. -->
<arg name="robot_path" default="$(find kuka-lwr-gripper)/robot"/>
<arg name="robot_urdf_file" default="$(arg robot_path)/$(arg robot_name)_standalone.urdf.xacro" />
<arg name="gripper_urdf_file" default="$(arg robot_path)/simple_gripper/simple_gripper_model.urdf.xacro" />
<!-- <arg name="controllers" default="joint_controllers"/> -->
<arg name="controllers" default="joint_controllers"/>
<arg name="t1_limits" default="false"/>
<arg name="rviz_config" default="$(find lwr_launch)/launch/rviz/rviz_config.rviz"/>
<arg name="rviz_bringup" default="true"/> <!--If false, do not launch rviz-->
<arg name="hw_interface_file" default="$(find kuka-lwr-gripper)/config/hw_interface.yaml"/>
<arg name="controller_config_file" default="$(find kuka-lwr-gripper)/config/controllers.yaml"/>
<arg name="gazebo_world_file" default="$(find kuka-lwr-gripper)/worlds/simple_environment.world"/>
<arg name="t1_limits_file" default="$(find kuka-lwr-gripper)/config/t1_joint_limits.yaml"/>
<arg name="GAZEBO_GUI" default="true"/>
<!-- gripper parameters -->
<arg name="gripper_controller_config_file" default="$(find kuka-lwr-gripper)/config/gripper_controllers.yaml"/>
<!-- ROBOT -->
<group ns="lwr">
<param name="robot_description" command="$(find xacro)/xacro $(arg robot_urdf_file)"/>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
</group>
<!-- GRIPPER -->
<group ns="my_gripper">
<param name="robot_description" command="$(find xacro)/xacro $(arg gripper_urdf_file)"/>
<node name="my_tp_lwr" pkg="tf" type="static_transform_publisher" args="0 0 0.01 0 0 0 lwr_7_link base_link 100"/>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
</group>
<!-- GAZEBO -->
<node name="spawn_urdf1" pkg="gazebo_ros" type="spawn_model" args="-param /lwr/robot_description -urdf -model $(arg robot_name)" respawn="false" output="screen" />
<node name="spawn_urdf2" pkg="gazebo_ros" type="spawn_model" args="-param /my_gripper/robot_description -urdf -model my_gripper1" respawn="false" output="screen" />
<!-- enable/disable gui at will, the rviz listens to the simulation -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(arg gazebo_world_file)"/>
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="$(arg GAZEBO_GUI)"/>
<arg name="headless" value="false"/>
<arg name="debug" value="false"/>
</include>
<!-- Load updated joint limits (override information from single_lwr_moveit) to respect T1 mode limits -->
<group if="$(arg t1_limits)" ns="robot_description_planning">
<rosparam command="load" file="$(arg t1_limits_file)"/>
</group>
<!-- load robotHW configurations to rosparam server -->
<rosparam command="load" file="$(arg hw_interface_file)"/>
<!-- load all controller configurations to rosparam server -->
<rosparam command="load" file="$(arg controller_config_file)" />
<!-- load the gripper controller configuration to rosparam server -->
<rosparam command="load" file="$(arg gripper_controller_config_file)"/>
<!-- real robot and controllers -->
<group ns="lwr">
<!-- spawn only desired controllers in current namespace -->
<node name="controller_spawner_js" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="kuka_joint_state_controller"/>
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="$(arg controllers)"/>
</group>
<group ns="my_gripper">
<!-- <param name="robot_description" command="$(find xacro)/xacro.py $(arg robot_urdf_file)"/> -->
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="left_finger_joint_position_controller right_finger_joint_position_controller joint_state_controller"/>
</group>
<!-- LAUNCH RVIZ -->
<node name="lwr_rviz" pkg="rviz ...
Are there any error messages? Are you sure the gripper files are being found? Are they in a different package than your new URDF file?
Yes, they are in different packages (the URDF for the robot and the URDF for the gripper; in the same catkin ws though) but that shouldn't be a problem in my opinion. And no, I don't get any errors, that was one reason to post here because I don't know where to search for the problem now. I'm pretty sure, that the gripper files are found, firstly there are no errors and secondly I can see the separate parts in Gazebo (not in RViz).
Can you post a link to a minimal version of your project workspace? Have you tried using a different package for the gripper?
I made a github project (I hope everything runs; it's my first time I pushed a project myself). https://github.com/steradiant/minimal...
The project doesn't build because 'ncurses.h' is missing and other dependencies cannot be found. After blacklisting the offending packages, Gazebo gives
ERROR: cannot launch node of type [controller_manager/spawner]: controller_manager
for me. Can you confirm?No, I don't get this error. The launch file starts without errors for me. Have you installed ros_control? If not, pleas run
rosrun apt-get install ros-kinetic-ros-control
I think the dependencies of the package were not installed automatically and I didn't use a full ROS image for the test last time.