Noureddine RAMDI / Learning autonomous mobile robots with ROS 2: a hands-on course companion

Created Sat, 23 May 2026 20:41:14 +0000 Modified Sat, 23 May 2026 20:41:27 +0000

AntoBrandi/Self-Driving-and-ROS-2-Learn-by-Doing-Map-Localization

Building autonomous robots is a complex task that typically requires juggling multiple software layers, hardware integration, and real-time constraints. This repository serves as a practical companion to a Udemy course that teaches self-driving robotics using ROS 2 Humble/Iron. It stands out by providing both simulation and real robot code in C++ and Python, allowing learners to dive in with or without hardware. The focus is on foundational robotics problems like mapping, localization, SLAM, and sensor integration.

hands-on autonomous robot learning with ros 2 and gazebo

The project is designed around ROS 2, the Robot Operating System’s latest iteration focused on modularity, real-time safety, and improved middleware. It targets ROS 2 Humble and Iron distributions on Ubuntu 22.04, which are the current LTS and latest versions respectively. The repo supports both C++ and Python implementations of all exercises, catering to different developer preferences and skill sets.

A core component is the Gazebo simulation environment, where learners can test and visualize their robot’s localization and navigation algorithms without needing physical hardware. Gazebo integration is supported through ROS 2 packages like gazebo_ros and ros2_control, providing realistic physics and sensor simulation, including LiDAR.

Key robotics topics covered include:

  • Localization: Estimating the robot’s position within a known or unknown map.
  • Mapping and SLAM: Building maps from sensor data while simultaneously localizing.
  • Obstacle avoidance: Detecting and navigating around obstacles using sensor input.
  • Sensor integration: Processing LiDAR and other sensor data within ROS 2 pipelines.

The architecture relies on ROS 2 nodes, topics, services, and actions to implement these functionalities modularly. The dual-language approach means students can compare idiomatic ROS 2 usage in C++ and Python side by side.

educational focus and codebase design tradeoffs

What distinguishes this repo is its explicit role as a learning companion rather than a production-ready robotics stack. The code prioritizes clarity and step-by-step learning over optimization or industrial robustness. This means some real-time constraints or edge cases might be simplified or omitted to keep the educational flow smooth.

You’ll find thorough explanations in the accompanying Udemy course, making this codebase a reference implementation rather than standalone documentation. The repository cleanly separates exercises by topic and language, which helps learners focus on one concept at a time without being overwhelmed by a monolithic codebase.

The tradeoff here is that while the code is approachable, it might not be suitable for direct deployment on complex robots without further enhancement. For example, the obstacle avoidance algorithms may be basic compared to production navigation stacks like Nav2. However, this approach lowers the barrier to entry and helps demystify ROS 2’s architecture and robotics concepts.

getting started with simulation or real robot control

You can decide whether to build the real robot or just have fun with the simulated one. The course can be followed either way, most of the lessons and most of the code will work the same in the simulation as in the real robot

Prerequisites

You don’t need any prior knowledge of ROS 2 nor of Self-Driving, I’ll explain all the concepts as they came out and as they are needed to implement new functionalities to our robot. A basic knowledge of programming, either using C++ or Python is required as this is not a Programming course and so I’ll nmot dwell too much on basic Programming concepts.

To prepare your PC you need:

  • Install Ubuntu 22.04 on PC or in Virtual Machine Download the ISO Ubuntu 22.04 for your PC
  • Install ROS Humble or ROS Iron on your Ubuntu 22.04
  • Install ROS 2 missing libraries. Some libraries that are used in this project are not in the standard ROS 2 package. Install them with:
sudo apt-get update && sudo apt-get install -y \
     ros-humble-ros2-controllers \
     ros-humble-gazebo-ros \
     ros-humble-gazebo-ros-pkgs \
     ros-humble-ros2-control \
     ros-humble-gazebo-ros2-control \
     ros-humble-joint-state-publisher-gui \
     ros-humble-joy \
     ros-humble-joy-teleop \
     ros-humble-turtlesim \
     ros-humble-robot-localization \
     ros-humble-tf-transformations

This setup ensures your environment is ready for both simulation and real robot control. The course and repository are designed to guide you through the concepts incrementally, so you can start with simple simulations and gradually move to more complex behaviors.

verdict: a practical bridge into ros 2 robotics

This repository is highly relevant for robotics enthusiasts, hobbyists, and developers new to ROS 2 who want a structured, hands-on introduction to mobile robot autonomy. The dual language support and simulation integration make it accessible regardless of hardware availability.

Its educational nature means it’s not optimized for production or advanced robotics research, but that’s a clear and justified tradeoff. It excels as a teaching tool, bridging the gap between theoretical robotics concepts and practical ROS 2 application.

If you’re looking to get your hands dirty with autonomous mapping, localization, and navigation in ROS 2, this project paired with its Udemy course offers a solid starting point. Just be prepared for the typical ROS 2 setup overhead and the learning curve of robotics middleware.


→ GitHub Repo: AntoBrandi/Self-Driving-and-ROS-2-Learn-by-Doing-Map-Localization ⭐ 159 · C++