Construct a robot model with URDF I

Simulating a robot in Gazebo requires a description of the robot model. One way to represent such a model, is to use the URDF format (standing for Unified Robot Description Format). The URDF format is simply an XML format that describes a robot, its parts, its joints, dimensions, and so on. Whenever you see a 3D robot on ROS, e.g. the PR2 (Willow Garage) or the Robonaut (NASA), a URDF file is associated with it.

In this post, we will develop a simple model for a differential drive robot. You can find the related files at Odisseus GitHub repository.

In general, when building a simulation with ROS, we should decide upon the following

  1.  The messaging interface that we will use
  2.  The drivers of the robot’s motors
  3.  The model of the robot
  4.  The physical properties to use in the simulation with Gazebo (or any other simulator whatsoever)
  5. How to transform between different coordinate frames (see the tf library)
  6. The sensors to use
  7.  The algorithms for navigation

As we already mentioned, in this post, we will develop a URDF description of a differential drive robot. Such a robot is characterized by :

  1.  forward/backward movement
  2. rotation (i.e. yaw ) around the z axis
  3. cannot translate side-to-side (y axis)
  4. cannot move along the z axis (i.e. up and down)
  5. cannot roll or pitch (i.e. rotate ) along its x and y axis

Furthermore, our robot has the following essential components

  1. One chassis
  2. Two rear wheels attached to the chassis
  3. One front caster attached to the chassis
  4. One front wheel attached to the front caster

The URDF format is only capable of representing robots whose kinematics can be described by a tree. Thus, looping structures are not allowed.  Of course, we can easily come up a tree-like description of our robot and hence use the format. The URDF format includes primarily two essential items:

  1.  links: i.e a rigid body, such as a chassis or a wheel
  2. joints: i.e. how two links are connected and move with respect to each other.

Let’s now open the odisseus.urdf file you can find in Odisseus GitHub repository.

The file contains some entries related to Gazebo which we will not discuss here.

At first, you can notice that the file follows an XML format with the root node called robot which has a name property that simply indicates the name of our robot.

Scrolling the file further down, you will see that it contains link and joint nodes. Each of these must specify their name property which should be unique.

Furthermore, you can see that nodes of type joint can have a visual description designated by the visual node. If we want the link to be visible in rviz or Gazebo, we need to provide this node. We can specify the geometry of the link using the geometry node and the visual effect using the material node. Try to change the RGB values to see what happens.

A handy tool for visualizing URDF model structures is urdf_to_graphiz. This tool, parses a URDF file to produce a topological graph representation of the model, showing how links and joints are connected. Try it on odisseus model by running urdf_to_graphiz odisseus.urdf. This will produce an odisseus.pdf file which you can view with a PDF viewer.

The other type of node we have are joint nodes. These, as their name suggests, joint together two links. Again joint nodes should have a name and also a type which specifies the kind of the joint. Here is a list of joints supported by the URDF format:

  1. Continuous: a joint that can rotate indefinitely about a single axis
  2. Revolute:  like a continuous joint, but with upper and lower angle limits
  3. Prismatic: a joint that slides linearly along a single axis, with upper and lower position limits
  4. Planar: a joint that allows translation and rotation perpendicular to a plane
  5. Floating: a joint that allows full six-dimensional translation and rotation
  6. Fixed: a  joint type that allows no motion

The joint_state_publisher can be used to control/check the joint(s) defined in URDF. You can launch it when starting rviz. For our case this can be done by typing

roslaunch odisseus odisseus.launch gui:=True

You will see that in addition to rviz you get a small window named, well, joint_state_publisher.

To check whether the syntax used in the file, is correct, we can use the


command tool.

Arguably, the URDF can be quite verbose for robots that contain many links and joints. xacro helps in reducing the overall size of the URDF file and makes it easier to read and maintain but we will touch upon this in another post.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s