15 #ifndef SIMPLE_SENSOR_SIMULATOR__SENSOR_SIMULATION__OCCUPANCY_GRID__OCCUPANCY_GRID_BUILDER_HPP_
16 #define SIMPLE_SENSOR_SIMULATOR__SENSOR_SIMULATION__OCCUPANCY_GRID__OCCUPANCY_GRID_BUILDER_HPP_
19 #include <geometry_msgs/msg/point.hpp>
20 #include <geometry_msgs/msg/pose.hpp>
31 using MarkerCounterType = int16_t;
32 using MarkerGridType = std::vector<MarkerCounterType>;
33 using OccupancyGridType = std::vector<int8_t>;
34 using PointType = geometry_msgs::msg::Point;
35 using PoseType = geometry_msgs::msg::Pose;
37 using PolygonType = std::vector<PointType>;
60 auto reset(
const PoseType & origin) -> void;
70 auto get() const -> const OccupancyGridType &;
81 MarkerCounterType primitive_count_ = 0;
87 MarkerGridType occupied_grid_;
93 MarkerGridType invisible_grid_;
99 OccupancyGridType values_;
105 std::vector<int32_t> min_cols_, max_cols_;
112 inline auto addPolygon(MarkerGridType & grid, const PolygonType & convex_hull) ->
void;
119 inline auto transformToGrid(const PointType & world_point) const -> PointType;
126 inline auto transformToPixel(const PointType & grid_point) const -> PointType;
135 inline auto makePoint(
double x,
double y,
double z = 0) const -> PointType;
142 inline auto makeOccupiedArea(const
PrimitiveType & primitive) const -> PolygonType;
149 inline auto makeInvisibleArea(const PolygonType & occupied_polygon) const -> PolygonType;
grid
Definition: occupancy_grid_builder.hpp:30
const int8_t invisible_cost
Definition: occupancy_grid_builder.hpp:48
auto reset(const PoseType &origin) -> void
Reset all internal state.
Definition: occupancy_grid_builder.cpp:303
const int8_t occupied_cost
Definition: occupancy_grid_builder.hpp:47
auto build() -> void
Build occupancy grid.
Definition: occupancy_grid_builder.cpp:276
const double resolution
Definition: occupancy_grid_builder.hpp:44
const size_t height
Definition: occupancy_grid_builder.hpp:45
OccupancyGridBuilder(double resolution, size_t height, size_t width, int8_t occupied_cost=100, int8_t invisible_cost=50)
Definition: occupancy_grid_builder.cpp:23
const size_t width
Definition: occupancy_grid_builder.hpp:46
auto get() const -> const OccupancyGridType &
Definition: occupancy_grid_builder.cpp:301
auto add(const PrimitiveType &primitive) -> void
Mark invisible area and occupied area of primitive.
Definition: occupancy_grid_builder.cpp:255
Definition: primitive.hpp:51
Definition: constants.hpp:19