Simulation for differential drive robots using ROS2 Jazzy and Gazebo Harmonic. This package provides all of the necessary files to get a simulated robot up and running. This includes the urdf, parameters and launch files for a robot with a lidar sensor and tele-operated navigation. More sensors and functionalities will be added in future.
This repository has two main branches:
main: Base repository with core robot simulation functionality including URDF, Gazebo simulation, and basic tele-operationmapping: Extended branch that adds mapping capabilities using SLAM Toolbox and robot localization with Extended Kalman Filter (EKF)
The package is still being worked on and in development
Supported for Ubuntu 24.04 & ROS2 Jazzy but compatibility with other versions has not been checked.
Make sure to install the following ROS 2 Jazzy Packages:
sudo apt install -y \
ros-jazzy-ros-gz \
ros-jazzy-ros-gz-bridge \
ros-jazzy-joint-state-publisher \
ros-jazzy-xacro \
ros-jazzy-teleop-twist-keyboard \
ros-jazzy-teleop-twist-joy If you're using the mapping branch, also install:
sudo apt install -y \
ros-jazzy-slam-toolbox \
ros-jazzy-robot-localizationTo use this package please download all of the necessary dependencies first and then follow these steps:
For the base robot simulation, clone the main branch:
mkdir -p ros2_ws/src
cd ros2_ws/src
git clone https://github.com/adoodevv/diff_drive_robot.git
cd ..
colcon build --packages-select diff_drive_robot --symlink-installTo use the mapping features, clone the mapping branch directly:
mkdir -p ros2_ws/src
cd ros2_ws/src
git clone -b mapping https://github.com/adoodevv/diff_drive_robot.git
cd ..
colcon build --packages-select diff_drive_robot --symlink-installAfter sourcing ROS and this package, launch the 2-wheeled differential drive robot simulation:
source install/setup.bash
ros2 launch diff_drive_robot robot.launch.py Currently, only keyboard control works. Run this in another terminal:
ros2 run teleop_twist_keyboard teleop_twist_keyboard The mapping branch extends the base functionality with:
- SLAM Toolbox: For mapping the environment
- Extended Kalman Filter (EKF): For sensor fusion and improved odometry estimation
- Enhanced RViz configuration: Pre-configured for mapping visualization
The mapping branch includes additional configuration files:
config/slam_toolbox_mapping.yaml: Configuration for SLAM Toolbox mapping modeconfig/ekf.yaml: Extended Kalman Filter parameters for sensor fusion (odometry and IMU)
The mapping system requires launching two separate terminals:
Terminal 1 - Robot Simulation:
source install/setup.bash
ros2 launch diff_drive_robot robot.launch.pyThis launches:
- Gazebo simulation
- Robot State Publisher
- Gazebo-ROS bridge
- Extended Kalman Filter node
- Robot spawner
Terminal 2 - Mapping:
source install/setup.bash
ros2 launch diff_drive_robot mapping.launch.pyThis launches:
- SLAM Toolbox (online async mapping mode)
- RViz with mapping configuration
In a third terminal, run the keyboard teleop:
ros2 run teleop_twist_keyboard teleop_twist_keyboardOnce you've mapped your environment, you can save it using the SLAM Toolbox plugin in RViz or via command line:
ros2 run nav2_map_server map_saver_cli -f ~/my_mapPackage is still being worked on, though the core functionality is pretty much done, I will be adding some more sensors and functionalities soon.

