supereight
multires_ofusion_updater.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2019-2021 Smart Robotics Lab, Imperial College London, Technical University of Munich
3  * SPDX-FileCopyrightText: 2019-2021 Nils Funk
4  * SPDX-FileCopyrightText: 2021 Sotiris Papatheodorou
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef SE_MULTIRES_OFUSION_UPDATER_HPP
9 #define SE_MULTIRES_OFUSION_UPDATER_HPP
10 
11 
12 
13 #include "se/sensor/sensor.hpp"
14 
15 
16 
17 namespace se {
18 
19 
20 
21 // Multi-res Occupancy updater
22 template<se::Colour ColB, se::Semantics SemB, int BlockSize, typename SensorT>
23 class Updater<Map<Data<se::Field::Occupancy, ColB, SemB>, se::Res::Multi, BlockSize>, SensorT> {
24  public:
26  typedef typename MapType::DataType DataType;
27  typedef typename MapType::OctreeType OctreeType;
28  typedef typename MapType::OctreeType::NodeType NodeType;
29  typedef typename MapType::OctreeType::BlockType BlockType;
30 
31 
32  struct UpdaterConfig {
33  UpdaterConfig(const MapType& map) :
34  sigma_min(map.getRes() * map.getDataConfig().sigma_min_factor),
35  sigma_max(map.getRes() * map.getDataConfig().sigma_max_factor),
36  tau_min(map.getRes() * map.getDataConfig().tau_min_factor),
37  tau_max(map.getRes() * map.getDataConfig().tau_max_factor)
38  {
39  }
40 
41  const float sigma_min;
42  const float sigma_max;
43  const float tau_min;
44  const float tau_max;
45  };
46 
54  Updater(MapType& map,
55  const SensorT& sensor,
56  const se::Image<float>& depth_img,
57  const Eigen::Matrix4f& T_WS,
58  const int frame);
59 
60  void operator()(se::VolumeCarverAllocation& allocation_list);
61 
62  private:
66  void propagateToRoot(std::vector<se::OctantBase*>& block_list);
67 
68  void freeBlock(se::OctantBase* octant_ptr);
69 
79  void updateBlock(se::OctantBase* octant_ptr, bool low_variance, bool project_inside);
80 
81 
85  void freeNodeRecurse(se::OctantBase* octant_ptr, int depth);
86 
87  private:
88  MapType& map_;
89  OctreeType& octree_;
90  const SensorT& sensor_;
91  const se::Image<float>& depth_img_;
92  const Eigen::Matrix4f T_SW_;
93  const int frame_;
94  const float map_res_;
95  const UpdaterConfig config_;
96  std::vector<std::set<se::OctantBase*>> node_set_;
97  std::vector<se::OctantBase*> freed_block_list_;
98 };
99 
100 
101 
102 } // namespace se
103 
104 #include "impl/multires_ofusion_updater_impl.hpp"
105 
106 #endif // SE_MULTIRES_OFUSION_UPDATER_HPP
Updater(MapT &map, const SensorT &sensor, const se::Image< float > &depth_img, const Eigen::Matrix4f &T_WS, const int frame)
Definition: data.hpp:95
Definition: updater.hpp:18
MapType::OctreeType::BlockType BlockType
Definition: multires_ofusion_updater.hpp:29
Map< Data< se::Field::Occupancy, ColB, SemB >, se::Res::Multi, BlockSize > MapType
Definition: multires_ofusion_updater.hpp:25
This class only helps to dynamic cast the octant to the right type and builds the base of nodes and b...
Definition: octant.hpp:24
Definition: map.hpp:64
void operator()(UpdateListT &updating_list)
Helper wrapper to allocate and de-allocate octants in the octree.
Definition: colour_utils.hpp:17
Definition: volume_carver.hpp:29
MapType::OctreeType::NodeType NodeType
Definition: multires_ofusion_updater.hpp:28