Skip to content
SDB
Modelling in ROS, AI and Machine Learning

2 hours

CAD Design and Simulation in ROS

URDF, Gazebo, and Robot Modelling Workflows

Subhendu Datta BhowmikRobotics Tutorials

URDF — Building a Robot Description from Scratch

URDF (Unified Robot Description Format) is the XML language used throughout ROS to describe a robot's complete physical structure. A URDF file is a tree of links connected by joints, analogous to a skeleton.

The <link> element describes a rigid body with three sub-elements:

  • <visual>: the rendered appearance — either a primitive (box, cylinder, sphere with size parameters) or a mesh file (.stl, .dae, .obj) for complex geometry; assigns material colour
  • <collision>: a simplified shape (usually a primitive or convex hull) used by collision checkers; should be simpler than the visual mesh for computational efficiency
  • <inertial>: physical properties — <mass>, <origin> (centre of mass offset), and <inertia> (3×3 inertia tensor as ixx, ixy, ixz, iyy, iyz, izz). Inertia parameters are critical for dynamic simulation — incorrect values cause unrealistic behaviour or simulation instability.

The <joint> element connects a parent link to a child link with a specified type: fixed (no motion, for cameras, sensors), revolute (rotation about one axis with upper/lower limits, for robot arm joints), prismatic (linear motion with limits, for linear actuators), continuous (unbounded rotation, for wheels), floating (6-DOF, for free-flying objects), planar (2D motion).

CAD-to-URDF workflow: Export robot geometry from SolidWorks (SW2URDF plugin), Fusion 360 (fusion2urdf plugin), or FreeCAD (ROS Workbench). The plugin generates link meshes and a preliminary URDF; manual editing is usually required to add inertial parameters (often computed by the CAD tool from material density) and fix joint origins.

Gazebo Simulation

Gazebo is the primary physics-based robot simulator used with ROS. It provides:

Physics engines: ODE (Open Dynamics Engine, default), Bullet, DART, Simbody — each with different accuracy-speed trade-offs for rigid body dynamics, contact physics, and deformable bodies.

Sensor simulation: Plugins simulate laser scanners (ray casting), RGB and depth cameras (GPU rendering), IMUs (noise models), GPS, force-torque sensors, and contact sensors. Simulated sensors publish on ROS topics identical in type to their real hardware counterparts — enabling direct algorithm portability.

Plugin architecture: Gazebo behaviour is extended through model plugins (attached to a robot, control joints), world plugins (global physics modifications), and sensor plugins. The diff_drive plugin provides differential drive kinematics and publishes /odom; the ros2_control Gazebo plugin exposes hardware interfaces to ros2_control.

Connecting Gazebo to ROS 2: The ros_gz_bridge (Gazebo Harmonic) or gazebo_ros_pkgs (Gazebo Classic) package bridges Gazebo's internal Ignition Transport topics to ROS 2 topics:

ros2 run ros_gz_bridge parameter_bridge   /scan@sensor_msgs/msg/LaserScan[gz.msgs.LaserScan   /cmd_vel@geometry_msgs/msg/Twist]gz.msgs.Twist

Spawning a robot in Gazebo:

ros2 run ros_gz_sim create -topic /robot_description -name my_robot

Gazebo Sensor Plugins

SensorPlugin / PackageROS 2 TopicMessage Type
RGB Cameralibgazebo_ros_camera.so/camera/image_rawsensor_msgs/Image
Depth Cameralibgazebo_ros_depth_camera.so/depth_camera/depth/image_rawsensor_msgs/Image
2D LIDARlibgazebo_ros_ray_sensor.so/scansensor_msgs/LaserScan
3D LIDAR (Velodyne)libgazebo_ros_velodyne_laser.so/velodyne_pointssensor_msgs/PointCloud2
IMUlibgazebo_ros_imu_sensor.so/imu/datasensor_msgs/Imu
GPS / NavSatlibgazebo_ros_gps_sensor.so/gps/fixsensor_msgs/NavSatFix
Contact Sensorlibgazebo_ros_bumper.so/contact_statesgazebo_msgs/ContactsState

MoveIt 2 — Motion Planning for Manipulation

MoveIt 2 is the ROS 2 framework for robot manipulation: motion planning, kinematics, collision checking, trajectory execution, and perception integration.

Core components:

  • URDF + SRDF (Semantic Robot Description Format): SRDF augments the URDF with manipulation-specific information: named joints groups ("arm", "gripper"), end-effector definitions, virtual joints, and self-collision disable pairs (adjacent links that should not be collision-checked against each other).
  • move_group node: The central MoveIt 2 server. Receives planning requests from client code, runs the planning pipeline, and returns executable trajectories.
  • Planning pipelines: OMPL (Open Motion Planning Library) — sampling-based planners (RRT, RRT*, PRM, BiRRT); Pilz Industrial Motion Planner — Cartesian motion generators (LIN, CIRC, PTP); CHOMP — trajectory optimisation.
  • Collision checking: FCL (Flexible Collision Library) checks planned trajectories against the collision objects in the planning scene (robot self-collision + environment objects added via MoveIt Python/C++ API).
  • MoveIt Setup Assistant: GUI wizard that generates the SRDF, default planner configuration, kinematics configuration (KDL or analytical), and launch files from a URDF input.

Programming MoveIt 2 in Python:

from moveit.planning import MoveItPy
moveit = MoveItPy(node_name='moveit_py')
arm = moveit.get_planning_component('arm')
arm.set_goal_state(configuration_name='home')
plan_result = arm.plan()
if plan_result: moveit.execute(plan_result.trajectory)

Gazebo Classic vs Gazebo Harmonic (Ignition)

Gazebo Classic (gazebo11)

  • Architecture: monolithic server process with gzclient GUI; single-threaded physics
  • Performance: limited scalability; struggles beyond ~50 simulated robots
  • Sensor support: mature plugin ecosystem; most sensors well-supported
  • ROS integration: gazebo_ros_pkgs; tight ROS 1 heritage
  • Development: maintenance-only since 2022; end-of-life January 2025
  • Plugin API: C++ inheritance from gazebo::ModelPlugin, SensorPlugin
  • Best for: legacy projects, tutorials, courses with existing Gazebo Classic content

Gazebo Harmonic (Ignition / Modern Gazebo)

  • Architecture: distributed processes (gz-sim server + gz-gui client); ECS entity-component design
  • Performance: better multi-robot scalability; GPU-parallel rendering
  • Sensor support: growing; some advanced sensors require migration effort from Classic
  • ROS integration: ros_gz_bridge with typed topic bridging; first-class ROS 2 support
  • Development: actively developed; LTS release paired with ROS 2 Jazzy
  • Plugin API: ECS-based Systems; cleaner separation of physics, rendering, and logic
  • Best for: new ROS 2 projects, multi-robot simulation, long-term maintainability

Modelling in ROS, AI and Machine Learning