supereight2
Loading...
Searching...
No Matches
data.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2022 Smart Robotics Lab, Imperial College London, Technical University of Munich
3 * SPDX-FileCopyrightText: 2021-2022 Nils Funk
4 * SPDX-FileCopyrightText: 2021-2022 Sotiris Papatheodorou
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8#ifndef SE_DATA_HPP
9#define SE_DATA_HPP
10
11#include <array>
13#include <se/map/data_field.hpp>
14#include <se/map/data_id.hpp>
15
16namespace se {
17
18template<Field FldT = Field::TSDF, Colour ColB = Colour::Off, Id IdB = Id::Off>
19struct Data {
23
27
28 struct Config {
29 typename FieldType::Config field;
30 typename ColourType::Config colour;
31 typename IdType::Config id;
32
36 void readYaml(const std::string& yaml_file)
37 {
38 field.readYaml(yaml_file);
39 colour.readYaml(yaml_file);
40 id.readYaml(yaml_file);
41 }
42
43 // The definition of this function MUST be inside the definition of Config for template
44 // argument deduction to work.
45 friend std::ostream& operator<<(std::ostream& os, const Config& c)
46 {
47 os << c.field;
48 os << c.colour;
49 os << c.id;
50 return os;
51 }
52 };
53
54 static constexpr Field fld_ = FldT;
55 static constexpr Colour col_ = ColB;
56 static constexpr Id id_ = IdB;
59};
60
61
62
63namespace data {
64
68template<Field FldT, Colour ColB, Id IdB>
70 const std::array<Data<FldT, ColB, IdB>, 8>& child_data);
71
75template<Field FldT, Colour ColB, Id IdB>
77 const std::array<Data<FldT, ColB, IdB>, 8>& child_min_data);
78
82template<Field FldT, Colour ColB, Id IdB>
84 const std::array<Data<FldT, ColB, IdB>, 8>& child_max_data);
85
86} // namespace data
87
88template<Field FldT, Colour ColB, Id IdB>
90
91template<Colour ColB, Id IdB>
96
97template<Colour ColB, Id IdB>
102
103
104
105template<Field FldT, Colour ColB, Id IdB>
106inline bool is_valid(const Data<FldT, ColB, IdB>& data)
107{
108 return data.field.valid();
109}
110
111
112
113template<Field FldT, Colour ColB, Id IdB>
115
116template<Colour ColB, Id IdB>
118{
119 return data.field.tsdf;
120}
121
122template<Colour ColB, Id IdB>
124{
125 return data.field.occupancy * data.field.weight;
126}
127
128
129
130template<Field FldT, Colour ColB, Id IdB>
131inline bool is_inside(const Data<FldT, ColB, IdB>& data);
132
133template<Colour ColB, Id IdB>
138
139template<Colour ColB, Id IdB>
144
145
146
147// Occupancy data setups
152
153// TSDF data setups
158
159} // namespace se
160
161#include "impl/data_impl.hpp"
162
163#endif // SE_DATA_HPP
Definition image.hpp:19
int up_prop_mean(Data< FldT, ColB, IdB > &parent_data, const std::array< Data< FldT, ColB, IdB >, 8 > &child_data)
Up-propagate the mean of the valid child_data into parent_data and return the number of children with...
int up_prop_min(Data< FldT, ColB, IdB > &parent_min_data, const std::array< Data< FldT, ColB, IdB >, 8 > &child_min_data)
Up-propagate the minimum of the valid child_data into parent_data and return the number of children w...
int up_prop_max(Data< FldT, ColB, IdB > &parent_max_data, const std::array< Data< FldT, ColB, IdB >, 8 > &child_max_data)
Up-propagate the maximum of the valid child_data into parent_data and return the number of children w...
Helper wrapper to allocate and de-allocate octants in the octree.
Definition bounded_vector.hpp:14
float field_t
The type of the stored field (e.g. TSDF, ESDF or occupancy)
Definition type_util.hpp:49
Data< Field::Occupancy, Colour::On, Id::Off > OccupancyColData
Definition data.hpp:149
void set_invalid(Data< FldT, ColB, IdB > &data)
Data< Field::Occupancy, Colour::Off, Id::On > OccupancyIdData
Definition data.hpp:150
Data< Field::TSDF, Colour::Off, Id::Off > TSDFData
Definition data.hpp:154
field_t get_field(const Data< FldT, ColB, IdB > &data)
Data< Field::Occupancy, Colour::On, Id::On > OccupancyColIdData
Definition data.hpp:151
Id
Definition setup_util.hpp:20
Data< Field::TSDF, Colour::On, Id::Off > TSDFColData
Definition data.hpp:155
bool is_valid(const Data< FldT, ColB, IdB > &data)
Definition data.hpp:106
Field
Definition setup_util.hpp:18
bool is_inside(const Data< FldT, ColB, IdB > &data)
Colour
Definition setup_util.hpp:19
Data< Field::TSDF, Colour::Off, Id::On > TSDFIdData
Definition data.hpp:156
Data< Field::Occupancy, Colour::Off, Id::Off > OccupancyData
Definition data.hpp:148
Data< Field::TSDF, Colour::On, Id::On > TSDFColIdData
Definition data.hpp:157
Definition data.hpp:28
void readYaml(const std::string &yaml_file)
Reads the struct members from the "data" node of a YAML file.
Definition data.hpp:36
friend std::ostream & operator<<(std::ostream &os, const Config &c)
Definition data.hpp:45
ColourType::Config colour
Definition data.hpp:30
IdType::Config id
Definition data.hpp:31
FieldType::Config field
Definition data.hpp:29
Definition data.hpp:19
ColourType colour
Definition data.hpp:25
IdType id
Definition data.hpp:26
FieldType field
Definition data.hpp:24
IdData< IdB > IdType
Definition data.hpp:22
static constexpr bool normals_along_gradient
Definition data.hpp:57
ColourData< ColB > ColourType
Definition data.hpp:21
static constexpr field_t surface_boundary
Definition data.hpp:58
static constexpr Colour col_
Definition data.hpp:55
static constexpr Field fld_
Definition data.hpp:54
static constexpr Id id_
Definition data.hpp:56
FieldData< FldT > FieldType
Definition data.hpp:20