15 #ifndef NAV2_MAP_SERVER__VECTOR_OBJECT_UTILS_HPP_
16 #define NAV2_MAP_SERVER__VECTOR_OBJECT_UTILS_HPP_
18 #include <uuid/uuid.h>
22 #include "rclcpp/rclcpp.hpp"
23 #include "nav_msgs/msg/occupancy_grid.hpp"
25 #include "nav2_ros_common/lifecycle_node.hpp"
26 #include "nav2_ros_common/node_utils.hpp"
27 #include "nav2_util/occ_grid_values.hpp"
29 namespace nav2_map_server
39 inline std::string unparseUUID(
const unsigned char * uuid)
42 uuid_unparse(uuid, uuid_str);
43 return std::string(uuid_str);
49 enum class OverlayType : uint8_t
63 inline void processVal(
64 int8_t & map_val,
const int8_t shape_val,
65 const OverlayType overlay_type)
67 switch (overlay_type) {
68 case OverlayType::OVERLAY_SEQ:
71 case OverlayType::OVERLAY_MAX:
72 if (shape_val > map_val) {
76 case OverlayType::OVERLAY_MIN:
77 if ((map_val == nav2_util::OCC_GRID_UNKNOWN || shape_val < map_val) &&
78 shape_val != nav2_util::OCC_GRID_UNKNOWN)
84 throw std::runtime_error{
"Unknown overlay type"};
95 inline void processCell(
96 nav_msgs::msg::OccupancyGrid::SharedPtr map,
97 const unsigned int offset,
98 const int8_t shape_val,
99 const OverlayType overlay_type)
101 int8_t map_val = map->data[offset];
102 processVal(map_val, shape_val, overlay_type);
103 map->data[offset] = map_val;
117 nav_msgs::msg::OccupancyGrid::SharedPtr map,
118 int8_t value, OverlayType overlay_type)
133 nav_msgs::msg::OccupancyGrid::SharedPtr
map_;
Functor class used in raytraceLine algorithm.
OverlayType overlay_type_
Overlay type.
void operator()(unsigned int offset)
Map' cell updating operator.
MapAction(nav_msgs::msg::OccupancyGrid::SharedPtr map, int8_t value, OverlayType overlay_type)
MapAction constructor.
nav_msgs::msg::OccupancyGrid::SharedPtr map_
Output map pointer.
int8_t value_
Value to put on map.