Sends a goal for the robot to navigate on its own
From the 3D map, launch automatically generates a 2D map marking where the robot can go. Nav2 finds its way around that map; The localizer in lesson 3 shows where the robot is. Click a point in RViz, the robot moves forward automatically.
Robot from the starting point to the middle of the platform in 32 s, without any recovery behavior. The path avoids both the edge of the platform and the edge of the slope.
Run
Turn off Terminal 2 of lesson 3 (localization). Hold Terminal 1; If the robot has been driven away, reopen Terminal 1 to return the robot to its starting point.
Terminal 2
ros2 launch atlas3d_navigation navigation.launch.py \
map_dir:=$HOME/atlas_sim3D/src/atlas3d_mapPCDs/ramp/run_01
This launch reruns the localization of lesson 3 (same localizer, same poses.txt line 0), adds Nav2 and a separate RViz. The first time with a map, it generates nav_map.pgm + nav_map.yaml next to map.pcd:
1285934 điểm → lưới 244×244 ô 0.1 m (24.4×24.4 m) trong 0.4 s: đi được 87.8 %, vật cản 5.9 %, chưa biết 6.3 %
keyframe nằm trên ô đi được: 100 % (107 keyframe)
The second line is a check: every place the robot passed while scanning must be a traversable cell. Lower than 95% means the map has problems. Wait for two more lines ICP alignment accepted and Managed nodes are active (dev machine: 7 s after command).
Set goal
- In RViz, press 2D Goal Pose.
- Click on the center of the platform, drag in the direction you want the robot to face when it arrives, and release.
The green line (/plan) appears immediately, the robot starts walking. Planner recalculates the path every second, so the green path becomes shorter as the robot progresses.
| Display in RViz | |
|---|---|
traversability map (/map) | nav_map.pgm: passable white, black obstacles, unscanned gray |
| Global costmap | Top map + buffer around obstacles; planner finds his way around this class |
| Local costmap | 8 × 8 m area around the robot, adding new obstacles seen from the ongoing scan |
| Obstructions / Ground | The scan point is now separated into obstacles and ground |
Track (/plan) | Road planner selected |
| Robot footprint | Rectangular 0.74 × 0.58 m Nav2 for collision testing |
Results on dev machine
| Goal (frame map) | Time | Recovery | Goal error |
|---|---|---|---|
| Center of platform (7, −8) | 32 s | 0 | 0.24 m |
| East slope foot (7, −18.5) | 22 s | 0 | 0.21 m |
| Starting place (0, 0) | 51 s | 0 | 0.22 m |
While the robot is running, the localizer position indicates a 3 cm (median) deviation from the ground truth in the Gazebo. Machine load when running the whole pipeline (localization + Nav2, no Gazebo window, no RViz):
| Progress | CPU (100 % = 1 thread) | RAM |
|---|---|---|
| Gazebo | 104 % | 715 MB |
| Nav2 | 55 % | 251 MB |
| FAST-LIO2 | 43 % | 130 MB |
| Bridge + IMU filter | 35 % | 86 MB |
| Localizer | 22 % | 87 MB |
| Other ROS (obstacle filtering, relocalize, map_server, launch…) | 103 % | 397 MB |
| Total | 3.6 threads | 1.6 GB |
The first time the robot got stuck on the edge of a slope
The first time running on this map, the robot walked 20 seconds then got stuck on the north edge of the west slope. Nav2 tried turning and backing up about 20 times and then gave up after 173 seconds. Select "Error" in the scene above to review.
The cause lies in the traversability map. When scanning, the robot runs along the middle of the slope and only circles the south side of the platform, so LiDAR never looks directly at the north side of the slope. Along that edge there is a narrow strip with no points. The map generator fills such narrow gaps as "traversable" (exactly the gaps between beam rings on the far floor), so the 0.3 m high slope edge becomes a walkway. Planner cuts diagonally through it.
Fixed in pcd_to_navmap.py: the tile that fills the slot is assigned the average height of the tiles around it and then checks the step, so the gap between the slope and the floor becomes a step (black). Then there was a second error: a streak of extra points 6 cm higher than the slope surface (scan was misaligned) forming an obstruction in the middle of the slope, blocking the lane. This streak is now considered to be on the same side as the slope face. M11 goes into how to generate traversability maps.
Scanning lesson: go over both sides of platforms and slopes so the LiDAR sees every edge.
Try without RViz
Repo has a script to send goal and print results, used for automated testing:
python3 tools/sim_test/nav_goal.py 7 -8 -90
còn 0.7 m, đã đi 29 s, recovery 0
TỚI ĐÍCH sau 32 s; pose cuối (6.93, -7.77, z 0.45), lệch đích 0.24 m
Target coordinates in frame map: origin at the starting point, x axis in the direction of the robot's nose when SLAM is turned on. The platform surface in (7, −8) is only correct for the map scanned from the ramp's default starting point.
Common errors
ICP alignment accepted yet), Nav2 doesn't know where the robot is yet. Reposition using 2D Pose Estimate.map.pcd is newer than nav_map.pgm. If you want to force regeneration: add regenerate:=true.