PTENES
TRACK 4 · INTERMEDIATE / ADVANCED

🗺️ ROS 2 and navigation

The leap from a robot that reacts to one that knows where it is. You’ll learn ROS 2, describe and simulate your robot in Gazebo, connect the ESP32 to ROS with micro-ROS, make maps with a LiDAR, and finish with a robot that maps the room and navigates on its own to a point. You can do everything in simulation first, on your PC.

6
Modules
36
Topics
Intermediate
Level
ROS 2
Lyrical or Jazzy
0%
0 of 0 topics read in this track
PC simulation real robot 4.1ROS 2 4.2Gazebo 4.4SLAM 4.5Nav2 4.3micro-ROS 4.4real LiDAR 4.6project the same ROS 2 code works in both tracks

How to read this map: The upper track (amber) runs entirely on your computer, without any hardware. The lower track (cyan) follows the same steps on a real robot: the ESP32 joins ROS through micro-ROS, and the real LiDAR replaces the simulated one. Both arrows lead to project 4.6. You can follow only the upper track and return to the lower one when you have the hardware.

🧭 What you’ll build in this track

A differential-drive robot (two wheels and a caster) that exists in two places: as a model in Gazebo and as the robot from the previous tracks, now with a LiDAR. It publishes odometry and laser scans to ROS 2, builds an environment map with slam_toolbox, and uses Nav2 to travel on its own to the point you click on the map, avoiding anything in its path.

  • ✓Commands that work in Lyrical and Jazzy
  • ✓Robot described in URDF/xacro and simulated in Gazebo
  • ✓ESP32 communicating with ROS 2 through micro-ROS
  • ✓Saved map and point-to-point navigation with Nav2

💡 Don’t have a LiDAR yet?

Modules 4.1, 4.2, 4.4, and 4.5 run entirely in simulation: a PC with Ubuntu, a virtual machine, or a Docker container is enough. Hardware is required only for 4.3 and the real-robot part of 4.6.

Track map

Detailed content

4.1
Foundation
0%

🧩 ROS 2 without fear

What ROS 2 is, which distro to choose, how to install it, and the parts of the graph: nodes, topics, services, actions, and parameters. You’ll finish with your first Python node.

What it is:

A set of libraries and tools that lets different robot programs exchange data by name, on the same machine or over a network.

Why learn this:

It’s the research and industry standard; mapping, navigation, and sensor drivers are ready to use.

Key concepts:

Middleware · DDS · ROS graph · package.

What it is:

Lyrical Luth (May 2026 LTS, Ubuntu 26.04) and Jazzy Jalisco (the previous LTS, Ubuntu 24.04), each with its own Gazebo.

Why learn this:

The wrong distro is the number one reason a tutorial doesn’t work.

Key concepts:

LTS · Ubuntu ↔ ROS ↔ Gazebo pairing · end of support.

What it is:

Three options: packages on Ubuntu, a ready-to-use Docker container, or Raspberry Pi 5 with Ubuntu.

Why learn this:

Docker gets you up and running in minutes on any system.

Key concepts:

ros-<distro>-desktop · source · talker/listener.

What it is:

A node is a program; a topic is a named channel; a message is the format of the data that passes through it.

Why learn this:

Every ROS robot is a graph of these; reading it from the terminal is your first debugging tool.

Key concepts:

Publisher · subscriber · /cmd_vel · ros2 topic echo.

What it is:

Question and answer (service), a long-running task with progress (action), and node settings (parameter).

Why learn this:

Choosing the right pattern avoids workarounds; Nav2 works entirely through actions.

Key concepts:

Request/response · goal/feedback/result · ros2 param.

What it is:

A Python package with two complete nodes, one that publishes and one that listens, built with colcon.

Why learn this:

It’s the template for every node you’ll write in the rest of the track.

Key concepts:

rclpy · create_publisher · create_subscription · timer.

View Full
4.2
Practice
0%

🧱 Describe and simulate the robot

Workspace and colcon, the robot in URDF/xacro, TF frames, RViz2, Gazebo with ros_gz, and the first drive with the keyboard.

What it is:

The working folder, how packages are organized, and how colcon builds and installs everything.

Why learn this:

Half of beginner errors come from a workspace that hasn’t been sourced or a missing dependency.

Key concepts:

Underlay · overlay · rosdep · --symlink-install.

What it is:

An XML file with the robot’s parts (links) and joints; xacro adds variables and macros.

Why learn this:

RViz, Gazebo, TF, and Nav2 all read the same description.

Key concepts:

Link · joint · inertia · macro.

What it is:

The tree that shows where each part is relative to the others, at every moment.

Why learn this:

Without correct TF, the laser appears in the wrong place and the map gets distorted.

Key concepts:

map · odom · base_link · tf2_echo.

What it is:

The window that shows what the robot believes: model, frames, laser, map.

Why learn this:

This is where you check the model before simulating and the sensor before mapping.

Key concepts:

Fixed Frame · RobotModel · LaserScan · robot_state_publisher.

What it is:

The simulator with physics and sensors, connected to ROS 2 through the ros_gz bridge.

Why learn this:

You can test mapping and navigation without a battery, a crash, or buying LiDAR.

Key concepts:

Harmonic ↔ Jazzy · Jetty ↔ Lyrical · parameter_bridge · launch.

What it is:

Send velocity commands from the keyboard on /cmd_vel and watch the odometry and laser respond.

Why learn this:

This closes the loop: a command comes in, the robot moves, and the sensors change. It’s the smoke test for the whole learning path.

Key concepts:

teleop_twist_keyboard · Twist · /odom · /scan.

View Full
4.3
Practice
0%

🔌 micro-ROS on the ESP32

The ESP32 becomes a ROS 2 node: it publishes encoder data, listens to /cmd_vel, turns the motors, and provides odometry to the rest of the robot.

What it is:

The version of ROS 2 for microcontrollers, which communicates with the rest of the graph through an agent.

Why learn this:

The motors and encoders run on the ESP32 in real time and appear in ROS like any other node.

Key concepts:

Client · agent · XRCE-DDS · rclc.

What it is:

The program on the PC or Pi that translates micro-ROS to DDS; it runs in Docker with a single command.

Why learn this:

Without an agent, the ESP32 is talking to itself; it’s the first thing to check.

Key concepts:

Serial · UDP · port 8888 · /dev/ttyUSB0.

What it is:

The firmware that counts the wheel pulses and publishes them on /ticks every 50 ms.

Why learn this:

Sensor data in ROS is the foundation for odometry and mapping.

Key concepts:

micro_ros_arduino · publisher · timer · executor.

What it is:

Convert linear and angular velocity into the speed of each wheel, and stop if the command disappears.

Why learn this:

It’s the same /cmd_vel used by teleop and Nav2: the real robot starts following ROS commands.

Key concepts:

Differential drive kinematics · subscriber · watchdog · TB6612FNG.

What it is:

A Python node on the PC that converts /ticks into /odom and the odom → base_link frame.

Why learn this:

This is what SLAM and Nav2 expect to receive from the real robot.

Key concepts:

nav_msgs/Odometry · TransformBroadcaster · ticks per revolution.

What it is:

The issues that come up most often: agent not connected, port in use, wrong distro, clock out of sync.

Why learn this:

A troubleshooting guide saves you nights of trial and error.

Key concepts:

Transport · agent ping · time sync · reconnection.

View Full
4.4
Foundation
0%

📡 LiDAR and maps (SLAM)

How LiDAR sees, how to connect it to ROS 2, and how slam_toolbox builds the map while figuring out where the robot is.

What it is:

A spinning laser that measures distance at hundreds of angles per revolution, published as LaserScan.

Why learn this:

Understanding range and resolution explains why a map turns out well or poorly.

Key concepts:

ranges · angle_increment · range · /scan.

What it is:

The manufacturer’s driver (RPLIDAR C1/A1 or LD19), a USB port, and the laser frame in TF.

Why learn this:

This step brings the real robot to the same point as the simulated one.

Key concepts:

Driver · udev rule · frame_id · ros2 topic hz.

What it is:

Build the map and locate yourself in it at the same time, correcting odometry based on what the laser sees.

Why learn this:

Without a map, there’s no real autonomous navigation.

Key concepts:

Scan matching · loop closure · occupancy grid.

What it is:

The standard SLAM package in ROS 2 running on the Gazebo robot.

Why learn this:

You learn to map without hardware and already know what to expect from the real robot.

Key concepts:

Asynchronous online mode · parameters · /map.

What it is:

A real-world mapping guide: low speed, tight turns, surfaces that confuse the laser.

Why learn this:

A well-made map determines whether navigation will work.

Key concepts:

Glass and mirrors · speed · revisiting places.

What it is:

Save the map to a file (image + YAML) and reopen it later for navigation.

Why learn this:

Map once, navigate many times.

Key concepts:

map_saver · .pgm and .yaml · resolution · origin.

View Full
4.5
Practice
0%

🚩 Navigation with Nav2

The ROS 2 navigation stack: locate yourself on the saved map, plan, avoid obstacles, recover, and run waypoint patrols.

What it is:

The servers that locate, plan, control, and recover, coordinated by a behavior tree.

Why learn this:

It’s the same type of software used by warehouse robots.

Key concepts:

nav2_bringup · behavior tree · lifecycle.

What it is:

A particle filter that estimates where the robot is by comparing the laser data with the map.

Why learn this:

Without knowing where it is, the robot doesn't know where to go.

Key concepts:

Particles · initial pose · map → odom.

What it is:

Maps that mark where it’s costly to travel, and algorithms that plot and follow the path.

Why learn this:

Adjusting inflation and the robot radius solves most “won’t fit through the door” problems.

Key concepts:

Global and local costmaps · inflation · planner · controller.

What it is:

Set the goal by clicking in RViz or with code using the Nav2 Python API.

Why learn this:

With Python, navigation becomes a building block other programs can use.

Key concepts:

Nav2 Goal · NavigateToPose · action · feedback.

What it is:

Recovery behaviors: clear the costmap, spin, back up, wait.

Why learn this:

In the real world, the robot will get stuck; what matters is how it gets unstuck.

Key concepts:

Spin · BackUp · Wait · retries.

What it is:

A list of points the robot visits in order, like a patrol.

Why learn this:

This is the foundation for delivery, inspection, and surveillance.

Key concepts:

followWaypoints · order · repetition.

View Full
4.6
Project
0%

🏠 Project: a robot that maps and navigates

Bring it all together on the real robot: architecture, a launch file that starts the system, an environment map, and safe navigation between rooms.

What it is:

What runs where: ESP32 for the motors, Pi 5 with LiDAR and ROS 2, PC for visualization.

Why learn this:

A clear architecture makes it easier to find faults and replace parts.

Key concepts:

Task division · network · ROS_DOMAIN_ID.

What it is:

One command that starts the agent, description, LiDAR, odometry, SLAM, or Nav2 in the right order.

Why learn this:

Opening ten terminals every time doesn’t scale, even in a classroom.

Key concepts:

Arguments · include · conditions.

What it is:

Noise, slippage, delay, and real-time constraints: what Gazebo hides and how to compensate.

Why learn this:

This is where most projects stall; knowing what to expect helps you avoid frustration.

Key concepts:

use_sim_time · calibration · speed limits.

What it is:

Create and save a real map of the space where the robot will work.

Why learn this:

This is the project’s first visible result.

Key concepts:

slam_toolbox · teleop · map_saver.

What it is:

Nav2 on the real map, with named points (kitchen, living room) and a patrol route.

Why learn this:

This is the complete autonomous robot the learning path promised.

Key concepts:

Named points · waypoints · success metrics.

What it is:

Emergency stop, maximum speed, battery, and the path to Learning Path 5.

Why learn this:

A robot that moves on its own near people needs safety limits from the very first test.

Key concepts:

E-stop · limits · watchdog · logging.

View Full

🧰 Trail kit

You can start from scratch in simulation. For the real robot, in addition to the robot from Learning Path 3, the approximate cost is R$ 450 a R$ 1.100, with most of it going toward the LiDAR (Oct 2026; check before buying: prices vary by store, shipping, and exchange rate).

💻 For simulation

PC with Ubuntu 24.04 (Jazzy) or 26.04 (Lyrical), a virtual machine, or Docker. 8 GB of RAM works; 16 GB makes Gazebo run comfortably.

🦾 Robot base

The robot from Learning Path 3: Raspberry Pi 5 with official power supply and cooler, ESP32 and TB6612FNG or DRV8833 driver, two-wheel chassis, and caster wheel.

📡 2D LiDAR

RPLIDAR C1 or A1 (Slamtec) or LD19 (LDRobot), with the included USB adapter. It’s the most expensive part of the learning path.

⚙️ Encoders

The encoder motors from Learning Path 2 (N20 or TT with disk). Without an encoder, there’s no odometry, and the map will be skewed.

🔋 Power

Separate battery for the motors and the Pi (or a 5 V, 5 A buck converter), common GND, and an easy-to-reach stop switch.

🔌 Cables and network

USB data cables (ESP32 and LiDAR) and a stable local Wi-Fi network between the robot and the PC.

✓ Worthwhile optional item

MPU-6050 or ICM-20948 IMU (improves odometry on turns) and an emergency stop button that cuts power to the motors.

✗ Don’t buy these for this trail

3D LiDAR, an expensive depth camera, or a second onboard computer. 2D LiDAR with encoders is enough for mapping and indoor navigation.