基于滚动体素网格的 Bonxai 实现,可在 ROS 2 中处理大型地图
Rolling-Bonxai is a C++ 17 implementation built on top of Bonxai:https://github.com/facontidavide/Bonxai. Memory remains a bottleneck for resource constrained robots (like drones) that have to map and navigate in very large areas. In these large areas, the robot will likely not need other parts of the map besides some local area to do path planning/local planning. Therefore, these storing unnecessary parts of the map in memory is wasteful. Rolling Bonxai implements a chunking system (like in games) comprising of NxNxN voxels each. Each chunk is a Bonxai::OccupancyGrid that can be loaded/created or offloaded depending on the robot's position. Unused parts of the maps are serialized and saved to disk and loaded when required depending on a user defined policy. The underlying Bonxai library implements a compact hierarchical data structure that can store and manipulate volumetric data, discretized as Voxel Grids in a manner that is both sparse and unbounded. Star this repo if you found this useful/interesting :)
Full Video Here: https://youtu.be/gStI7W-x3mM
Green and Blue semi-transparent cubes are "Dirty" and "Clean" chunks. Dirty chunks are those that have been updated since the last time it was loaded into memory, while clean ones have not. Chunks that contain voxels are dirty. As the sensor moves, chunks are evicted based on some policy. In this case, it is a position based policy, where chunks that are not one of the 26 neibors of the current chunk are evicted from memory.
Full Video Here: https://youtu.be/h4DjMLnnrf4
Rolling Bonxai requires a point cloud source published as a sensor_msgs/PointCloud2 topic in the ROS 2 graph. This is typically provided by a depth camera (e.g., ZED2i) or a LiDAR sensor. You must configure topic_in to match the topic your sensor is publishing on, and ensure TF transforms are available from your sensor frame to the frame_id (map frame).
Required ROS 2 packages and dependencies:
bonxai_core, bonxai_map, rolling_bonxai, rolling_bonxai_msgsrclcpp, sensor_msgs, tf2_ros, pcl_conversionsyaml-cppBuild your workspace with:
colcon build --packages-select bonxai_core bonxai_map rolling_bonxai rolling_bonxai_msgs rolling_bonxai_ros
source install/setup.bashThe composable node option runs RollingBonxaiServer inside an rclcpp_components container, enabling zero-copy intra-process communication when combined with other composable nodes (e.g., the ZED camera wrapper).
ros2 launch rolling_bonxai_ros rolling_bonxai_mapping.launch.pyYou can override the container name and Foxglove visualization port:
ros2 launch rolling_bonxai_ros rolling_bonxai_mapping.launch.py \
container_name:=my_container \
foxglove_port:=8765The launch file will:
rclcpp_components containerRollingBonxai::RollingBonxaiServer into that containerPoint cloud source: The node subscribes to the topic defined in
topic_in(default:/zed/zed_node/point_cloud/cloud_registered). Make sure your sensor driver is running and publishing to this topic before or alongside this launch file.
For simpler setups or debugging, run the standalone binary directly:
ros2 run rolling_bonxai_ros rolling_bonxai_server_node \
--ros-args --params-file /path/to/rolling_bonxai_params.yamlOr pass parameters individually:
ros2 run rolling_bonxai_ros rolling_bonxai_server_node \
--ros-args \
-p frame_id:=map \
-p topic_in:=/your/pointcloud/topic \
-p occupancy.resolution:=0.05The recommended way to configure the node is to provide a YAML parameters file (see rolling_bonxai_ros/params/rolling_bonxai_params.yaml as a template):
ros2 run rolling_bonxai_ros rolling_bonxai_server_node \
--ros-args --params-file rolling_bonxai_params.yamlAll parameters are scoped under rolling_bonxai_server_node/ros__parameters/. The YAML hierarchy below mirrors the parameter file structure.
| Parameter | Type | Default | Unit / Significance |
|---|---|---|---|
frame_id |
string | "map" |
The global fixed frame. All map data is stored in this frame. |
base_frame_id |
string | "base_footprint" |
The robot base frame used for TF lookups. |
topic_in |
string | "/points" |
The sensor_msgs/PointCloud2 topic to subscribe to. Must match your sensor's output topic. |
occupancy.*)| Parameter | Type | Default | Unit / Significance |
|---|---|---|---|
occupancy.resolution |
double | 0.05 |
Meters (m). Side length of each cubic voxel. Smaller = finer detail but higher memory usage. Typical range: 0.02–0.2 m. |
occupancy.occupancy_min_z |
double | -100.0 |
Meters (m). Points below this Z coordinate (in the map frame) are discarded before insertion. Useful to cut out the ground or underground clutter. |
occupancy.occupancy_max_z |
double | 100.0 |
Meters (m). Points above this Z coordinate are discarded. Useful to remove ceiling returns or high-altitude noise. |
occupancy.occupancy_threshold |
double | 0.50 |
Unitless probability [0, 1]. A voxel with log-odds corresponding to this probability is considered on the boundary between occupied and free. Voxels above this are occupied; below are free. The default of 0.5 means equal probability. |
sensor_model.*)These parameters control the Bayesian occupancy update. All probability values are converted internally to log-odds with a fixed-point scale of 1×10⁶.
| Parameter | Type | Default | Unit / Significance |
|---|---|---|---|
sensor_model.max_range |
double | 30.0 |
Meters (m). Points beyond this range are clipped to the maximum range and treated as free-space measurements rather than hits. |
sensor_model.hit |
double | 0.7 |
Unitless probability [0, 1]. Probability that a voxel is occupied given a sensor return. Higher values make the map respond faster to obstacles but may cause noise. |
sensor_model.miss |
double | 0.4 |
Unitless probability [0, 1]. Probability of occupancy given a ray passes through without a return. Lower values clear free space more aggressively. |
sensor_model.min |
double | 0.12 |
Unitless probability [0, 1]. Minimum clamping probability. Prevents a voxel from ever being considered more free than this. Stops the map from being over-confident about free space. |
sensor_model.max |
double | 0.97 |
Unitless probability [0, 1]. Maximum clamping probability. Prevents a voxel from becoming more occupied than this. Allows obstacles to eventually be cleared if the sensor reports free space there. |
rolling.coordinate_system.*)| Parameter | Type | Default | Unit / Significance |
|---|---|---|---|
rolling.coordinate_system.chunk_size |
double | 5.0 |
Meters (m). The side length of each cubic chunk. Each chunk wraps one OccupancyMap. Larger chunks reduce I/O frequency but increase per-chunk memory. Typical range: 2–20 m. |
rolling.transition_manager.*)| Parameter | Type | Default | Unit / Significance |
|---|---|---|---|
rolling.transition_manager.hysteresis_ratio |
double | 0.2 |
Unitless [0.01, 1.0]. Fraction of chunk_size that the robot must penetrate into a new chunk before a chunk transition is confirmed. For example, with chunk_size=5.0 and hysteresis_ratio=0.2, the robot must travel 1.0 m into the new chunk before any load/evict cycle fires. Higher values reduce I/O thrashing near boundaries at the cost of slightly delayed chunk loading. |
rolling.loading_policy.*)| Parameter | Type | Default | Unit / Significance |
|---|---|---|---|
rolling.loading_policy.name |
string | "neighbourhood" |
Unitless string. Selects the chunk management strategy. Options: "neighbourhood", "planar", "temporal". |
Neighbourhood Policy (rolling.loading_policy.neighborhood.*):
| Parameter | Type | Default | Unit / Significance |
|---|---|---|---|
neighborhood.radius |
int | 2 |
Unitless (chunks). Chebyshev radius — loads all chunks within this many chunk-lengths in every direction. Radius 1 → 26 neighbours; radius 2 → 124 neighbours. Increase for faster robots. |
Planar Policy (rolling.loading_policy.planar.*):
| Parameter | Type | Default | Unit / Significance |
|---|---|---|---|
planar.radius |
int | 1 |
Unitless (chunks). Horizontal (XY-plane) Chebyshev radius. Same as neighbourhood radius but applied only on the ground plane. |
planar.z_min |
int | 0 |
Unitless (chunks). Under use_relative=false: minimum absolute Z chunk coordinate to keep loaded. Under use_relative=true: number of chunks below the ego to keep loaded (must be ≥ 0). |
planar.z_max |
int | 2 |
Unitless (chunks). Under use_relative=false: maximum absolute Z chunk coordinate. Under use_relative=true: number of chunks above the ego to keep loaded (must be ≥ 0). |
planar.use_relative |
bool | false |
Unitless boolean. If true, z_min and z_max are relative offsets from the robot's current Z chunk rather than absolute chunk coordinates. Recommended for ground robots that operate at varying elevations. |
Temporal Policy (rolling.loading_policy.temporal.*):
| Parameter | Type | Default | Unit / Significance |
|---|---|---|---|
temporal.radius |
int | 2 |
Unitless (chunks). Chebyshev radius, same as neighbourhood. |
temporal.age_weightage |
double | 0.3 |
Unitless [0.0, 1.0]. Blend factor between distance-based priority (0.0) and age-based priority (1.0). A value of 0.3 means 70% distance priority + 30% freshness priority when ordering load requests. |
temporal.max_age_s |
int | 300 |
Seconds (s). Chunks older than this are considered stale and excluded from loading. Useful in dynamic environments. |
rolling.storage.*)| Parameter | Type | Default | Unit / Significance |
|---|---|---|---|
rolling.storage.full_save_folder_path |
string | "" |
Unitless path string. Full filesystem path where chunk files (.chunk) and timestamp files (.timestamp) are saved to and loaded from. Must be readable and writable by the process. Example: "/home/robot/bonxai_chunks". |
rolling.asyncio.*)| Parameter | Type | Default | Unit / Significance |
|---|---|---|---|
rolling.asyncio.enable_io |
bool | false |
Unitless boolean. Master switch for disk I/O. When false, chunks are never saved or loaded from disk — the map is purely in-memory. Set to true for persistent, large-area mapping. |
rolling.asyncio.num_load_threads |
int | 3 |
Unitless (thread count). Number of dedicated worker threads for loading chunks from disk. Higher values allow more concurrent loads but consume mo |
暂无开放 Issues,或尚未同步最近议题。