Go to the documentation of this file.
15 #ifndef BELUGA_SENSOR_DATA_OCCUPANCY_GRID_HPP
16 #define BELUGA_SENSOR_DATA_OCCUPANCY_GRID_HPP
24 #include <range/v3/view/enumerate.hpp>
25 #include <range/v3/view/filter.hpp>
26 #include <range/v3/view/transform.hpp>
84 template <
typename Derived>
96 [[nodiscard]]
bool free_at(std::size_t index)
const {
97 const auto data = this->
self().
data_at(index);
98 if (!data.has_value()) {
101 return this->
self().value_traits().is_free(data.value());
111 [[nodiscard]]
bool free_at(
int xi,
int yi)
const {
return this->
self().
free_at(this->
self().index_at(xi, yi)); }
119 [[nodiscard]]
bool free_at(
const Eigen::Vector2i& pi)
const {
return this->
self().
free_at(pi.x(), pi.y()); }
128 [[nodiscard]]
bool free_near(
double x,
double y)
const {
129 return this->
self().
free_at(this->
self().cell_near(Eigen::Vector2d{x, y}));
138 [[nodiscard]]
bool free_near(
const Eigen::Vector2d& p)
const {
return this->
self().
free_near(p.x(), p.y()); }
151 position = this->
self().origin() * position;
162 template <
class Range>
164 return cells | ranges::views::transform(
165 [
this, frame](
const auto& cell) {
return this->
self().
coordinates_at(cell, frame); });
170 return ranges::views::enumerate(this->
self().data()) |
171 ranges::views::filter([value_traits = this->
self().value_traits()](
const auto& tuple) {
172 return value_traits.is_free(std::get<1>(tuple));
174 ranges::views::transform([](
const auto& tuple) {
return std::get<0>(tuple); });
179 return this->
self().data() |
180 ranges::views::transform([value_traits = this->
self().value_traits()](
const auto& value) {
181 return value_traits.is_occupied(value);
Linear 2D grid base type.
auto coordinates_at(std::size_t index, Frame frame) const
Compute plane coordinates given grid cell coordinates.
bool free_near(const Eigen::Vector2d &p) const
Checks if nearest cell is free.
bool free_at(const Eigen::Vector2i &pi) const
Checks if cell is free.
Concepts and abstract implementations of linear (ie. contiguous storage) grids.
bool free_near(double x, double y) const
Checks if nearest cell is free.
bool free_at(std::size_t index) const
Checks if cell is free.
Occupancy 2D grid base type.
auto obstacle_data() const
Retrieves grid data using true booleans for obstacles.
auto coordinates_for(Range &&cells, Frame frame) const
Compute plane coordinates for a range of grid cells.
auto free_cells() const
Retrieves range of free grid cell indices.
bool free_at(int xi, int yi) const
Checks if cell is free.
auto data_at(std::size_t index) const
Gets cell data, if included.
The main Beluga namespace.
beluga
Author(s):
autogenerated on Tue Jul 16 2024 02:59:53