-
Notifications
You must be signed in to change notification settings - Fork 0
Workshop 3: Creating Moveit Configuraion
This guide outlines the standard procedure for creating a dedicated package to house URDF (Unified Robot Description Format) models in ROS 2.
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_descriptionA 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. |
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}
)
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.bashThe 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