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:
- https://articulatedrobotics.xyz/ready-for-ros-7-urdf/
- Real robot URDF: https://articulatedrobotics.xyz/mobile-robot-2-concept-urdf/
- The XML specs of URDF: http://wiki.ros.org/urdf/XML
- Quick URDF launcher tutorial https://docs.ros.org/en/rolling/Tutorials/Intermediate/URDF/Building-a-Visual-Robot-Model-with-URDF-from-Scratch.html
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
- Source: ROS2 URDF Tutorial
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:
- Links represent the physical components of the robot
- 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
<link>
element
The link element describes a rigid body with the following additional properties:
<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.
<visual>
- This is what we see in RViz and Gazebo. We can specify three aspects:<geometry>
-box
/cylinder
/sphere
with size parameters, or amesh
<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
<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
<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 jointtype
- 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
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
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:
- Use a single file, or break down into multiple files?
- Turtlebot for example breaks it down into so many files https://github.com/turtlebot/turtlebot/blob/melodic/turtlebot_description/urdf/sensors/kinect.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.