URDF: describing a robot
Describe the robot in text, and the computer can build it
Before a robot can be shown on a screen or tested in a simulator, the computer must be told what the robot is: which parts it has, how they are joined, which parts move and where the sensors sit. In ROS 2 this is written in a URDF file, using tags that look like a web page. This page walks through the file one tag at a time. Every step has a simulator to play with: a live text editor, a container that can be emptied, reference frames, a box with three descriptions, a physics sandbox, a joint builder, a tree checker, a robot that moves as a tree, joint types, a 3D axis and limits, and an arm that grows. All numbers on the page are teaching values.
Words used on this page (open this if a word is new)
URDFShort for Unified Robot Description Format. A text file that describes what a robot is made of.
XMLA way of writing information with tags, like <link>. HTML web pages use the same idea.
tagA word in angle brackets, like <robot>. Most tags open and close, or close themselves with a slash.
attributeAn extra detail written inside a tag, like name=”base_link”.
robot modelA description of a robot that a computer can read: its parts, joints and shapes.
linkOne part of the robot, such as the body or a wheel. A link is also a reference frame.
reference frameA point to measure from, with arrows that show which way is forward and which way is left.
jointThe connection between two links. It can be fixed or movable.
parent, childIn a joint, the parent is the link that holds, and the child is the link that hangs from it.
rootThe one top link of the tree. It has no parent.
treeA shape that starts from one root and branches out. Nothing in it loops back.
base_linkThe usual name for the main body of the robot.
base_footprintA point on the ground right under the robot. Often the parent of base_link.
visualThe tag that says how a link looks on the screen.
collisionThe tag that gives the solid shape of a link, used when things hit each other.
inertialThe tag that gives mass and balance, used by the physics engine.
meshA 3D model made of many small flat faces. It can look very detailed.
massHow much matter a thing holds. It is measured in kilograms (kg).
centre of massThe balance point of a thing. If it is lifted there, it stays level.
physics engineA program that copies gravity, pushes, friction and collisions.
newton (N)A unit of force. Pushing a small apple takes about 1 N.
fixed jointA joint with no movement at all.
revolute jointA joint that turns, but only between two limits, like an elbow.
continuous jointA joint that turns round and round with no limit, like a wheel.
prismatic jointA joint that slides in a straight line, like a drawer.
axisThe line that a joint turns around, or slides along.
limitThe smallest and largest value that a movable joint may reach.
radian (rad)A way to measure angles. 3.14 rad is half a turn (180 degrees). 1.57 rad is 90 degrees.
ROS 2A free software kit for building robot software. It reads URDF files.
simulationA computer copy of a robot and its world, used to test before using the real robot.
sensorA part that lets the robot measure the world, like a camera or a laser scanner.
laser scannerA sensor that measures distances all around by sending out light beams.
01
Robot structure: what must be defined first
Both a real robot and a simulated robot need a structure before anything else. The structure answers five questions: which parts the robot has, how the parts are connected, which parts are fixed, which are movable, and where the sensors sit. As an example, take a small mobile robot: a base, two wheels, a camera and a laser scanner. The model must say how these parts are joined. Once the structure is written down in a URDF file, the same file can build a robot model, and the model can be shown and simulated in ROS 2.
Key idea. The first step for any robot, real or simulated, is to define its structure. A URDF file holds that structure, and ROS 2 turns it into a robot model for visualization and simulation.
02
URDF: a robot written as tags
URDF stands for Unified Robot Description Format. It is a convention that the robotics community uses to describe the structure of a robot. It is written with XML tags, so it looks much like an HTML file: tags organise the information. A URDF file says what parts exist, how they are connected, which are fixed or movable and where the sensors sit. Below, the file is live. Change the text and the robot changes with it.
Key idea. A URDF file describes four things: what parts the robot has, how the parts are connected, which parts are fixed or movable, and where the sensors are placed.
03
The robot tag: the container for everything
Everything in a URDF file starts with the robot tag. It defines the robot structure, acts as a container for all the robot components, and holds the information about how the components are connected. It is the root, the top level of the file, and it usually has a name to identify the robot.
Key idea. The robot tag is the root of a URDF file. Links, joints and every other element are written inside it.
04
The link tag: the parts of the robot
The link tag stands for one component of the robot. Basically, a link creates a reference frame with some properties. A link can have a name, for example base_link. The robot body, also called the chassis, is usually the link named base_link. Other links in the example robot are the two wheels, the camera and the laser scanner. A reference frame is a point to measure from, with arrows for forward and left.
Key idea. A link is one component of the robot. It has a name and a reference frame, and it can carry more properties.
05
What a link can carry: visual, collision, inertial
A link can also have a physical size or a 3D model attached. It does so through three tags. visual says what the component looks like on the screen. collision says how it meets other objects in a simulation. inertial gives its physical properties, such as mass and centre of mass, for the physics engine. The next simulator shows all three on one box. Switch each one on and off, and notice that they are separate descriptions.
Key idea. visual is how it looks, collision is how it bumps, inertial is how heavy it is and where it balances.
06
Physics simulation: using those three tags
The visual, collision and inertial information can be used by the physics engine. The engine uses these properties to simulate the robot, its movement and how it meets the surroundings. So URDF is not only about showing what the robot looks like. It also holds the information that a simulation needs. Switch the tags off one at a time below and see what the physics engine can no longer do.
Key idea. URDF gives the physics engine what it needs: the solid shape from collision, and the mass and balance from inertial. Looks alone are not enough.
07
The joint tag: connecting two links
Another commonly used tag is the joint tag. A joint is used to connect two links together. Inside the joint, the names of the two connected links are written. The connection follows a tree-like structure: a parent link, then the joint, then a child link. Fill in the four joints of the example robot below.
Key idea. A joint connects exactly two links: parent link, joint, child link.
08
Parent and child: one parent, many children
A joint always has a parent and a child. In the example, base_footprint is the parent and base_link is the child. The important rule is that each link can only be connected to one parent. However, one parent can have multiple children. Build a tree below, break the rule on purpose, and read what goes wrong.
Key idea. Each link has one parent. One parent can have many children. That is what keeps the structure a tree.
09
The robot as a tree
When many links are joined by joints, the result looks like a tree. It starts from one initial link, the root, and the other links branch out from it through joints. This is the basic structural idea of a URDF robot model. A useful result of the tree: when a link moves, everything below it moves along. Try it on the robot below. (The caster, the small free wheel at the back, is drawn as two links, a swivel and a wheel, to show a branch that is two steps long.)
Key idea. A URDF robot is a tree with one root link. Other links branch out through joints, and a child always follows its parent.
10
Joint type: fixed or movable
Inside a joint, the type of connection can be set. Two links can be fixed: one does not move against the other. Or they can be movable: one can move against the other, by rotation or by translation (sliding). The types in the picture are fixed, revolute, continuous and prismatic. Try each one.
Key idea. A fixed joint allows no relative movement. A movable joint allows rotation or translation.
11
Axis and movement limits
When one link is movable against another, more properties can be set. The axis says which line the link turns around. The limits say how far the two links may move against each other. So a movable joint describes three things: the type of connection, the axis, and the limits. The simulator below is in 3D. Turn the view around to see how the axis changes the motion.
Key idea. A movable joint can describe its type, its rotation or movement axis, and its movement limits.
12
The complete robot model
By using the link and joint tags again and again, a whole robot can be defined: each component, the connections between them, and how they can move. The result is the complete model of the robot. It lets a viewer see how the links are connected, how they move and how they turn against each other. Build a small arm below, one link and one joint at a time, and watch the text file grow.
Key idea. Repeat link and joint, and the complete robot model appears: its parts, its connections and its motion.
13
Revision
All of URDF fits in one family tree. Click through it, then test the memory.
Key idea. URDF has a robot tag. Inside it are links (components, with visual, collision and inertial) and joints (connections, from parent to child).
14
Summary and quiz
Key takeaways
- The first step for a robot, real or simulated, is to define its structure.
- URDF is a convention for describing a robot, written with XML tags, much like HTML.
- The robot tag is the root and the container of everything.
- A link is a component and a reference frame. It can have visual, collision and inertial parts.
- A joint connects a parent link to a child link. A link has one parent, and a parent can have many children.
- Joints are fixed or movable. Movable joints can have an axis and limits.
Good to know
URDF
|
<robot>
|– <link> components
| |– visual
| |– collision
| `– inertial
`– <joint> connections
`– parent -> child
Quiz