supereight
Loading...
Searching...
No Matches
ray_integrator.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020-2022 Smart Robotics Lab, Imperial College London, Technical University of Munich
3 * SPDX-FileCopyrightText: 2022-2024 Simon Boche
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef SE_RAY_INTEGRATOR_HPP
8#define SE_RAY_INTEGRATOR_HPP
9
11#include <set>
12#include <unordered_set>
13
14namespace se {
15
17
18template<typename MapT, typename SensorT>
20 public:
21 RayIntegrator(MapT& /* map */,
22 const SensorT& /* sensor */,
23 const Eigen::Vector3f& /*ray*/,
24 const Eigen::Isometry3f& /* T_SW need Lidar frame?*/,
25 const timestamp_t /* timestamp */,
26 std::set<const OctantBase*>* const /*updated_octants = nullptr*/){};
27
28 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
29};
30
31template<se::Colour ColB, se::Semantics SemB, int BlockSize, typename SensorT>
33 SensorT> {
34 public:
36 typedef typename MapType::DataType DataType;
37 typedef typename MapType::OctreeType OctreeType;
38 typedef typename MapType::OctreeType::NodeType NodeType;
39 typedef typename MapType::OctreeType::BlockType BlockType;
40
46 struct RayIntegratorConfig {
48 sigma_min(map.getDataConfig().field.sigma_min_factor * map.getRes()),
49 sigma_max(map.getDataConfig().field.sigma_max_factor * map.getRes()),
50 tau_min(map.getDataConfig().field.tau_min_factor * map.getRes()),
51 tau_max(map.getDataConfig().field.tau_max_factor * map.getRes())
52 {
53 }
54
55 const float sigma_min;
56 const float sigma_max;
57 const float tau_min;
58 const float tau_max;
59 };
60
61
72 const SensorT& sensor,
73 const Eigen::Vector3f& ray,
74 const Eigen::Isometry3f& T_WS,
75 const timestamp_t timestamp,
76 std::set<const OctantBase*>* const updated_octants = nullptr);
77
88 bool resetIntegrator(const Eigen::Vector3f& ray,
89 const Eigen::Isometry3f& T_WS,
90 const timestamp_t timestamp,
91 bool skip_check = false);
92
98 void operator()();
99
105
107
117
118 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
119
120 private:
132 template<class SensorTDummy = SensorT>
133 typename std::enable_if_t<std::is_same<SensorTDummy, se::LeicaLidar>::value, void>
134 operator()(const Eigen::Vector3f& ray_sample,
135 const Eigen::Vector3i& voxel_coord,
138
139
144 void updateBlock(se::OctantBase* octant_ptr,
145 Eigen::Vector3i& voxel_coords,
146 int desired_scale,
147 float sample_dist);
148
149 MapType& map_;
150 OctreeType& octree_;
151 const SensorT& sensor_;
152
153 std::vector<std::set<se::OctantBase*>> node_set_;
154 std::vector<se::OctantBase*> updated_blocks_vector_;
155 std::set<se::OctantBase*> updated_blocks_set_; // ToDo rename: updated_octants_;?
156 std::set<const se::OctantBase*>* updated_octants_ = nullptr;
157 RayIntegratorConfig config_;
158
159 Eigen::Isometry3f T_SW_;
160 Eigen::Vector3f ray_;
161 Eigen::Vector3i last_visited_voxel_;
162
163 const float map_res_;
164
165 int free_space_scale_ = 0;
166 int computed_integration_scale_ = 0;
167 timestamp_t timestamp_;
168
169 // Sensor Model - Tau and Sigma
170 float ray_dist_ = 0.;
171 float tau_ = 0.;
172 float three_sigma_ = 0.;
173};
174
175} // namespace se
176#include "impl/ray_integrator_impl.hpp"
177
178#endif // SE_RAY_INTEGRATOR_HPP
Definition image.hpp:19
Definition map.hpp:27
The base class of all octants (se::Node and se::Block) in an se::Octree.
Definition octant.hpp:19
bool resetIntegrator(const Eigen::Vector3f &ray, const Eigen::Isometry3f &T_WS, const timestamp_t timestamp, bool skip_check=false)
Reset ray, pose and timestamp for the integrator.
se::RayState computeVariance(const float ray_step_depth)
Return a conservative measure of the expected variance of a sensor model inside a voxel given its pos...
RayIntegrator(MapType &map, const SensorT &sensor, const Eigen::Vector3f &ray, const Eigen::Isometry3f &T_WS, const timestamp_t timestamp, std::set< const OctantBase * > *const updated_octants=nullptr)
Setup the single ray carver.
Map< Data< se::Field::Occupancy, ColB, SemB >, se::Res::Multi, BlockSize > MapType
Definition ray_integrator.hpp:35
void operator()()
Allocate and update along the ray using a step size depending on the chosen resolution.
Definition ray_integrator.hpp:19
RayIntegrator(MapT &, const SensorT &, const Eigen::Vector3f &, const Eigen::Isometry3f &, const timestamp_t, std::set< const OctantBase * > *const)
Definition ray_integrator.hpp:21
Helper wrapper to allocate and de-allocate octants in the octree.
Definition bounded_vector.hpp:14
RayState
Definition ray_integrator.hpp:16
Definition data.hpp:19