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 
double hResolution
Horizontal resolution of used laser scanner.
Definition: ScanTypes.hpp:69
double startTime
Start timestamp.
Definition: ScanTypes.hpp:75
void convert(COORD_SYSTEM from, COORD_SYSTEM to, float *point)
static bool decode(const Node &node, lvr2::Scan &scan)
Definition: Scan.hpp:55
static constexpr char sensorType[]
Definition: ScanTypes.hpp:42
Transform< double > Transformd
4x4 double precision transformation matrix
Definition: MatrixTypes.hpp:71
double endTime
End timestamp.
Definition: ScanTypes.hpp:78
Transformd poseEstimation
Pose estimation of this scan in project coordinates.
Definition: ScanTypes.hpp:51
double phiMax
Max vertical scan angle.
Definition: ScanTypes.hpp:66
double vResolution
Vertical resolution of used laser scanner.
Definition: ScanTypes.hpp:72
Transformd registration
Registration of this scan in project coordinates.
Definition: ScanTypes.hpp:48
double phiMin
Min vertical scan angle.
Definition: ScanTypes.hpp:63
size_t numPoints
Number of points in scan.
Definition: ScanTypes.hpp:94
double thetaMax
Max horizontal scan angle.
Definition: ScanTypes.hpp:60
static Node encode(const lvr2::Scan &scan)
Definition: Scan.hpp:26
double thetaMin
Min horizontal scan angle.
Definition: ScanTypes.hpp:57


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 Mon Feb 28 2022 22:46:09