Skip to main content

URDF for Humanoid Robots

Learning Objectives

After completing this chapter, you will be able to:

  • Create comprehensive URDF files for humanoid robots
  • Understand the structure and elements of URDF robot descriptions
  • Implement accurate kinematic chains for humanoid robot models
  • Integrate URDF models with ROS 2 for visualization and simulation

Introduction

URDF (Unified Robot Description Format) is the standard XML format for representing robot models in ROS. For humanoid robots in Physical AI applications, URDF is essential for defining the robot's physical structure, kinematic chains, and visual properties. A properly configured URDF model enables simulation, visualization, motion planning, and control algorithms to work effectively with the robot.

Understanding URDF is crucial for robotics development as it provides the foundation for how the robot is represented in simulation and how planning algorithms understand the robot's structure. In humanoid robotics, with their complex multi-degree-of-freedom systems, URDF becomes even more important for managing the complexity of the robot's kinematic structure.

Core Concepts

URDF uses an XML-based format to describe robot models with a tree-like structure of links connected by joints. Each link represents a rigid body with properties such as mass, inertia, visual geometry, and collision geometry. Joints define the connection between links and specify the type of motion allowed between them.

Links represent rigid bodies in the robot structure. Each link can have multiple properties including:

  • Visual: Defines how the link looks in visualizations
  • Collision: Defines the collision geometry used in physics simulation
  • Inertial: Defines the mass, center of mass, and inertia tensor

Joints

Joints connect links and define the degrees of freedom between them. Common joint types include:

  • Fixed: No movement allowed between links
  • Revolute: Rotational movement around a single axis
  • Continuous: Rotational movement without limits
  • Prismatic: Linear sliding movement
  • Floating: Six degrees of freedom (rarely used in practical robots)

Robots with Multiple Chains

Humanoid robots have multiple kinematic chains (arms, legs) that share a common torso, making their URDF more complex than simpler robots. Managing these multiple chains requires careful attention to the tree structure.

Hands-on Examples

Let's create a URDF model for a humanoid robot:

<?xml version="1.0"?>
<robot name="simple_humanoid">
<!-- Base link -->
<link name="base_link">
<visual>
<geometry>
<box size="0.2 .1 .2"/>
</geometry>
<material name="blue">
<color rgba="0 0 .8 1"/>
</material>
</visual>
<collision>
<geometry>
<box size="0.2 .1 .2"/>
</geometry>
</collision>
<inertial>
<mass value="10"/>
<inertia ixx="0.1" ixy="0" ixz="0" iyy="0.1" iyz="0" izz="0.1"/>
</inertial>
</link>

<!-- Torso -->
<joint name="base_to_torso" type="fixed">
<parent link="base_link"/>
<child link="torso"/>
<origin xyz="0 0 0.15"/>
</joint>

<link name="torso">
<visual>
<geometry>
<box size="0.3 0.2 0.5"/>
</geometry>
<material name="grey">
<color rgba="0.5 0.5 0.5 1"/>
</material>
</visual>
<collision>
<geometry>
<box size="0.3 0.2 0.5"/>
</geometry>
</collision>
<inertial>
<mass value="15"/>
<inertia ixx="0.2" ixy="0" ixz="0" iyy="0.2" iyz="0" izz="0.2"/>
</inertial>
</link>

<!-- Head -->
<joint name="torso_to_head" type="revolute">
<parent link="torso"/>
<child link="head"/>
<origin xyz="0 0 0.35"/>
<axis xyz="0 1 0"/>
<limit lower="-1.57" upper="1.57" effort="100" velocity="1"/>
</joint>

<link name="head">
<visual>
<geometry>
<sphere radius="0.1"/>
</geometry>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
</visual>
<collision>
<geometry>
<sphere radius="0.1"/>
</geometry>
</collision>
<inertial>
<mass value="2"/>
<inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.01"/>
</inertial>
</link>

<!-- Left Leg -->
<joint name="torso_to_left_hip" type="revolute">
<parent link="torso"/>
<child link="left_hip"/>
<origin xyz="-0.08 0 -0.15"/>
<axis xyz="0 0 1"/>
<limit lower="-1.57" upper="1.57" effort="100" velocity="1"/>
</joint>

<link name="left_hip">
<visual>
<geometry>
<cylinder radius="0.05" length="0.15"/>
</geometry>
<material name="red">
<color rgba="0.8 0 0 1"/>
</material>
</visual>
<collision>
<geometry>
<cylinder radius="0.05" length="0.15"/>
</geometry>
</collision>
<inertial>
<mass value="3"/>
<inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.01"/>
</inertial>
</link>

<!-- Continue defining other joints and links for legs, arms, etc. -->

</robot>

Expected Output:

The URDF will be visualized in RViz2 showing the humanoid robot model with animated joints.
The robot_state_publisher will publish the robot's state to the /tf and /tf_static topics.
The joint_state_publisher will allow manual control of joint positions.

Exercises

Complete the following exercises to reinforce your understanding:

  1. Complete Robot Model: Extend the basic URDF to include all humanoid joints

    • Add both arms with shoulder, elbow, and wrist joints
    • Complete both legs with hip, knee, and ankle joints
    • Add appropriate visual and collision geometry for each link
    • Test the complete model in RViz2
  2. Kinematic Analysis: Implement forward kinematics for the humanoid model

    • Write a node that computes forward kinematics
    • Calculate end-effector positions for hands and feet
    • Visualize the end-effector positions in RViz2
    • Verify the kinematic chain is correctly defined

Common Pitfalls and Solutions

  • Pitfall 1: Incorrect mass properties - Setting unrealistic mass and inertia values
    • Solution: Use proper CAD software to calculate accurate mass properties or approximate based on geometric shapes
  • Pitfall 2: Undefined parent-child relationships - Creating disconnected kinematic chains
    • Solution: Ensure every link (except the base) has exactly one parent and is connected via a joint
  • Pitfall 3: Wrong joint limits - Setting limits that don't match physical robot capabilities
    • Solution: Research the actual hardware specifications or use conservative estimates for simulation
  • Pitfall 4: Collision mesh issues - Using high-polygon meshes that slow down simulation
    • Solution: Use simplified collision geometry with fewer polygons than visual geometry

Summary

  • URDF is the standard format for robot description in ROS
  • A URDF model defines links (rigid bodies) connected by joints
  • Humanoid robots require complex URDF structures with multiple kinematic chains
  • Proper URDF models are essential for simulation, visualization, and control
  • Integration with ROS 2 allows real-time visualization and control of the robot model

Further Reading