Mastering ROS for Robotics Programming(Second Edition)
上QQ阅读APP看书,第一时间看更新

Understanding robot modeling using URDF

We have discussed the urdf package. In this section, we will look further into the URDF XML tags, which help to model the robot. We have to create a file and write the relationship between each link and joint in the robot and save the file with the  .urdf extension.

URDF can represent the kinematic and dynamic description of the robot, the visual representation of the robot, and the collision model of the robot.

The following tags are the commonly used URDF tags to compose a URDF robot model:

  • link: The link tag represents a single link of a robot. Using this tag, we
    can model a robot link and its properties. The modeling includes the size, the shape, and the color, and it can even import a 3D mesh to represent the robot link. We can also provide the dynamic properties of the link, such as the inertial matrix and the collision properties.

The syntax is as follows:

<link name="<name of the link>"> 
<inertial>...........</inertial> 
  <visual> ............</visual> 
  <collision>..........</collision> 
</link> 

The following is a representation of a single link. The Visual section represents the real link of the robot, and the area surrounding the real link is the Collision section. The Collision section encapsulates the real link to detect collision before hitting the real link:

Figure 1: Visualization of a URDF link
  • joint: The joint tag represents a robot joint. We can specify the kinematics and the dynamics of the joint, and set the limits of the joint movement and its velocity. The joint tag supports the different types of joints, such as revolute, continuous, prismatic, fixed, floating, and planar.

The syntax is as follows:

<joint name="<name of the joint>"> 
  <parent link="link1"/> 
  <child link="link2"/> 
   
  <calibration .... /> 
  <dynamics damping ..../> 
  <limit effort .... /> 
</joint> 

A URDF joint is formed between two links; the first is called the Parent link, and the second is called the Child link. The following is an illustration of a joint and its link:

Figure 2: Visualization of a URDF joint
  • robot: This tag encapsulates the entire robot model that can be represented using URDF. Inside the robot tag, we can define the name of the robot, the links, and the joints of the robot.

The syntax is as follows:

<robot name="<name of the robot>" 
  <link>  ..... </link> 
  <link> ...... </link> 
 
  <joint> ....... </joint> 
  <joint> ........</joint> 
</robot> 

A robot model consists of connected links and joints. Here is a visualization of the robot model:

Figure 3: Visualization of a robot model having joints and links
  • gazebo: This tag is used when we include the simulation parameters of the Gazebo simulator inside the URDF. We can use this tag to include gazebo plugins, gazebo material properties, and so on. The following shows an example using gazebo tags:
 <gazebo reference="link_1"> 
    <material>Gazebo/Black</material> 
 </gazebo> 

You can find more URDF tags at http://wiki.ros.org/urdf/XML.