ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

The link "base_link" is just fine. The problem is that the second visual tag (in the link "base_laser") is missing the required <geometry> element. You also need to specify a joint between the two links, otherwise the robot_state_publisher will complain that there are two root links. Below are working versions of the URDF and launch file. Also see the URDF XML documentation and the URDF tutorials.

URDF file:

<robot name="your_robot_name">
  <link name="base_link">
    <visual>
      <origin rpy="0 0 0" xyz="0.15 0 0.35"/>
      <geometry>
        <mesh filename="package://pr2_description/meshes/head_v0/head_pan.stl"/>
      </geometry>
    </visual>
  </link>

  <joint name="base_link_to_base_laser_joint" type="fixed">
    <parent link="base_link"/>
    <child link="base_laser"/>
    <origin xyz="0 0 1.0"/>
  </joint>

  <link name="base_laser">
    <visual>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <geometry>
        <cylinder length="0.6" radius="0.2"/>
      </geometry>
    </visual>
  </link>
</robot>

launch file:

<launch>
  <!-- upload urdf -->
  <param name="robot_description" textfile="$(find your_package_name)/urdf/your_robot.urdf" />

  <!-- robot state publisher -->
  <node pkg="robot_state_publisher" type="state_publisher" name="robot_state_publisher" />

  <!-- joint state publisher with gui -->
  <param name="use_gui" value="true" />
  <node pkg="joint_state_publisher" type="joint_state_publisher" name="joint_state_publisher"/>
</launch>