Skip to content

Workshop 3: Creating Moveit Configuraion

Athanasios Polydoros edited this page Feb 18, 2026 · 6 revisions

A. Creating a ROS 2 URDF Description Package

This guide outlines the standard procedure for creating a dedicated package to house URDF (Unified Robot Description Format) models in ROS 2.


A1. Create the Package

Navigate to the src folder of your ROS 2 workspace and use the ros2 pkg create command. We use the ament_cmake build type to ensure assets are correctly installed to the share directory.

cd ~/dev_ws/src
ros2 pkg create --build-type ament_cmake my_robot_description

A2. Setup the Directory Structure

A clean structure is vital for ROS 2 to locate meshes, URDFs, and launch configurations. Create the following subdirectories within your new package:

cd my_robot_description
mkdir urdf meshes launch config
Directory Description
urdf/ Stores .urdf or .xacro files defining the robot's kinematics.
launch/ Python or XML scripts to launch the robot state publisher.
config/ RViz configuration files ( .rviz ) for saved visualization states.

A3. Configure CMakeLists.txt

In ROS 2, files in your source directory are not automatically available after building. You must explicitly install them so they are moved to the install/ folder where ROS 2 looks for resources.

Open CMakeLists.txt and add the following installation rules before the ament_package() line:

install(
  DIRECTORY urdf meshes launch config
  DESTINATION share/${PROJECT_NAME}
)

A4. Build and Source

After saving your URDF file (e.g., my_robot.urdf) inside the urdf/ folder, return to your workspace root to compile.

# Go to workspace root
cd src

# Build only this package to save time
colcon build --packages-select my_robot_description

# Source the workspace
source install/setup.bash

A5. Check URDF

The check_urdf command-line tool in ROS 2 validates the syntax and structure of a URDF file, ensuring it parses correctly as a robot model. It checks for proper link/joint connections and XML formatting. Use it by running check_urdf <filename>.urdf in the terminal to identify errors before loading the mode

Clone this wiki locally