Function navmap_ros::from_occupancy_grid
Defined in File conversions.hpp
Function Documentation
-
navmap::NavMap navmap_ros::from_occupancy_grid(const nav_msgs::msg::OccupancyGrid &grid)
Build a
navmap::NavMapfrom anav_msgs::msg::OccupancyGridusing a regular triangular surface with shared vertices.Vertex layout follows the grid indexation with shared vertices across adjacent cells.
Triangle winding and diagonal split are deterministic (pattern = 0).
If
width == 0orheight == 0, the returned map contains no triangles.
Note
The grid origin pose may contain a rotation. The vertex Z is taken from the origin Z; handling of non-zero yaw/roll/pitch (if any) is implementation-defined in the builder.
- Parameters:
grid – [in] Input ROS OccupancyGrid (row-major, width×height, resolution and origin).
- Returns:
A core
navmap::NavMapwith:Vertices:
(W+1) * (H+1)laid on the grid plane, withZ = grid.info.origin.position.z.Triangles:
2 * W * H(two per cell), using diagonal pattern = 0.One surface whose frame matches
grid.header.frame_id, and grid metadata filled.A per-NavCel layer named
"occupancy"of typeuint8, with values mapped as:-1 → 255(unknown),0..100 → 0..254(linear scaling).