NavMap
|
#include <gtest/gtest.h>
#include <nav_msgs/msg/occupancy_grid.hpp>
#include "navmap_ros_interfaces/msg/nav_map_layer.hpp"
#include "navmap_ros_interfaces/msg/nav_map.hpp"
#include "navmap_ros/conversions.hpp"
#include "navmap_core/NavMap.hpp"
Functions | |
navmap::NavMap | from_occupancy_grid (const nav_msgs::msg::OccupancyGrid &grid) |
Build a navmap::NavMap from a nav_msgs::msg::OccupancyGrid using a regular triangular surface with shared vertices. | |
TEST (NavMap_FullConversions, EmptyMap_RoundTrip) | |
TEST (NavMap_FullConversions, RoundTrip_All) | |
TEST (NavMap_LayerConversions, F32_RoundTrip) | |
TEST (NavMap_LayerConversions, F64_RoundTrip) | |
TEST (NavMap_LayerConversions, ToMsg_Throws_OnMissingLayer) | |
TEST (NavMap_LayerConversions, U8_RoundTrip) | |
TEST (TestConversions, RoundTrip_ExactEquality_4m_0p1) | |
TEST (TestConversions, TriangleIndicesFollowPattern0) | |
nav_msgs::msg::OccupancyGrid | to_occupancy_grid (const navmap::NavMap &nm) |
Convert a navmap::NavMap back to nav_msgs::msg::OccupancyGrid . | |
navmap::NavMap from_occupancy_grid | ( | const nav_msgs::msg::OccupancyGrid & | grid | ) |
Build a navmap::NavMap
from a nav_msgs::msg::OccupancyGrid
using a regular triangular surface with shared vertices.
[in] | grid | Input ROS OccupancyGrid (row-major, width×height, resolution and origin). |
navmap::NavMap
with:(W+1) * (H+1)
laid on the grid plane, with Z = grid.info.origin.position.z
.2 * W * H
(two per cell), using diagonal pattern = 0.grid.header.frame_id
, and grid metadata filled."occupancy"
of type uint8
, with values mapped as: -1 → 255
(unknown), 0..100 → 0..254
(linear scaling).width == 0
or height == 0
, the returned map contains no triangles.TEST | ( | NavMap_FullConversions | , |
EmptyMap_RoundTrip | ) |
TEST | ( | NavMap_FullConversions | , |
RoundTrip_All | ) |
TEST | ( | NavMap_LayerConversions | , |
F32_RoundTrip | ) |
TEST | ( | NavMap_LayerConversions | , |
F64_RoundTrip | ) |
TEST | ( | NavMap_LayerConversions | , |
ToMsg_Throws_OnMissingLayer | ) |
TEST | ( | NavMap_LayerConversions | , |
U8_RoundTrip | ) |
TEST | ( | TestConversions | , |
RoundTrip_ExactEquality_4m_0p1 | ) |
TEST | ( | TestConversions | , |
TriangleIndicesFollowPattern0 | ) |
nav_msgs::msg::OccupancyGrid to_occupancy_grid | ( | const navmap::NavMap & | nm | ) |
Convert a navmap::NavMap
back to nav_msgs::msg::OccupancyGrid
.
[in] | nm | Core NavMap to be rasterized as an occupancy grid. |
OccupancyGrid
populated from nm
.Two paths are considered:
"occupancy"
layer of type U8 with size 2 * W * H
, the function reconstructs an OccupancyGrid
exactly (linear inverse mapping 0..254 → 0..100
, 255 → -1
).locate_navcel
) and reads "occupancy"
values to populate the grid."occupancy"
layer. The precise sampling strategy (bounds, resolution, and handling of cells without a containing navcel) is implementation-defined."occupancy"
layer is missing, the result may be incomplete or implementation-defined.