Week 3: URDF and Robot Modeling
This week focuses on Unified Robot Description Format (URDF) for describing humanoid robots. You'll learn to create robot models with links, joints, and proper kinematic chains for humanoid robots.
Learning Objectives
By the end of this week, you will be able to:
- Understand URDF structure and XML syntax
- Create links and joints for humanoid robot models
- Define visual and collision properties
- Implement joint limits and dynamics
- Create a complete humanoid robot URDF model
3.1 Understanding URDF Structure and XML Syntax
URDF (Unified Robot Description Format) is an XML format for representing a robot model in ROS. It describes the robot's physical and visual properties, including links, joints, and their relationships.
Basic URDF Structure
<?xml version="1.0"?>
<robot name="my_robot">
<!-- Links define rigid bodies -->
<link name="base_link">
<visual>
<geometry>
<box size="1.0 0.5 0.2"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="1.0 0.5 0.2"/>
</geometry>
</collision>
<inertial>
<mass value="1.0"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
<!-- Joints define relationships between links -->
<joint name="base_to_wheel" type="continuous">
<parent link="base_link"/>
<child link="wheel_link"/>
<origin xyz="0.5 0 0" rpy="0 0 0"/>
</joint>
<link name="wheel_link">
<visual>
<geometry>
<cylinder radius="0.1" length="0.05"/>
</geometry>
</visual>
</link>
</robot>
Key URDF Elements
<robot>: Root element containing the entire robot description<link>: Represents a rigid body with visual, collision, and inertial properties<joint>: Defines the connection between two links with a specific type<visual>: Defines how the link appears in visualizations<collision>: Defines the collision geometry for physics simulation<inertial>: Defines the mass and inertial properties for dynamics
3.2 Creating Links and Joints for Humanoid Robots
Link Definition
A link represents a rigid body in the robot. For humanoid robots, links typically represent body parts like torso, head, arms, and legs.
<link name="torso">
<visual>
<origin xyz="0 0 0.5" rpy="0 0 0"/>
<geometry>
<box size="0.3 0.2 1.0"/>
</geometry>
<material name="light_grey">
<color rgba="0.7 0.7 0.7 1.0"/>
</material>
</visual>
<collision>
<origin xyz="0 0 0.5" rpy="0 0 0"/>
<geometry>
<box size="0.3 0.2 1.0"/>
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0.5" rpy="0 0 0"/>
<mass value="5.0"/>
<inertia ixx="0.2" ixy="0.0" ixz="0.0" iyy="0.3" iyz="0.0" izz="0.1"/>
</inertial>
</link>
Joint Types for Humanoid Robots
Different joint types are used to simulate different types of movement in humanoid robots:
revolute: Rotational joint with limited range of motion (e.g., elbow, knee)continuous: Rotational joint with unlimited range of motion (e.g., wheel)prismatic: Linear sliding joint (e.g., telescoping arm)fixed: No movement between links (e.g., sensor mounting)floating: 6-DOF joint (rarely used)planar: Movement in a plane (rarely used)
<!-- Example of different joint types -->
<joint name="left_elbow_joint" type="revolute">
<parent link="left_upper_arm"/>
<child link="left_lower_arm"/>
<origin xyz="0 0 -0.3" rpy="0 0 0"/>
<axis xyz="0 1 0"/>
<limit lower="-2.356" upper="0" effort="100" velocity="1.0"/>
<dynamics damping="0.1" friction="0.0"/>
</joint>
<joint name="torso_head_joint" type="revolute">
<parent link="torso"/>
<child link="head"/>
<origin xyz="0 0 1.0" rpy="0 0 0"/>
<axis xyz="0 1 0"/>
<limit lower="-0.5" upper="0.5" effort="10" velocity="2.0"/>
</joint>
3.3 Visual and Collision Properties
Visual Properties
Visual properties define how the robot appears in simulation and visualization tools. They include geometry, material, and origin.
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<!-- Different geometry types -->
<box size="1.0 0.5 0.2"/> <!-- Box -->
<cylinder radius="0.1" length="0.5"/> <!-- Cylinder -->
<sphere radius="0.2"/> <!-- Sphere -->
<mesh filename="package://my_robot/meshes/link.stl"/> <!-- Mesh -->
</geometry>
<material name="red">
<color rgba="1.0 0.0 0.0 1.0"/>
</material>
</visual>
Collision Properties
Collision properties define the shape used for collision detection and physics simulation. They can be simpler than visual geometry for performance.
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<!-- Often simplified for performance -->
<box size="0.9 0.4 0.15"/> <!-- Slightly smaller than visual -->
</geometry>
</collision>
Inertial Properties
Inertial properties are crucial for physics simulation, defining how the robot responds to forces.
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="1.0"/>
<inertia ixx="0.1" ixy="0.0" ixz="0.0" iyy="0.1" iyz="0.0" izz="0.1"/>
</inertial>