Skip to content

A ROS2 Humble package featuring a custom 4-wheeled vehicle URDF with differential drive control, physical inertial modeling, and Gazebo simulation.

Notifications You must be signed in to change notification settings

CodeName-Detective/URDF-Car-Simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

URDF Car Simulation

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.

Overview

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.

Key Features

  • 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_control for real-time motor simulation.
  • Differential Drive: Configured to accept geometry_msgs/Twist messages to control movement.

Technical Details

Physical Properties

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.00 and mu2 = 0.00 to allow for smooth turning in a RWD configuration.

Control System

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.

Links

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 - -

Joints

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)

Getting Started

Prerequisites

  • ROS2 Humble Hawksbill
  • Gazebo Classic
  • urdf_tutorial package

Installation

  1. Clone this repository into your colcon workspace:
cd ~/ros2_ws/src
git clone <your-repo-link>
  1. Build the package:
cd ~/ros2_ws
colcon build --packages-select car_urdf
source install/setup.bash

Running the Simulation

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

Demonstration

Resources

About

A ROS2 Humble package featuring a custom 4-wheeled vehicle URDF with differential drive control, physical inertial modeling, and Gazebo simulation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published