This repository provides a comprehensive implementation of an autonomous navigation system designed for differential drive mobile robots, built on the latest ROS2 Jazzy, Gazebo Harmonic and Nav2 framework. Besides, this repository demonstrates two distinct methodologies for controlling a differential drive mobile robot, including: Gazebo Plugins & ROS2_Control
git clone https://github.com/w7v-1212/ROS2-Nav2-with-SLAM.gitImportant: This repository already contains the
ros2_wsworkspace structure. Please ensure that you do not clone it inside another ROS2 workspace'ssrcdirectory, as this will lead to incorrect package discovery and build conflicts (e.g., ~/ros_ws/src/ros2_ws/...).
sudo apt install ros-jazzy-navigation2 ros-jazzy-nav2-bringup ros-jazzy-slam-toolbox ros-jazzy-gz-ros2-control ros-jazzy-ros-gzAfter cloning the repository into the directory of your workspace, build the packages using:
cd ros2_ws
colcon build --symlink-installOnce the build process is complete, source the workspace to ensure the environment is properly configured:
source ~/.bashrc# Launch Rviz2
ros2 launch my_robot_description display.launch.xml# Launch Rviz2 & Gazebo
ros2 launch my_robot_description gazebo.launch.xml
ros2 run teleop_twist_keyboard teleop_twist_keyboard# Launch Rviz2 & Gazebo with SLAM
ros2 launch my_robot_description gazebo.launch.xml
ros2 launch nav2_bringup navigation_launch.py use_sim_time:=True
ros2 launch slam_toolbox online_async_launch.py use_sim_time:=True
ros2 run teleop_twist_keyboard teleop_twist_keyboard# Save Map
ros2 run nav2_map_server map_saver_cli -f <file_path># Launch Rviz2 & Gazebo with Nav2
ros2 launch my_robot_description nav2.launch.xml# Launch Rviz2 & Gazebo with ROS2_Control
ros2 launch my_robot_bringup my_robot_ros2_control.launch.xml
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r /cmd_vel:=/diff_drive_controller/cmd_vel -p stamped:=true- ROS2 Control (Updated on 23/3/2026)
- Nav2 Python APIs





