Chapter 2 Summary: URDF Robot Description
Generated by: Summary workflow Time to Read: 3-4 minutes Covers: Key concepts, mental models, and common mistakes
Key Takeaways
1. URDF is a Blueprint
- URDF = XML file describing robot structure
- Tells ROS 2: links (rigid bodies) + joints (connections)
- Without URDF: robots invisible to visualization and simulation tools
2. Links are Rigid Bodies
- Each link has: mass, inertia, visual geometry, collision geometry
- Links don't bend or deform
- Connected by joints to form a kinematic tree
3. Joints Connect Links
- Revolute: Rotates with limits (like hinges)
- Continuous: Rotates freely (like wheels)
- Prismatic: Slides along axis (like drawers)
- Fixed: No motion (rigid connection)
4. Coordinate Frames Matter
- XYZ: Position (X=right, Y=forward, Z=up)
- RPY: Rotation (Roll/Pitch/Yaw around axes)
- ROS 2 maintains all frame relationships using TF
5. Physics Simulation Needs Details
- Mass: Weight (kilograms)
- Inertia: Resistance to spinning
- Collision geometry: Simple shapes for physics
- Visual geometry: Detailed appearance (optional)
6. Visualization Shows Structure
- RViz: Shows 3D robot structure + sensor data (no physics)
- Gazebo: Simulates with physics (gravity, collisions)
- TF visualization: Shows coordinate frames at each joint
Mental Models
Model 1: Robot as a Tree Structure
Think of your robot like a family tree:
base_link (ancestor)
/ | \
joint_1 joint_4 joint_7
/ | \
link_1 link_4 link_7
/ | \
joint_2 joint_5 joint_8
/ | \
link_2 link_5 link_8
| | |
joint_3 joint_6 joint_9
| | |
link_3 link_6 link_3
Rules:
- Each child has exactly ONE parent
- Parent doesn't move → children stay rigid with it
- Joint defines motion between parent and child
- Circular references are ERRORS (no loops)
Model 2: From URDF to Visualization Pipeline
simple_robot.urdf (XML text file)
↓
XML Parser
↓
Kinematic Tree
├─ base_link (node)
├─ link_1 (node)
└─ link_2 (node)
└─ Joints (edges)
↓
TF Transform Tree
(coordinate frames)
↓
RViz / Gazebo
↓
3D Robot on Screen
Model 3: Inertia as "Spin Resistance"
Imagine spinning objects:
Light pencil (axis-aligned) Heavy flywheel (balanced)
Easy to spin fast Hard to spin fast
Low inertia High inertia
ixx ≈ 0.001 ixx ≈ 0.1
Same mass, different shapes
→ Same mass, different inertia
Gazebo uses inertia to calculate:
- How fast can motor spin this link?
- How long to accelerate/decelerate?
- Does simulation become unstable?
Model 4: Physics vs. Visualization
URDF contains TWO geometries per link:
Visual Geometry Collision Geometry
(What RViz shows) (What Gazebo simulates)
Detailed mesh Simple box/cylinder
~1000+ triangles ~6 vertices
Pretty graphics Fast calculations
~Human eye view ~Physics accurate
Why two?
- Visual: User should see detail
- Collision: Physics solver must be fast
- Separate = freedom to optimize each
Concept Map
URDF File Structure
├─ <robot> (root)
│ ├─ <link> (rigid bodies)
│ │ ├─ <inertial> (mass, inertia)
│ │ ├─ <visual> (appearance)
│ │ └─ <collision> (physics shape)
│ │
│ └─ <joint> (connections)
│ ├─ <parent link> (anchored)
│ ├─ <child link> (moved by joint)
│ ├─ <axis> (direction of motion)
│ ├─ <limit> (min/max angles)
│ └─ <dynamics> (friction, damping)
Tools for URDF:
├─ check_urdf (validation)
├─ RViz (visualization)
└─ Gazebo (simulation)
Common Mistakes & How to Avoid Them
❌ Mistake 1: Missing Closing Tags
Problem:
<link name="arm">
<inertial>
<mass value="1.0"> <!-- Missing closing > -->
<origin ...>
</inertial>
<!-- Check_urdf error: XML parsing failed -->
Fix: Match every opening tag with a closing tag
<mass value="1.0"/> <!-- Self-closing tag -->
<!-- OR -->
<mass>
<value>1.0</value>
</mass>
❌ Mistake 2: Non-Existent Parent/Child
Problem:
<joint name="elbow">
<parent link="arm"/>
<child link="hand"/> <!-- hand was never defined! -->
</joint>
Fix: Use check_urdf to find missing links
check_urdf robot.urdf
# ERROR: link [hand] not found
❌ Mistake 3: Wrong Inertia Values
Problem:
<inertia
ixx="0.00001" ixy="0" ixz="0" <!-- Too small! -->
iyy="0.00001" iyz="0" izz="0.00001"/>
Result: Gazebo simulation becomes unstable (robot vibrates, explodes)
Fix: Use realistic values based on shape
Guideline: inertia ≈ 0.001 × mass × size²
Example: 1 kg, 0.1m long
inertia ≈ 0.001 × 1 × (0.1)² = 0.0001
Better: 0.01-0.001 range
❌ Mistake 4: Confusing Visual and Collision Geometry
Problem:
<visual>
<geometry><mesh filename="detailed_arm.obj"/></geometry>
</visual>
<collision>
<geometry><sphere radius="0.01"/></geometry> <!-- Too small! -->
</collision>
Result: Robot can move through objects (collision mismatch)
Fix: Keep geometries similar
<visual>
<geometry><box size="0.1 0.1 0.4"/></geometry>
</visual>
<collision>
<geometry><box size="0.1 0.1 0.4"/></geometry> <!-- Same -->
</collision>
❌ Mistake 5: Wrong Joint Axes
Problem:
<joint name="elbow" type="revolute">
<axis xyz="0 1 0"/> <!-- Y-axis: up/down -->
<!-- But visually looks like left/right motion! -->
</joint>
Result: Joint rotates wrong direction (confusing behavior)
Fix: Think about robot mechanics
Left/Right (yaw): <axis xyz="0 0 1"/> Z-axis
Up/Down (pitch): <axis xyz="0 1 0"/> Y-axis
Forward/Back (roll): <axis xyz="1 0 0"/> X-axis
❌ Mistake 6: Forgetting Origin in Joints
Problem:
<joint name="shoulder">
<parent link="torso"/>
<child link="arm"/>
<!-- Missing: <origin xyz="0.15 0 0.5" rpy="0 0 0"/> -->
<axis xyz="0 1 0"/>
</joint>
Result: Arm appears at center of torso instead of shoulder
Fix: Specify where joint connects
<joint name="shoulder">
<parent link="torso"/>
<child link="arm"/>
<origin xyz="0.15 0 0.5" rpy="0 0 0"/> <!-- ← Added -->
<axis xyz="0 1 0"/>
</joint>
Quick Reference
Creating a Link
<link name="my_link">
<inertial>
<mass value="1.0"/>
<origin xyz="0 0 0" rpy="0 0 0"/>
<inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.01"/>
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry><box size="0.1 0.1 0.1"/></geometry>
<material name="blue"><color rgba="0 0 1 1"/></material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry><box size="0.1 0.1 0.1"/></geometry>
</collision>
</link>
Creating a Joint
<joint name="my_joint" type="revolute">
<parent link="parent_link"/>
<child link="child_link"/>
<origin xyz="0 0 0.1" rpy="0 0 0"/>
<axis xyz="0 0 1"/>
<limit lower="-3.14" upper="3.14" effort="10" velocity="1"/>
<dynamics damping="0.1" friction="0.1"/>
</joint>
Validation Commands
# Validate URDF
check_urdf robot.urdf
# View TF tree
ros2 run tf2_tools view_frames
# Visualize in RViz
ros2 launch my_robot display.launch.py
# Simulate in Gazebo
ros2 launch my_robot gazebo.launch.py
What You Can Now Do
✅ Understand URDF structure and purpose ✅ Create valid URDF files with links and joints ✅ Add physics properties (mass, inertia, collision) ✅ Visualize robots in RViz and Gazebo ✅ Identify and fix common URDF errors ✅ Debug why robots look wrong or move incorrectly
What Comes Next
In Chapter 3: Python Integration, you'll learn:
- How to control robots using Python (rclpy)
- Read sensor data from your URDF-described robot
- Move joints using motors
- Implement control algorithms (velocity, position, force)
- Use parameters for configuration
- Build complete robotic systems
The URDF you create in this chapter is the blueprint that Chapter 3 code will control.
Practice Problems (Optional)
Try these without references:
- Easy: Given a robot with 2 links, what XML elements define each link?
- Medium: Why might a robot "explode" in Gazebo simulation?
- Hard: Design URDF for a wheeled robot (base + 2 wheels + caster wheel)
Resources for Deeper Learning
Official ROS 2 Documentation
External Tools
Review Checklist
Before moving to Chapter 3, verify you:
- Understand what URDF is and why robots need descriptions
- Can create URDF files with correct XML syntax
- Know the difference between links (rigid bodies) and joints (connections)
- Can calculate or estimate mass and inertia
- Understand visual vs. collision geometry
- Can validate URDF using
check_urdf - Can visualize robots in RViz
- Can identify and fix common URDF errors
- Completed all three exercises
If you checked all boxes, you're ready for Chapter 3: Python Integration!
Next Steps
- Immediate: Review the exercises and modify
simple_robot.urdf - Practice: Create a new robot URDF from scratch
- Experiment: Launch humanoid.urdf in RViz and Gazebo
- Next Chapter: Chapter 3: Python Integration
Summary Status: Complete ✅ Last Updated: 2025-11-30