A comprehensive ROS2 (Humble) project featuring a custom-built 4-wheeled vehicle modeled using URDF (Unified Robotics Description Format). This project demonstrates robot modeling, inertial physics calculation, and integration with Gazebo and ros2_control for differential drive simulation.
This repository contains the configuration and launch files for a simulated car. The vehicle is designed as a Rear-Wheel Drive (RWD) system where the front wheels are modeled with zero friction to act as casters, while the rear wheels provide the driving force via a differential drive controller.
- Custom URDF Model: A multi-link robot description including a base chassis, four wheels, and a custom STL-mesh driver's seat.
- Physics Integration: Accurately calculated moments of inertia for all primitive shapes (boxes and cylinders).
- Hardware Interface: Integrated with
gazebo_ros2_controlfor real-time motor simulation. - Differential Drive: Configured to accept
geometry_msgs/Twistmessages to control movement.
The model uses precise inertial tensors to ensure stable simulation within the ODE physics engine:
- Chassis: 1.0m x 0.6m x 0.2m box (Mass: 6.0kg).
- Wheels: 0.2m radius x 0.2m width cylinders (Mass: 1.0kg each).
- Friction: Front wheels are configured with
mu1 = 0.00andmu2 = 0.00to allow for smooth turning in a RWD configuration.
The simulation utilizes the diff_drive_controller from the ROS2 Control ecosystem.
- Joints: Four continuous joints for the wheels and one fixed joint for the driver's seat.
- Command Interface: Velocity commands.
- State Interface: Position and velocity feedback.
| Link Name | Type | Size | Mass |
|---|---|---|---|
| base_link | Box | [l,w,h] : [1,0.6,0.2] | 6 |
| front_left | Cylinder | [r,h] : [0.2,0.2] | 1 |
| front_right | Cylinder | [r,h] : [0.2,0.2] | 1 |
| back_left | Cylinder | [r,h] : [0.2,0.2] | 1 |
| back_right | Cylinder | [r,h] : [0.2,0.2] | 1 |
| driver | Mesh | - | - |
| Joint Name | Type | XYZ Offset (from base_link) |
|---|---|---|
| base_to_front_left | Continuous | (0.5 0.45 0) |
| base_to_front_right | Continuous | (0.5 -0.45 0) |
| base_to_back_left | Continuous | (-0.5 0.45 0) |
| base_to_back_right | Continuous | (-0.5 -0.45 0) |
| base_to_driver | Fixed | (0 0 0.1) |
- ROS2 Humble Hawksbill
- Gazebo Classic
urdf_tutorialpackage
- Clone this repository into your
colconworkspace:
cd ~/ros2_ws/src
git clone <your-repo-link>
- Build the package:
cd ~/ros2_ws
colcon build --packages-select car_urdf
source install/setup.bash
To visualize the model in Rviz:
ros2 launch car_urdf display.launch.py
To launch the full Gazebo simulation with controllers:
ros2 launch car_urdf diffdrive.launch.py
- ROS2 URDF From Scratch
- Adding Physical Properties to URDF
- ros2_control tag configuration in URDF
- Using URDF in Gazebo
- Friction Parameters in Gazebo: Note that mu1 & mu2 are the friction parameters, unlike mu as given in the document.
- ROS2 Controller Manager
- ROS2 Control Demos Example Launch

