Scan.hpp
Go to the documentation of this file.
1 
2 #ifndef LVR2_IO_YAML_SCANMETA_IO_HPP
3 #define LVR2_IO_YAML_SCANMETA_IO_HPP
4 
5 #include <yaml-cpp/yaml.h>
7 #include "lvr2/io/Timestamp.hpp"
8 #include "MatrixIO.hpp"
9 
10 namespace YAML {
11 
18 // WRITE SCAN PARTIALLY
19 template <>
20 struct convert<lvr2::Scan>
21 {
22 
26  static Node encode(const lvr2::Scan& scan) {
27  Node node;
28 
29  node["sensor_type"] = lvr2::Scan::sensorType;
30 
31  node["start_time"] = scan.startTime;
32  node["end_time"] = scan.endTime;
33 
34  node["pose_estimate"] = scan.poseEstimation;
35  node["registration"] = scan.registration;
36 
37  Node config;
38  config["theta"] = Load("[]");
39  config["theta"].push_back(scan.thetaMin);
40  config["theta"].push_back(scan.thetaMax);
41 
42  config["phi"] = Load("[]");
43  config["phi"].push_back(scan.phiMin);
44  config["phi"].push_back(scan.phiMax);
45 
46  config["v_res"] = scan.vResolution;
47  config["h_res"] = scan.hResolution;
48 
49  config["num_points"] = scan.numPoints;
50  node["config"] = config;
51 
52  return node;
53  }
54 
55  static bool decode(const Node& node, lvr2::Scan& scan) {
56 
57  if(node["sensor_type"].as<std::string>() != lvr2::Scan::sensorType)
58  {
59  return false;
60  }
61 
62  scan.startTime = node["start_time"].as<double>();
63  scan.endTime = node["end_time"].as<double>();
64  scan.poseEstimation = node["pose_estimate"].as<lvr2::Transformd>();
65  scan.registration = node["registration"].as<lvr2::Transformd>();
66 
67  const Node& config = node["config"];
68 
69 
70  scan.thetaMin = config["theta"][0].as<double>();
71  scan.thetaMax = config["theta"][1].as<double>();
72 
73  scan.phiMin = config["phi"][0].as<double>();
74  scan.phiMax = config["phi"][1].as<double>();
75 
76 
77  scan.vResolution = config["v_res"].as<double>();
78  scan.hResolution = config["h_res"].as<double>();
79 
80  scan.numPoints = config["num_points"].as<size_t>();
81 
82 
83  return true;
84  }
85 
86 };
87 
88 } // namespace YAML
89 
90 #endif // LVR2_IO_YAML_SCANMETA_IO_HPP
91 
lvr2::Scan::numPoints
size_t numPoints
Number of points in scan.
Definition: ScanTypes.hpp:96
lvr2::Transformd
Transform< double > Transformd
4x4 double precision transformation matrix
Definition: MatrixTypes.hpp:71
YAML::convert< lvr2::Scan >::decode
static bool decode(const Node &node, lvr2::Scan &scan)
Definition: Scan.hpp:55
lvr2::Scan::hResolution
double hResolution
Horizontal resolution of used laser scanner.
Definition: ScanTypes.hpp:71
lvr2::Scan::poseEstimation
Transformd poseEstimation
Pose estimation of this scan in project coordinates.
Definition: ScanTypes.hpp:53
YAML
Definition: LSROptionsYamlExtensions.hpp:42
YAML::convert< lvr2::Scan >::encode
static Node encode(const lvr2::Scan &scan)
Definition: Scan.hpp:26
lvr2::Scan::endTime
double endTime
End timestamp
Definition: ScanTypes.hpp:80
ScanTypes.hpp
lvr2::Scan
Definition: ScanTypes.hpp:24
lvr2::Scan::phiMax
double phiMax
Max vertical scan angle.
Definition: ScanTypes.hpp:68
lvr2::convert
void convert(COORD_SYSTEM from, COORD_SYSTEM to, float *point)
Definition: CoordinateTransform.cpp:46
lvr2::Scan::startTime
double startTime
Start timestamp.
Definition: ScanTypes.hpp:77
lvr2::Scan::thetaMin
double thetaMin
Min horizontal scan angle.
Definition: ScanTypes.hpp:59
MatrixIO.hpp
lvr2::Scan::sensorType
static constexpr char sensorType[]
Definition: ScanTypes.hpp:44
lvr2::Scan::registration
Transformd registration
Registration of this scan in project coordinates.
Definition: ScanTypes.hpp:50
lvr2
Definition: BaseBufferManipulators.hpp:39
Timestamp.hpp
lvr2::Scan::thetaMax
double thetaMax
Max horizontal scan angle.
Definition: ScanTypes.hpp:62
lvr2::Scan::phiMin
double phiMin
Min vertical scan angle.
Definition: ScanTypes.hpp:65
lvr2::Scan::vResolution
double vResolution
Vertical resolution of used laser scanner.
Definition: ScanTypes.hpp:74


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:24