Skip to content

Workshop 2: Building Robotic Manipulators with URDF

Athanasios Polydoros edited this page Feb 11, 2026 · 4 revisions

Custom Robotic Arm URDF + RViz & Gazebo

This page describes how to create a custom robotic arm using URDF/Xacro, and visualize it in RViz. It assumes you are using ROS 2 and a modern Gazebo / Ignition distribution.

For step‑by‑step code examples, see:


1. Create a ROS 2 package structure

Follow the ROS tutorial on how to create a package

For this workshop you can create a package with the required dependencies typing:

ros2 pkg create --build-type ament_cmake my_robot_description --dependencies urdf xacro robot_state_publisher

Create a urdf folder within which you will create the urdf file of the robot

Organize your package so ROS tools can find models and launch files:

my_robot_description/
├── CMakeLists.txt
├── package.xml
├── urdf/
│   ├── my_arm.urdf.xacro

2: Understanding URDF

URDF represents a robot as a tree structure of Links connected by Joints.

Links

A Link is a rigid body. It contains:

  • <visual>: The appearance (mesh or primitive shape).
  • <collision>: The simplified shape for the physics engine.
  • <inertial>: Mass and inertia matrix (required for Gazebo simulation).

Joints

A Joint connects two links. Key attributes:

  • Type: revolute (limited rotation), continuous (infinite rotation), or fixed.
  • Axis: The axis of rotation (e.g., 0 0 1 for Z-axis).
  • Origin: The XYZ/RPY offset from the parent link.

3: Writing the Robot Description

Create a file named arm.urdf.xacro inside your urdf/ folder.

Design Challenge: Define a robot with the following kinematic chain:

  1. world (Optional virtual link).
  2. base_link: Fixed to the world.
  3. shoulder_link: Rotates around the Z-axis (pan).

Snippet (Base Link):

<link name="base_link">
  <visual>
    <geometry>
      <cylinder length="0.1" radius="0.2"/>
    </geometry>
    <material name="Gray">
      <color rgba="0.5 0.5 0.5 1.0"/>
    </material>
  </visual>
</link>

See:

4: Visualise using Rviz

For a quick inspection of the urdf you can run:

ros2 launch urdf_tutorial display.launch.py model:=path/to/your/arm.urdf