Building Bonxai and NavMap Maps from a Recorded ROSBagο
This HowTo shows how to generate both Bonxai and NavMap representations
from a recorded ROSBag containing a PointCloud2 map, typically produced
by a SLAM algorithm. The input point cloud must be referenced to the world
or map frame.
β
Setupο
Complete the installation steps in Build & Install first (any of APT,
Pixi or source). This tutorial uses the Bonxai Maps Manager and NavMap Maps
Manager plugins, which the core easynav package does not include:
APT:
sudo apt install \ ros-<distro>-easynav-bonxai-maps-manager \ ros-<distro>-easynav-navmap-maps-manager
Pixi:
pixi add \ ros-<distro>-easynav-bonxai-maps-manager \ ros-<distro>-easynav-navmap-maps-manager
Source: already built if you followed Build from source (which also clones
NavMap, needed by the NavMap Maps Manager).
Then source your workspace as described in Build and source the workspace. You will
also need a recorded ROS bag containing a PointCloud2 map (this workspace does
not ship one β use your own or one produced by GridMap Mapping with LidarSLAM and EasyNav).
β
Overviewο
You will:
Align coordinate frames (
worldβmapif needed).Play a pre-recorded ROS bag containing the
/mappoint cloud.Launch EasyNav with both BonxaiMapsManager and NavMapMapsManager to build the two maps simultaneously.
Visualize both in RViz2.
Save the resulting maps to disk.
β
1. Align the Frames (world β map)ο
If your ROS bag publishes a PointCloud2 in the frame world,
you need to publish a static transform so that the map managers
receive data in map.
In a new terminal, run:
ros2 run tf2_ros static_transform_publisher --frame-id world --child-frame-id map
Keep this terminal running for the entire session.
If your point cloud is already in the map frame, skip this step.
β
2. Play the ROSBagο
Next, replay the recorded ROS bag containing the point cloud map.
The example bag is about 1600 seconds long. To jump close to the end (around 1500 seconds, when the map is already dense) but still leave a few seconds to build the maps, run:
ros2 bag play rosbag_excavation_urjc_map_tf_only --clock --start-offset 1500
This will replay the point cloud topic /map and the TF tree
needed by the map managers.
β
3. Launch EasyNav with Bonxai and NavMap Maps Managersο
In a new terminal, launch EasyNav System with both map managers active.
ros2 run easynav_system system_main \
--ros-args \
--params-file /absolute/path/to/bonxai-navmap.dummy.params.yaml \
-r /maps_manager_node/navmap/incoming_pc2_map:=/map \
-r /maps_manager_node/bonxai/incoming_pc2_map:=/map
This setup assumes:
The input cloud topic is
/map.The QoS settings are standard (reliable, transient local).
Both managers will build their respective maps automatically.
The file bonxai-navmap.dummy.params.yaml defines dummy plugins
for all nodes except maps_manager_node.
Example configuration:
controller_node:
ros__parameters:
use_sim_time: true
controller_types: [dummy]
dummy:
rt_freq: 30.0
plugin: easynav_controller/DummyController
cycle_time_nort: 0.01
cycle_time_rt: 0.001
localizer_node:
ros__parameters:
use_sim_time: true
localizer_types: [dummy]
dummy:
rt_freq: 50.0
freq: 5.0
reseed_freq: 0.1
plugin: easynav_localizer/DummyLocalizer
cycle_time_nort: 0.01
cycle_time_rt: 0.001
maps_manager_node:
ros__parameters:
use_sim_time: true
map_types: [bonxai, navmap]
bonxai:
freq: 10.0
plugin: easynav_bonxai_maps_manager/BonxaiMapsManager
package: easynav_indoor_testcase
bonxai_path_file: maps/excavation_urjc.pcd
navmap:
freq: 10.0
plugin: easynav_navmap_maps_manager/NavMapMapsManager
package: easynav_indoor_testcase
navmap_path_file: maps/excavation_urjc.navmap
planner_node:
ros__parameters:
use_sim_time: true
planner_types: [dummy]
dummy:
freq: 1.0
plugin: easynav_planner/DummyPlanner
cycle_time_nort: 0.2
cycle_time_rt: 0.001
sensors_node:
ros__parameters:
use_sim_time: true
forget_time: 0.5
system_node:
ros__parameters:
use_sim_time: true
use_real_time: false
position_tolerance: 0.3
angle_tolerance: 0.15
β
4. NavMap Build Parametersο
Internally, when the NavMapMapsManager builds a mesh from an incoming PointCloud2
(incoming_pc2_map), it calls navmap_ros::from_pointcloud2() with a
navmap_ros::BuildParams structure that controls mesh reconstruction quality:
Available parameters (current defaults, not yet exposed as ROS parameters)
Parameter |
Description |
Default |
|---|---|---|
|
In-plane sampling resolution (m) for voxelization. |
1.0 |
|
Maximum triangle edge length (m). |
2.0 |
|
Maximum allowed vertical jump (m) between vertices. |
0.25 |
|
Maximum slope (degrees) relative to the vertical axis. |
30.0 |
|
Neighborhood radius (m) for triangle connectivity. |
2.0 |
|
Alternative to radius: number of nearest neighbors. |
20 |
|
Minimum triangle area (mΒ²) to reject degenerate faces. |
1e-6 |
|
Use radius-based vs. k-NN connectivity. (bool) |
true |
|
Minimum interior angle (degrees) to avoid slivers. |
20.0 |
|
Keep only the N largest connected surfaces (0 = all). |
0 |
Note
These fields are defined by navmap_ros::BuildParams (see navmap_ros/conversions.hpp in
the NavMap repository), but as of this writing the
NavMapMapsManager constructs this structure with its default values when handling
incoming_pc2_map β it does not currently read them from the navmap pluginβs YAML
configuration. If you need different mesh-reconstruction quality, you must change these defaults
in code (or check whether a newer release of easynav_navmap_maps_manager has since exposed
them as ROS parameters).
β
5. Visualize in RViz2ο
Open RViz2 to monitor both map managers.
ros2 run rviz2 rviz2 --ros-args -p use_sim_time:=true
In RViz:
Add a PointCloud2 display for Bonxai maps. - Select the topic published by BonxaiMapsManager (e.g.,
/maps_manager_node/bonxai/map). - QoS: Transient Local. - You can visualize the cloud as boxes with configurable size for clearer 3D structure.Add a NavMapDisplay (custom display type). - Select the topic published by NavMapMapsManager (e.g.,
/maps_manager_node/navmap/map). - QoS: Transient Local.
Figure 6 Bonxai map visualization in RViz.ο
Figure 7 NavMap mesh visualization in RViz.ο
β
6. Save the Mapsο
When both maps are visible and complete, you can store them to disk using their respective map manager services.
Save NavMap
ros2 service call /maps_manager_node/navmap/savemap std_srvs/srv/Trigger
The NavMapMapsManager always writes to the hardcoded path /tmp/map.navmap
(this is unconditional in the current implementation, regardless of any navmap_path_file
you configured). Rename and move it to your desired location (e.g. inside maps/).
Save Bonxai Map
ros2 service call /maps_manager_node/bonxai/savemap std_srvs/srv/Trigger
Unlike the NavMap manager, BonxaiMapsManager saves back to whatever path it used to load
the map: if package/bonxai_path_file are left unset, it saves to /tmp/bonxai_map.pcd;
otherwise it overwrites the package/bonxai_path_file location.
Warning
The example configuration above sets bonxai_path_file: maps/excavation_urjc.pcd, so calling
savemap here will overwrite easynav_indoor_testcase/maps/excavation_urjc.pcd (the
original source map) rather than writing to /tmp/bonxai_map.pcd. If you want to keep the
original file intact, back it up first, or temporarily clear package/bonxai_path_file
before calling savemap.
β
7. Summaryο
You have:
β Aligned frames between
worldandmapβ Played a recorded ROS bag with point cloud data
β Built Bonxai and NavMap maps simultaneously
β Visualized them in RViz
β Saved both maps to disk for future use
These maps can now be used in EasyNav navigation stacks (e.g. with the Costmap or NavMap planners).
β
Next steps: