Mapping (SLAM)NEORACER DOCS
These docs are public and open source.Edit on GitHub
SOFTWARE / MAPPING

BUILD A MAP.

Drive the car slowly around a room and turns the LiDAR sweeps and wheel odometry into a 2D occupancy grid. Three backends ship on the car: pick one, watch the map form in , then save it for navigation.

slam_toolboxgmappingCartographer0.05 m/pixel grid
01 / BEFORE YOU MAP

DRIVE TO MAP.

Mapping runs on top of the live driver, and you build the map by driving the car yourself. Keep the transmitter in RC mode and take it slowly: smooth, steady passes let the scan matcher keep up.

  • The driver is up on the car (start it with teleop, see ROS 2 driver).
  • You can reach the car's ROS graph from your laptop (see Networking).
  • A bounded indoor space with walls the LiDAR can see. Glass and mirrors read as gaps, so keep them out of the run.
  • SWB up (manual), so you stay on the sticks while SLAM runs.
02 / PICK A BACKEND

THREE WAYS TO MAP.

Each backend runs in its own terminal, with a second terminal that opens RViz so you can watch. Start one mapper, not three.

BackendGood for
slam_toolboxThe default. Solid pose-graph SLAM, easy to resume and refine.
gmappingClassic particle-filter SLAM. Light and familiar.
CartographerLoop-closure heavy, good on larger or repetitive spaces.
//slam_toolbox
bash
racecar ws osracer # switch this shell to the vendor workspace ros2 launch osracer_slam slam_toolbox.launch.py # terminal 1 ros2 launch osracer_debug debug_mapping.launch.py # terminal 2 (RViz)
//gmapping
bash
racecar ws osracer # switch this shell to the vendor workspace ros2 launch osracer_slam gmapping.launch.py # terminal 1 ros2 launch osracer_debug debug_mapping.launch.py # terminal 2 (RViz)
//Cartographer
bash
racecar ws osracer # switch this shell to the vendor workspace ros2 launch osracer_slam cartographer.launch.py # terminal 1 ros2 launch osracer_debug debug_cartographer.launch.py # terminal 2 (RViz)
03 / IN RVIZ

WATCH IT BUILD.

The debug terminal opens RViz with the fixed frame set to map. As you drive, the occupancy grid fills in around the car.

01

The grid

Free space, walls, unknown.
Occupied cells trace the walls the LiDAR has seen; clear cells are open floor; grey is still unknown. Resolution is 0.05 m per pixel.
02

The scan

Live LaserScan over the map.
The current LiDAR return overlays the grid, so you can see the match between what the car sees now and what it has mapped.
03

The path

Where the car has been.
The odometry path and robot model show the trajectory. Slow, overlapping passes give the scan matcher the most to lock onto.
04 / KEEP IT

SAVE THE MAP.

With the mapper still running and the space covered, save. You get a map.pgm image and a map.yaml metadata file under osracer_slam/maps/. That pair is what Nav2 loads.

//slam_toolbox / gmapping
bash
racecar ws osracer # switch this shell to the vendor workspace ros2 launch osracer_slam map_save.launch.xml
//Cartographer
bash
racecar ws osracer # switch this shell to the vendor workspace ros2 launch osracer_slam map_save_cartographer.launch.xml