Unified Robotics Description Format (URDF)

URDF is an XML specification used in to model robots. Especially popular with ROS, but used very widely everywhere.

Resources:

Whenever you make a new robot, you should specify a URDF, which tells you the static transformations between different Coordinate Frames.

Other formats (source):

  • Simulation Description Format (SDF)
  • MuJoCo format (MJCF)

CONFUSION:

  • Why do you specify the transforms in 2 places?

I understand for <joint>, which tells you how to go from one frame to other, but what about for <link>?

  • It seems to only be for visual purposes, but I’d like to understand what is actually done

Quickly visualizing in Rviz

sudo apt install ros-$ROS_DISTRO-urdf-tutorial

Then, launch

ros2 launch urdf_tutorial display.launch.py model:=path/to/model.urdf

URDF Tags

The main tags that you must understand:

  • <robot>
  • <link>
  • <joint>

At a high level, URDF describes a robot as a tree of links, that are connected by joints:

  1. Links represent the physical components of the robot
  2. Joints represent how one link moves relative to another link,

This effectively defines the location of the links in space.

Origins

  • Joint Origin: Specifies the position and orientation of a joint with respect to the parent link’s coordinate frame.
  • Link Origin: Specifies the position and orientation of the visual and collision geometry within a link’s own coordinate frame.

<robot> element

The root element in a robot description file must be a robot, with all other elements must be encapsulated within.

Elements

  • <link>: defines a link with its own frame
  • <joint>: mandatory joint frame definition
  • <transmission>: (PR2 specific)
  • <gazebo>: Gazebo simulation extensions

The link element describes a rigid body with the following additional properties:

  1. <inertial> - This is also used for physics calculations, but determines how the link responds to forces. The inertial properties are:
    • <mass> - Mass of the link
    • <origin> - The centre of mass (a.k.a centre of gravity). For most simple cases this will just be the centre (same origin as visual/collision).
    • <inertia>- The rotational inertia matrix.
  2. <visual> - This is what we see in RViz and Gazebo. We can specify three aspects:
    • <geometry> - box/ cylinder / sphere with size parameters, or a mesh
    • <origin> - an offset for the geometry so it doesn’t need to be centered around the link origin
    • <material> - we can specify the name of a declared material, or describe the color directly
  3. <collision> - used for physics collision calculations. We can set the:
    • <geometry> and <origin> - Same options as for visual. Copy-paste from <visual>, but might want a simpler collision geometry to simplify computation

Example of URDF

 <link name="my_link">
   <inertial>
     <origin xyz="0 0 0.5" rpy="0 0 0"/>
     <mass value="1"/>
     <inertia ixx="100"  ixy="0"  ixz="0" iyy="100" iyz="0" izz="100" />
   </inertial>
 
   <visual>
     <origin xyz="0 0 0" rpy="0 0 0" />
     <geometry>
       <box size="1 1 1" />
     </geometry>
     <material name="Cyan">
       <color rgba="0 1.0 1.0 1.0"/>
     </material>
   </visual>
 
   <collision>
     <origin xyz="0 0 0" rpy="0 0 0"/>
     <geometry>
       <cylinder radius="1" length="0.5"/>
     </geometry>
   </collision>
 </link>

<joint> tag

The most common types of joints:

  • Revolute - A rotational motion, with minimum/maximum angle limits
  • Continuous - A rotational motion with no limit (e.g. a wheel)
  • Prismatic - A linear sliding motion, with minimum/maximum position limits
  • Fixed - The child link is rigidly connected to the parent link. This is what we use for those ā€œconvenienceā€ links

See Robot Joint for more details.

Each joint will need to have the following specified:

  • name - A name for the joint
  • type - The joint type as mentioned earlier (the four most popular being fixed, prismatic, revolute, and continuous). Parent and child links - Which links this joint defines a relationship between Origin - The relationship between the two links, before any motion is applied
 <joint name="my_joint" type="floating">
    <origin xyz="0 0 1" rpy="0 0 3.1416"/>
    <parent link="link1"/>
    <child link="link2"/>
 
    <calibration rising="0.0"/>
    <dynamics damping="0.0" friction="0.0"/>
    <limit effort="30" velocity="1.0" lower="-2.2" upper="0.7" />
    <safety_controller k_velocity="10" k_position="15" soft_lower_limit="-2.0" soft_upper_limit="0.5" />
 </joint>

Xacro

Introduced from the ArticulatedRobotics article tutorial. https://wiki.ros.org/xacro

Why Xacro?

Xacro allows us to break up a large URDF file into multiple files and avoid duplicate code.

To use Xacro, make sure to include the following

<robot xmlns:xacro="http://www.ros.org/wiki/xacro">

At NVIDIA

One of the tasks I had at NVIDIA was to create a URDF converter, which goes from our custom JSON to a URDF.

There exists parsers, the most popular one being urdfdom maintained by Open Robotics: https://wiki.ros.org/urdf

Some questions:

Create3 urdf https://github.com/iRobotEducation/create3_sim/blob/fa3d501baec47a4fee51b11e3638d7ad417bf2b4/irobot_create_common/irobot_create_description/urdf/create3.urdf.xacro

I find out that we have a USD format, and that we have a USD to URDF converter, so I can just use that.