Mobile Robot Full-stack Development In Practice Ⅴ: How Does a Robot Build and Reuse a Map? 3D Reconstruction and SLAM on Jetson

From motion estimation to maps a robot can save, reload and use.

In Part IV, we explored how a robot interprets its camera observations: detecting objects, tracking them across frames, separating scene regions and estimating a known object’s pose. Those outputs describe what the robot sees. As it moves through a room, it also needs to connect observations to a stable spatial reference and recognize places it has visited before.

3D reconstruction and SLAM turn sensor observations into a map the robot can build, inspect and reuse. SLAM estimates motion while maintaining an environment map; in this module, reconstruction fuses depth observations and poses into geometric surfaces and distance representations. Map reuse then tests whether the robot can recover its position after restarting.

Module 05 of Seeed Studio’s Mobile Robot Full-Stack Development course follows that progression: from FAST-LIO2 motion estimation and RTAB-Map loop closure to Nvblox reconstruction, semantic-map design and navigation-map preparation.

What you will learn:

  • Inspect motion estimates and distinguish local odometry from globally corrected poses.
  • Understand loop closure, surface reconstruction and obstacle-distance representations.
  • Connect M04 perception to the design of a semantic map, with depth, timing and coordinate frames kept consistent.
  • Save a SLAM database, test relocalization and prepare a map for the navigation stack.

Before you start: basic ROS 2 topic/TF knowledge and the earlier sensor-calibration setup will help. Choose the LiDAR-inertial or RGB-D route that matches your sensors; you can work through them independently.

Mobile Robot Full-Stack Development course roadmap connecting perception, mapping, navigation and manipulation

If this is your first time joining the series, the course introduction explains the full learning path. Revisit Part I: Jetson and ROS 2 foundations, Part II: cameras and calibration, Part III: motion and sensor fusion, or Part IV: AI perception when you need the corresponding foundation.

Choose the Mapping Question Before the Algorithm

Imagine moving a robot through an office, around a corridor and back to its starting point. Different stages of that journey need different outputs:

QuestionM05 routeOutput to inspect
How did the sensor move?FAST-LIO2 with Livox MID-360Pose, trajectory and odometry messages
Have I returned to a known place?RTAB-Map with Orbbec Gemini 2Loop constraints and an optimized pose graph
What shape is the surrounding space?Isaac ROS Nvblox reconstruction routeTSDF, mesh and obstacle-distance information
What do mapped regions represent?Semantic-map design using M04 perceptionLabels and object records aligned with geometry
Can I use this map after restarting?RTAB-Map localization and Nav2 map interfaceRelocalization evidence, a saved grid and its metadata

The LiDAR-inertial and RGB-D experiments are separate sensor routes. The RTAB-Map exercise starts its own RGB-D odometry; it does not automatically consume the FAST-LIO2 trajectory from the previous lesson. Likewise, a semantic label layer and a navigation grid serve different purposes.

For a first experiment, choose one route and one small, repeatable scene. A closed walk around a desk or corridor gives you something concrete to compare when you revisit the same place.

Prepare the Platform and Sensor Path

The course is built around reComputer Robotics J501, with Jetson AGX Orin configurations. The M05 semantic-mapping reference specifies AGX Orin 32GB, JetPack 6.2.1 / L4T R36.4.4 and ROS 2 Humble. The Nvblox lesson uses Isaac ROS release 3.2 documentation. Keep the environment for your chosen route consistent rather than mixing ROS distributions across terminals.

RouteWhat to prepare
LiDAR-inertial odometryMID-360, its Ethernet configuration, Livox-SDK2, livox_ros_driver2 and the course’s FAST-LIO2 ROS 2 build
RGB-D SLAM and map reuseGemini 2, the Orbbec ROS 2 driver, registered RGB-D images, RTAB-Map and database storage
Dense reconstructionValid RGB-D/CameraInfo and TF, plus the matching Isaac ROS development environment
Semantic-map designM04 detection/tracking/segmentation outputs, aligned depth and calibrated sensor transforms

You can begin the RGB-D mapping route without assembling the complete mobile chassis. In that experiment, camera_link is the moving reference frame. A later chassis integration needs the measured mounting transform between the camera and robot body.

The maintained M05 lessons contain installation and sensor setup. The commands below are selected checkpoints for those prepared environments.

1. Estimate Motion with FAST-LIO2

Odometry builds a trajectory by composing relative motion estimates. Small errors in those estimates accumulate, so a smooth trajectory can still drift away from the true path.

Visual odometry estimates motion from image observations. Visual-inertial odometry adds IMU measurements; LiDAR-inertial odometry combines inertial prediction with point-cloud geometry. M5.1 introduces these alternatives, then uses FAST-LIO2 and the MID-360 for its hands-on motion-estimation route.

A static table observed from robot positions t0 and t1; the scene stays fixed while the camera moves

Before starting the estimator, verify both /livox/lidar and /livox/imu. A visible point cloud does not establish that the IMU stream, timestamps or LiDAR–IMU extrinsics are correct.

How Inertial Prediction and Geometry Work Together

The two sensors contribute at different stages of the estimate:

  1. Predict with the IMU. Angular velocity and acceleration propagate orientation, velocity and position between LiDAR updates, accounting for gravity and estimated sensor biases. The prediction also carries uncertainty.
  2. Correct with LiDAR geometry. FAST-LIO2 compensates for motion during a scan, then compares its points with local surfaces in the map. Point-to-plane discrepancies provide measurement constraints for an iterated Kalman update. The FAST-LIO2 paper explains this combination of inertial prediction and geometric correction.
  3. Update the local map. The corrected pose places new observations in the map; the incremental ikd-Tree supports the neighboring-point searches and map updates needed for subsequent scans.

Consider a slow turn beside a stationary wall. Points arrive throughout the turn, so they were measured from different sensor poses. Treating them as one instantaneous observation can distort the wall. Motion compensation needs meaningful per-point timing and a consistent relationship between LiDAR and IMU coordinates.

That gives you a diagnostic order: if the wall looks stable while stationary but bends during rotation, check synchronization, point timestamps and extrinsics first, following the upstream timing and calibration notes. A smooth pose trace alone cannot establish that these inputs are correct; compare the same static surface before and during motion.

Once the documented driver and FAST-LIO2 build are ready, start them in separate terminals, each with ROS 2 Humble and the workspace sourced:

# Terminal A: Livox data for the estimator
ros2 launch livox_ros_driver2 msg_MID360_launch.py
# Terminal B: FAST-LIO2 with the MID-360 configuration
ros2 launch fast_lio mapping.launch.py \
  config_file:=mid360.yaml \
  rviz:=true

The lesson asks you to hold the sensor stationary for approximately 5–10 seconds during initialization, then move slowly. Its odometry topic is /Odometry, including the capital O:

ros2 topic info /Odometry
ros2 topic echo /Odometry --once
ros2 topic hz /Odometry

FAST-LIO2 course screenshot showing a reconstructed point cloud and the motion-estimation visualization in RViz2

Try three observations: remain stationary, translate slowly, then rotate slowly. Compare the reported position and orientation with those motions. If the trajectory jumps or surfaces stretch, inspect timing, IMU data and extrinsics before adjusting visualization settings.

This exercise establishes local motion estimation. Returning to the starting point does not, by itself, make this FAST-LIO2 setup perform loop closure.

Green true trajectory and dashed orange estimated trajectory diverging as odometry error accumulates

2. Use RTAB-Map to Recognize Places and Correct the Map

In the RGB-D route, RTAB-Map adds historical observations to the estimation problem. Representative observations form graph nodes, adjacent poses have odometry constraints, and a verified revisit can add a loop constraint between distant parts of the trajectory.

Simplified pose graph with nodes T0 through T4 connected by adjacent odometry constraints

A familiar-looking image is only a candidate match. Geometric verification helps distinguish a real revisit from a similar corridor. Graph optimization then reconciles the constraints across poses, rather than simply snapping the last point back to the start.

What Changes When the Robot Closes a Loop?

Consider an illustrative office walk: the camera starts beside a desk, passes through a corridor and returns to the desk. Accumulated odometry error may place the final observation beside a second, offset copy of the original wall.

Recognizing the desk proposes a historical match. Matching scene features and their geometry must then support a relative pose between the current observation and the earlier one. That relationship becomes an additional graph constraint; it does not declare every earlier pose perfectly known.

The optimizer seeks poses that jointly satisfy the neighboring odometry relationships and the new loop relationship. Their uncertainties influence how strongly discrepancies are penalized. Consequently, correction can be distributed across relevant poses along the walk. It is not necessarily uniform, and simply moving the last pose would leave the intermediate trajectory inconsistent. M5.2’s optimization explanation describes this reconciliation.

For your experiment, compare the same wall and desk before and after an accepted loop. Better alignment supports consistency, but a closed-looking trajectory alone is insufficient. Repetitive corridors can produce a wrong association that pulls unrelated places together. Inspect which observations were linked and whether their geometry agrees with the real scene before accepting a visually tidy map.

Gemini 2 RGB-D observations feed RTAB-Map odometry and the SLAM backend, which maintain global correction and a map database

Start the Gemini 2 with the lesson’s registration and frame-synchronization settings. With the camera publishing, launch the course’s RTAB-Map configuration in another sourced terminal:

mkdir -p "$HOME/slam_maps"ros2 launch rtabmap_launch rtabmap.launch.py 
visual_odometry:=true
depth:=true
frame_id:=camera_link
vo_frame_id:=odom
odom_topic:=/odom
rgb_topic:=/camera/color/image_raw
depth_topic:=/camera/depth/image_raw
camera_info_topic:=/camera/color/camera_info
approx_sync:=true
qos:=2
publish_tf_odom:=true
publish_tf_map:=true
database_path:=$HOME/slam_maps/m5_2_gemini2.db
rtabmap_viz:=true
rviz:=false

Here, visual_odometry:=true starts RGB-D odometry as part of the launch. Use a new database filename for a new mapping experiment; an existing file may be loaded and reused. For headless operation, disable rtabmap_viz.

Move through a textured scene and deliberately revisit a previously observed location. Inspect the accepted loop relationship, trajectory and map alignment. A map that merely grows while you move is not sufficient evidence of successful loop closure.

After stopping RTAB-Map cleanly and allowing the database to save, inspect it:

rtabmap-databaseViewer "$HOME/slam_maps/m5_2_gemini2.db"

RTAB-Map course interface with image observations, odometry view and a reconstructed point cloud

Keep the frame roles clear: odom provides a continuous local reference that can drift; map provides the globally corrected reference. In this setup, the map → odom transform carries the global correction.

3. Turn Depth and Poses into a Dense 3D Representation

A trajectory tells you where observations were taken. Mapping also needs a representation of what those observations describe.

The dense-mapping lesson introduces the representations used in this step:

RepresentationMain question it answers
Point cloudWhere were 3D samples observed?
Occupancy grid or voxel mapWhich regions are observed as free, occupied or unknown?
TSDFWhere is the surface, after fusing depth observations near it?
MeshHow can the reconstructed surface be displayed as triangles?
ESDFWhat is the distance to the nearest mapped obstacle surface?

Three schematic grids compare occupancy state, signed distances near a surface in TSDF, and obstacle distance in ESDF

One Desk, Three Different Map Outputs

To see how the representations differ, imagine observing a desk from several viewpoints with a depth camera:

  • TSDF — fuse the surface evidence. Each observation contributes signed-distance information near the measured surface, within a truncated range. Fusing observations helps estimate a consistent desk surface. The zero crossing represents the surface; a TSDF value should not be treated as a general nearest-obstacle distance everywhere in the room.
  • Mesh — inspect the reconstructed shape. Extracting triangles from the TSDF produces a visible tabletop and legs where the observations support them. You can inspect missing regions, duplicated surfaces and apparent scale. An attractive mesh does not establish that unseen space is free.
  • ESDF — query distance to mapped obstacles. At a position beside a mapped desk leg, the field provides distance to the nearest represented obstacle surface. This supplies information a planner can use, while robot dimensions and clearance requirements still need to be applied.

These outputs answer different questions about the same scene, as the M5.3 representation guide explains. Check surface alignment in the mesh and distance behavior in the ESDF separately; neither replaces valid depth, poses or an explicit policy for unknown space.

Isaac ROS Nvblox provides GPU-accelerated depth fusion and geometric-map computation. Its release 3.2 documentation describes depth/pose inputs, mesh visualization and navigation costmap outputs. It needs a pose source; it does not replace the localization system.

For the course’s adaptation, the Gemini 2 camera and RTAB-Map run on the host while Nvblox runs in an Isaac ROS container. Check that the container can discover the image topics and TF, then verify the depth encoding, intrinsics and actual image frame. A running container alone does not establish a complete mapping pipeline.

Depth image, CameraInfo and RTAB-Map TF or pose form three separate inputs to Nvblox TSDF integration
Course Nvblox mesh visualization in RViz, captured on Jetson AGX Thor

For J501 developers: the lesson’s custom Gemini 2 launch is a reference adaptation awaiting validation on J501 + Gemini 2. Check the camera interfaces, matching software environment and reconstruction outputs before treating it as a working configuration for your robot.

Keep Local Fusion and Global Correction Distinct

The example uses odom as Nvblox’s mapping frame to inspect continuous local reconstruction. An RTAB-Map loop correction does not automatically re-integrate all previously fused TSDF observations using corrected historical poses.

That distinction matters when revisiting a room: an optimized pose graph and a consistent accumulated dense map require separate checks. Longer-term global reconstruction needs a strategy for rebuilding or re-fusing affected map data.

Also inspect the height axis before using a 2D ESDF slice. A slice defined in a tilted frame may not correspond to the robot’s horizontal operating space. Surface appearance, obstacle distance and navigation suitability are different acceptance checks.

4. Add Meaning to Geometry with Semantic Mapping

Geometry locates surfaces. Semantic information associates observations with categories such as a person, chair or doorway. M5.4 explains how the M04 perception outputs can be associated with a geometric map.

The key operation is to place an image observation in a shared spatial frame:

  1. Align the label or selected pixels with the corresponding depth observation.
  2. Back-project valid pixels using depth and camera intrinsics.
  3. Transform those 3D points into the map at the observation timestamp.

For a pinhole projection, with depth d in meters:

x = (u - cx) × d / fx
y = (v - cy) × d / fy
z = d

These coordinates belong to the image’s optical frame: x right, y down and z forward under ROS camera conventions. Use the actual image frame and its TF relationship; changing a frame name does not transform the coordinates.

Conceptual projection from labeled image pixels through depth and camera geometry into a spatial map

The M5.4 projection illustration explains the geometry. It is a design illustration, not an implemented semantic-map result.

For the lesson’s 16UC1 millimeter depth, convert values to meters before applying the equations. A unit mismatch introduces a thousand-fold scale error. Also reject invalid depth, match intrinsics to the registered image geometry, and ensure the labels and depth refer to the same scene time.

Semantic point clouds, object records and persistent landmarks offer different levels of detail. A useful design also separates persistent objects from dynamic observations, so passing people are not stored as permanent structure. M04’s selected ground mask remains a candidate region; it still needs geometric clearance and robot-specific constraints before it can support a traversability decision.

Conceptual semantic point cloud, object-level 3D boxes and a graph of named spatial landmarks

For example, a point label can explain a colored surface, an object record can locate a particular chair, and a persistent landmark can support a query for the meeting-room door. Decide which record you need before accumulating every image label into a long-term map.

Conceptual occupancy grid, persistent objects and transient pedestrians shown as separate semantic-map layers

M5.4 currently covers projection and map-layer design; its hands-on implementation walkthrough is still forthcoming. Validate the geometric map first, then use these interfaces to plan the semantic integration.

5. Save the Map, Relocalize and Prepare the Navigation Interface

Map reuse tests something that a live visualization cannot: whether the robot can recover a meaningful position in an environment it has already mapped.

SLAM database, 3D geometric map, semantic map and 2D occupancy grid serve different robot tasks

In M5.5, preserve the original RTAB-Map database and work with a copy:

mkdir -p "$HOME/slam_maps/m5_5"
cp "$HOME/slam_maps/m5_2_gemini2.db" \
   "$HOME/slam_maps/m5_5/localization.db"

Restart the Gemini 2, then reuse the RTAB-Map launch configuration above with localization:=true added and database_path changed to $HOME/slam_maps/m5_5/localization.db. Localization mode matches current observations against the stored map.

RTAB-Map localization-mode course screenshot showing current observations beside the existing map

Revisit a mapped area and inspect:

ros2 run tf2_ros tf2_echo map camera_link

A valid TF query is one check. Confirm that RTAB-Map accepts a historical match and that the resulting location agrees with the real scene.

Export a Grid That Nav2 Can Load

The database stores SLAM observations and relationships. A 2D navigation map has a different job: describing occupancy with spatial metadata.

With RTAB-Map running, identify the published OccupancyGrid topic. The lesson normally uses /rtabmap/map; use your actual topic if it differs. After installing ros-humble-nav2-map-server, export the grid:

mkdir -p "$HOME/slam_maps/m5_5/nav2"ros2 run nav2_map_server map_saver_cli 
-t /rtabmap/map
-f "$HOME/slam_maps/m5_5/nav2/office_map"

Inspect both office_map.pgm and office_map.yaml. Keep the image together with its resolution, origin and occupancy-threshold metadata.

For an isolated reload test, stop the RTAB-Map launch before starting the Map Server, as the lesson directs:

ros2 run nav2_map_server map_server --ros-args \
  -p yaml_filename:=$HOME/slam_maps/m5_5/nav2/office_map.yaml

Configure and activate its lifecycle node from another ROS 2 terminal:

ros2 lifecycle set /map_server configure
ros2 lifecycle set /map_server activate
ros2 lifecycle get /map_server

Schematic occupancy grid with white free cells, dark occupied cells, light-gray unknown cells and a robot marker

This test verifies map loading and publication. Full navigation still needs localization, costmaps, planning, control and the robot interface; loading the grid does not start those components.

Occupancy grid, TF2 robot pose and goal pose feed Nav2 planning, followed by path following and motion control

Check Map Quality and Reuse

Save a small evidence set before moving to the next module:

CheckEvidence to retainIf it fails, inspect first
Motion follows the sensorStationary, translation and rotation observations with odometryInput streams, timing, initialization and extrinsics
Revisits constrain the mapAccepted loop/match information and aligned observationsScene texture, overlap and geometric verification
Reconstruction has the right scaleDepth encoding, intrinsics, frame and surface alignmentUnits, registration and TF at acquisition time
Dense fusion survives the intended motionRepeat observations of the same surfacesPose drift and the handling of global corrections
Map reuse worksHistorical match plus a plausible map-frame poseDatabase path, localization mode and viewpoint overlap
Navigation map reloadsGrid image/YAML, active Map Server and RViz viewTopic selection, metadata, lifecycle and display QoS

These checks connect the output to the physical scene. They also make a problem reproducible for someone else: retain your sensor model, software versions, configuration, input and relevant messages alongside screenshots.

The Hardware Behind the Mapping Experiments: reComputer Robotics J501

The mapping routes need an embedded computer that can receive sensor streams, run ROS 2 estimation and support GPU-based reconstruction components. The course uses reComputer Robotics J501, bringing Jetson AGX Orin compute together with camera, USB, Ethernet and CAN connectivity for robotics integration.

Official reComputer Robotics J501 series product photograph showing the enclosure and robotics interfaces


reComputer Robotics J501 series. Photo: Seeed Studio J501 hardware guide. The image represents the series; check the selected module and configuration separately.

For the 32GB configuration referenced here, inspect reComputer Robotics J5011 with GMSL expansion. The J501 hardware and JetPack guide covers the matching software image and interfaces. Select the camera or LiDAR for your chosen route; the RGB-D and MID-360 exercises have different sensor requirements.

Explore the M05 Lessons and Share Your Map

Choose the next lesson by the result you want to produce:

Your next taskLessonWhat is available
Inspect a motion estimateM5.1: Motion EstimationVO/VIO/LIO concepts and the FAST-LIO2 + MID-360 exercise
Build and inspect a SLAM databaseM5.2: Loop Closure and OptimizationGemini 2 RGB-D mapping, loop inspection and database saving
Study dense surface and distance mapsM5.3: 3D Geometric MappingTSDF/Mesh/ESDF explanations and the Nvblox reference adaptation
Design a semantic layerM5.4: Semantic MappingProjection, interfaces and layer design; hands-on walkthrough forthcoming
Reuse a saved mapM5.5: Map Management and RelocalizationLocalization mode, occupancy-grid export and Map Server verification

Start with one deliverable: a FAST-LIO2 motion trace, an RTAB-Map database with an inspected revisit, or a saved grid that reloads correctly.

Open the complete M05 lessons and follow the route that matches your sensors. Star the repository to keep the course easy to find, or fork it to record your configuration changes. Submit a pull request when you have a reproducible fix or a clearer setup to contribute.

For a reproducible course issue, check the repository’s existing issues and include your setup, exact command, topic/frame information and observed result. To discuss your build with other developers, share a short mapping clip in the Seeed Discord Jetson community / Facebook Group, naming the sensor route and one result you have verified.

With a map you can explain, save and reload, you have a concrete interface to carry into localization and navigation work.

About Author

Leave a Reply

Your email address will not be published. Required fields are marked *

Calendar

November 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30