This document covers the new Nav2 integration in amr_nav2, including SLAM, localization, the map directory, and the Nav2 RViz workflow.
amr_nav2/launch/ld90.launch.py: LD90 Nav2 child launchamr_nav2/launch/ld250.launch.py: LD250 Nav2 child launchamr_nav2/launch/nav2.launch.py: Nav2 server bringup used by both robotsamr_nav2/launch/slam.launch.py: SLAM Toolbox integrationamr_nav2/launch/nav2_rviz.launch.py: RViz launcher for Nav2 workflowsamr_nav2/config/ld90_nav2.yaml: LD90 Nav2 parametersamr_nav2/config/ld250_nav2.yaml: LD250 Nav2 parametersamr_nav2/maps: map YAML files and referenced occupancy imagesamr_nav2/rviz/nav2.rviz: Nav2 RViz config with Nav2 plugins and tools
Map files now live under amr_nav2/maps.
The launch argument is a filename, not a full path.
Example layout:
amr_nav2/maps/
warehouse.yaml
warehouse.pgm
Example launch argument:
map:=warehouse.yamlLD250 example:
source install/setup.bash
ros2 launch amr_ros ld250.launch.py use_nav2:=true use_localization:=true map:=warehouse.yamlLD90 example:
source install/setup.bash
ros2 launch amr_ros ld90.launch.py use_nav2:=true use_localization:=true map:=warehouse.yamlBehavior:
- localization only starts if
use_localization:=true - localization only starts if
mapis non-empty - the map filename is resolved relative to
amr_nav2/maps
LD250 example:
source install/setup.bash
ros2 launch amr_ros ld250.launch.py use_nav2:=true use_slam:=trueLD90 example:
source install/setup.bash
ros2 launch amr_ros ld90.launch.py use_nav2:=true use_slam:=trueIf both use_slam:=true and use_localization:=true are set, the launch flow suppresses localization to avoid conflicting map sources.
The Nav2 RViz view is separate from the legacy amr_ros RViz views.
source install/setup.bash
ros2 launch amr_nav2 nav2_rviz.launch.pyThis RViz config includes:
- Nav2 RViz panel plugin
- map display
- local and global costmaps
- laser scan
- robot model
- TF tree
- global and local paths
- AMCL pose display
2D Pose Estimateand2D Goal Posetools
- Launch the base and Nav2 with
use_slam:=true. - Launch
amr_nav2 nav2_rviz.launch.py. - Drive the robot and build the map in RViz.
- Save the map into
amr_nav2/maps.
- Copy the saved map YAML and image into
amr_nav2/maps. - Launch the base and Nav2 with
use_localization:=true map:=your_map.yaml. - Launch
amr_nav2 nav2_rviz.launch.py. - Use
2D Pose Estimatein RViz to initialize localization. - Use
2D Goal Poseto send navigation goals.
Start LD250 localization and open Nav2 RViz:
ros2 launch amr_ros ld250.launch.py use_nav2:=true use_localization:=true map:=warehouse.yaml
ros2 launch amr_nav2 nav2_rviz.launch.pyStart LD90 SLAM and open Nav2 RViz:
ros2 launch amr_ros ld90.launch.py use_nav2:=true use_slam:=true
ros2 launch amr_nav2 nav2_rviz.launch.py