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

B. Create a MoveIt Configuration package for a custom robot

B1. Robot URDF

If you have developed your own robot, use its URDF otherwise copy the following example of simple pendulum at the urdf folder of the previously generated my_robot_description package. Don't forget to build and source.

<?xml version="1.0"?>
<robot name="simple_pendulum">

  <link name="world"/>

  <link name="base_link">
    <visual>
      <geometry>
        <box size="0.1 0.1 0.1"/>
      </geometry>
      <material name="blue">
        <color rgba="0 0 1 1"/>
      </material>
    </visual>
    <collision>
      <geometry>
        <box size="0.1 0.1 0.1"/>
      </geometry>
    </collision>
    <inertial>
      <mass value="1.0"/>
      <inertia ixx="0.001" ixy="0" ixz="0" iyy="0.001" iyz="0" izz="0.001"/>
    </inertial>
  </link>

  <joint name="world_to_base" type="fixed">
    <parent link="world"/>
    <child link="base_link"/>
    <origin xyz="0 0 1.0" rpy="0 0 0"/>
  </joint>

  <link name="arm">
    <visual>
      <origin xyz="0 0 -0.25" rpy="0 0 0"/>
      <geometry>
        <cylinder length="0.5" radius="0.02"/>
      </geometry>
      <material name="white">
        <color rgba="1 1 1 1"/>
      </material>
    </visual>
    <collision>
      <origin xyz="0 0 -0.25" rpy="0 0 0"/>
      <geometry>
        <cylinder length="0.5" radius="0.02"/>
      </geometry>
    </collision>
    <inertial>
      <origin xyz="0 0 -0.25" rpy="0 0 0"/>
      <mass value="0.5"/>
      <inertia ixx="0.01" ixy="0" ixz="0" iyy="0.01" iyz="0" izz="0.001"/>
    </inertial>
  </link>

  <joint name="pivot_joint" type="revolute">
    <parent link="base_link"/>
    <child link="arm"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <axis xyz="0 1 0"/> <limit lower="-1.57" upper="1.57" effort="10.0" velocity="1.0"/>
  </joint>

  <link name="tool_tip"/>

  <joint name="tool_joint" type="fixed">
    <parent link="arm"/>
    <child link="tool_tip"/>
    <origin xyz="0 0 -0.5" rpy="0 0 0"/>
  </joint>

</robot>

B2. MoveIt Setup Assistant

Follow the tutorial here. This will create a MoveIt package (mybot_moveit_config) for you own custom robot that contains Planning Algorithms and Inverse Kinematics Solvers

Once done (build and source) run:

ros2 launch panda_moveit_config demo.launch.py

Clone this wiki locally