Go to the documentation of this file.
15 #ifndef BELUGA_ALGORITHM_RAYCASTING_HPP
16 #define BELUGA_ALGORITHM_RAYCASTING_HPP
24 #include <range/v3/view/all.hpp>
25 #include <range/v3/view/take_while.hpp>
43 template <
class OccupancyGr
id,
typename Algorithm = Bresenham2i>
51 explicit Ray2d(
const OccupancyGrid& grid,
const Sophus::SE2d& source_pose,
double max_range) noexcept
52 :
Ray2d(grid, Algorithm{}, source_pose, max_range) {}
63 const OccupancyGrid& grid,
66 double max_range) noexcept
84 const auto far_end_pose_in_local_frame =
Sophus::SE2d{r1, r1 * t2 + t1};
85 const auto far_end_cell =
grid_.cell_near(far_end_pose_in_local_frame.translation());
86 const auto cell_is_valid = [
this](
const auto& cell) {
return grid_.contains(cell); };
98 for (
const auto& cell :
trace(bearing)) {
99 if (!
grid_.free_at(cell)) {
101 const auto cell_position =
grid_.coordinates_at(cell);
102 const auto distance = (cell_position - source_position).norm();
103 return std::make_optional(std::min(distance,
max_range_));
const Sophus::SE2d source_pose_in_local_frame_
const Algorithm algorithm_
std::optional< double > cast(const Sophus::SO2d &bearing) const
Casts ray along a given direction.
SOPHUS_FUNC SO2Member & so2()
Implementation of Bresenham-like raytracing algorithms.
const Eigen::Vector2i source_cell_
Ray2d(const OccupancyGrid &grid, const Sophus::SE2d &source_pose, double max_range) noexcept
Constructs 2D ray with default ray tracing algorithm.
const OccupancyGrid & grid_
auto trace(const Sophus::SO2d &bearing) const
Computes ray trace along a given direction.
SOPHUS_FUNC TranslationMember & translation()
Ray2d(const OccupancyGrid &grid, Algorithm algorithm, const Sophus::SE2d &source_pose, double max_range) noexcept
Constructs 2D ray with an specific ray tracing algorithm.
The main Beluga namespace.
SOPHUS_FUNC ComplexMember const & unit_complex() const
beluga
Author(s):
autogenerated on Tue Jul 16 2024 02:59:53