Autonomous 2D LiDAR Mapping Rover with SLAM & Nav2
Construct a differential-drive robot capable of autonomous 2D LiDAR indoor mapping, obstacle avoidance, and Nav2 waypoint navigation.
An end-to-end mobile robot hardware build: laser-cut acrylic / 3D chassis, metal gearmotors with optical quadrature encoders, TB6612FNG motor driver, RPLiDAR A1 360-degree laser scanner, ESP32 micro-ROS odometry node, and a Raspberry Pi 4/5 running ROS 2 Humble.
Bill of Materials (BOM) & Components
| Component | Specifications | Qty | Estimated Cost |
|---|---|---|---|
| RPLiDAR A1M8 360° 2D Laser Scanner | 12-meter range, 5.5Hz - 10Hz rotation rate, 8000 sample rate | 1 | $99 |
| Raspberry Pi 5 (4GB / 8GB) with NVMe Hat | High-speed Ubuntu 22.04 host for SLAM Toolbox & Nav2 | 1 | $85 |
| 12V DC Gearmotors with Integrated Quadrature Encoders | 330 RPM, 30:1 metal planetary gearbox, 334 CPR magnetic encoders | 2 | $32 |
| TB6612FNG Dual H-Bridge Motor Driver | 1.2A continuous per channel, 3.2A peak, 15V max | 1 | $6 |
| 3S 11.1V 2200mAh LiPo Battery & 5V 5A High-Efficiency Buck Regulator | Power isolation between motors and Raspberry Pi | 1 | $28 |
Electrical & Architecture Summary
ESP32 handles high-rate encoder interrupts and closed-loop PID velocity control. Raspberry Pi 5 connects to ESP32 over USB serial and RPLiDAR over USB, publishing LaserScan, TF, and running SLAM Toolbox.
Step-by-Step Assembly & Configuration
Chassis Assembly & Motor Mounting
Mount gearmotors onto the base plate, attach high-traction silicone rubber wheels, and install the front/rear ball caster for stable 3-point contact.
- Secure motor brackets with M3 thread-lock screws.
- Install caster wheel ensuring level chassis height (ground clearance ~18mm).
- Mount 3S battery tray on the lowest level to minimize Center of Gravity (CoG).
Power Wiring & Star Grounding Isolation
Route battery power through a 10A master switch and fuse. Connect output to 5V 5A buck converter for Raspberry Pi 5, and directly to TB6612FNG for motor rails.
- Solder XT60 battery connectors.
- Connect star ground reference between ESP32 and motor power ground.
- Verify 5.1V stable output under full CPU load before connecting Raspberry Pi.
ESP32 micro-ROS Firmware & Odometry Tuning
Flash the ESP32 with the micro-ROS diff_drive firmware, calculate exact wheel diameter and track width calibration factors, and publish odometry.
- Perform a 2-meter straight line test and 360-degree rotation test to tune wheel calibration coefficients.
- Verify `/odom` topic and TF `odom -> base_link` in RViz 2.
Mapping with SLAM Toolbox & Nav2 Autonomous Waypoint Following
Teleoperate the rover using a joystick to map your environment, serialize the map, and test point-and-click autonomous navigation in Nav2.
- Launch `ros2 launch slam_toolbox online_async_launch.py`.
- Drive around all rooms to close loops, then save map with `map_saver_cli`.
- Launch Nav2 and send 2D Navigation Goals.