Skip to content

w7v-1212/ROS2-Nav2-with-SLAM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ROS2-Nav2-with-SLAM

1. Introduction

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

2. Getting Started

2.1 Clone Repository

git clone https://github.com/w7v-1212/ROS2-Nav2-with-SLAM.git

Important: This repository already contains the ros2_ws workspace structure. Please ensure that you do not clone it inside another ROS2 workspace's src directory, as this will lead to incorrect package discovery and build conflicts (e.g., ~/ros_ws/src/ros2_ws/...).

2.2 Install ROS2 Dependencies

sudo apt install ros-jazzy-navigation2 ros-jazzy-nav2-bringup ros-jazzy-slam-toolbox ros-jazzy-gz-ros2-control ros-jazzy-ros-gz

2.3 Build Environments

After cloning the repository into the directory of your workspace, build the packages using:

cd ros2_ws
colcon build --symlink-install

Once the build process is complete, source the workspace to ensure the environment is properly configured:

source ~/.bashrc

3. Features

3.1 Rviz2 Visualization

# Launch Rviz2
ros2 launch my_robot_description display.launch.xml

3.2 Rviz2 & Gazebo

# Launch Rviz2 & Gazebo
ros2 launch my_robot_description gazebo.launch.xml
ros2 run teleop_twist_keyboard teleop_twist_keyboard

3.3 SLAM

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

3.4 Navigation

# Launch Rviz2 & Gazebo with Nav2
ros2 launch my_robot_description nav2.launch.xml

3.5 ROS2_Control

# 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

TODO

  • ROS2 Control (Updated on 23/3/2026)
  • Nav2 Python APIs

About

Simultaneous Localization and Mapping using Cartographer, SLAM Toolbox, and AMCL with ROS2 Jazzy Nav2

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages