URDF and SDF: Bridging Robot Description and Simulation
Overview
In the previous sections, we learned about digital twins and setting up physics simulation with Gazebo. Now, we'll dive deeper into the core technologies that describe and simulate robots: URDF (Unified Robot Description Format) for general robot description and SDF (Simulation Description Format) for simulation-specific details.
This chapter will provide a comprehensive understanding of how these formats work together to create accurate robot simulations that can be used for development, testing, and validation before deploying to physical robots.
Learning Objectives
After completing this chapter, you will be able to:
- Explain the differences and relationships between URDF and SDF
- Create and modify URDF files to describe robot kinematics and dynamics
- Understand SDF extensions and how they enhance simulation capabilities
- Convert between URDF and SDF formats for different use cases
- Implement sensor configurations in both formats for accurate simulation
URDF: The Robot Description Foundation
What is URDF?
URDF (Unified Robot Description Format) is an XML-based format used to describe robots in ROS. It defines the physical properties of robots, including:
- Links (rigid bodies)
- Joints (constraints between links)
- Visual and collision properties
- Inertial properties
- Sensors and actuators
Basic URDF Structure
A typical URDF file follows this structure:
<?xml version="1.0"?>
<robot name="robot_name">
<!-- Links define rigid bodies -->
<link name="base_link">
<visual>
<geometry>
<cylinder length="0.6" radius="0.2"/>
</geometry>
<material name="blue">
<color rgba="0 0 0.8 1"/>
</material>
</visual>
<collision>
<geometry>
<cylinder length="0.6" radius="0.2"/>
</geometry>
</collision>
<inertial>
<mass value="10"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
<!-- Joints define constraints between links -->
<joint name="base_to_wheel" type="continuous">
<parent link="base_link"/>
<child link="wheel_link"/>
<origin xyz="0 0.5 0" rpy="0 0 0"/>
<axis xyz="0 1 0"/>
</joint>
<link name="wheel_link">
<visual>
<geometry>
<cylinder length="0.1" radius="0.3"/>
</geometry>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
</link>
</robot>