15 #ifndef NAV2_MAP_SERVER__VECTOR_OBJECT_UTILS_HPP_
16 #define NAV2_MAP_SERVER__VECTOR_OBJECT_UTILS_HPP_
18 #include <uuid/uuid.h>
23 #include "geometry_msgs/msg/transform_stamped.hpp"
24 #include "nav_msgs/msg/occupancy_grid.hpp"
25 #include "std_msgs/msg/header.hpp"
27 #include "nav2_ros_common/lifecycle_node.hpp"
28 #include "nav2_ros_common/tf2_factories.hpp"
29 #include "nav2_ros_common/node_utils.hpp"
30 #include "nav2_util/occ_grid_values.hpp"
32 namespace nav2_map_server
44 bool lookupShapeTransform(
45 const std_msgs::msg::Header & header,
46 const std::string & target_frame,
47 const nav2::TransformBuffer::SharedPtr & tf_buffer,
48 const double transform_tolerance,
49 geometry_msgs::msg::TransformStamped & transform);
58 inline std::string unparseUUID(
const unsigned char * uuid)
61 uuid_unparse(uuid, uuid_str);
62 return std::string(uuid_str);
68 enum class OverlayType : uint8_t
82 inline void processVal(
83 int8_t & map_val,
const int8_t shape_val,
84 const OverlayType overlay_type)
86 switch (overlay_type) {
87 case OverlayType::OVERLAY_SEQ:
90 case OverlayType::OVERLAY_MAX:
91 if (shape_val > map_val) {
95 case OverlayType::OVERLAY_MIN:
96 if ((map_val == nav2_util::OCC_GRID_UNKNOWN || shape_val < map_val) &&
97 shape_val != nav2_util::OCC_GRID_UNKNOWN)
103 throw std::runtime_error{
"Unknown overlay type"};
114 inline void processCell(
115 const nav_msgs::msg::OccupancyGrid::SharedPtr & map,
116 const unsigned int offset,
117 const int8_t shape_val,
118 const OverlayType overlay_type)
120 processVal(map->data[offset], shape_val, overlay_type);
134 nav_msgs::msg::OccupancyGrid::SharedPtr map,
135 int8_t value, OverlayType overlay_type)
150 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.