SLAMOptionsYamlExtensions.hpp
Go to the documentation of this file.
1 
35 #ifndef LVR2_SLAM_OPTIONS_YAML_EXTENSIONS
36 #define LVR2_SLAM_OPTIONS_YAML_EXTENSIONS
37 
38 #include <yaml-cpp/yaml.h>
39 
41 
42 namespace YAML
43 {
44 template<>
45 struct convert<lvr2::SLAMOptions>
46 {
47  static Node encode(const lvr2::SLAMOptions& options)
48  {
49  Node node;
50 
51  // ==================== General Options ======================================================
52 
53  node["trustPose"] = options.trustPose;
54  node["metascan"] = options.metascan;
55  node["createFrames"] = options.createFrames;
56  node["verbose"] = options.verbose;
57  node["useHDF"] = options.useHDF;
58 
59  // ==================== Reduction Options ====================================================
60 
61  node["reduction"] = options.reduction;
62  node["minDistance"] = options.minDistance;
63  node["maxDistance"] = options.maxDistance;
64 
65  // ==================== ICP Options ==========================================================
66 
67  node["icpIterations"] = options.icpIterations;
68  node["icpMaxDistance"] = options.icpMaxDistance;
69  node["maxLeafSize"] = options.maxLeafSize;
70  node["epsilon"] = options.epsilon;
71 
72  // ==================== SLAM Options =========================================================
73 
74  node["doLoopClosing"] = options.doLoopClosing;
75  node["doGraphSLAM"] = options.doGraphSLAM;
76  node["closeLoopDistance"] = options.closeLoopDistance;
77  node["closeLoopPairs"] = options.closeLoopPairs;
78  node["loopSize"] = options.loopSize;
79  node["slamIterations"] = options.slamIterations;
80  node["slamMaxDistance"] = options.slamMaxDistance;
81  node["slamEpsilon"] = options.slamEpsilon;
82  node["diffPosition"] = options.diffPosition;
83  node["diffAngle"] = options.diffAngle;
84  node["useScanOrder"] = options.useScanOrder;
85  node["rotate_angle"] = options.rotate_angle;
86 
87  return node;
88  }
89 
90  static bool decode(const Node& node, lvr2::SLAMOptions& options)
91  {
92  if (!node.IsMap())
93  {
94  return false;
95  }
96 
97  // ==================== General Options ======================================================
98 
99  if (node["trustPose"])
100  {
101  options.trustPose = node["trustPose"].as<bool>();
102  }
103 
104  if (node["metascan"])
105  {
106  options.metascan = node["metascan"].as<bool>();
107  }
108 
109  if (node["createFrames"])
110  {
111  options.createFrames = node["createFrames"].as<bool>();
112  }
113 
114  if (node["verbose"])
115  {
116  options.verbose = node["verbose"].as<bool>();
117  }
118 
119  if (node["useHDF"])
120  {
121  options.useHDF = node["useHDF"].as<bool>();
122  }
123 
124  // ==================== Reduction Options ====================================================
125 
126  if (node["reduction"])
127  {
128  options.reduction = node["reduction"].as<double>();
129  }
130 
131  if (node["minDistance"])
132  {
133  options.minDistance = node["minDistance"].as<double>();
134  }
135 
136  if (node["maxDistance"])
137  {
138  options.maxDistance = node["maxDistance"].as<double>();
139  }
140 
141  // ==================== ICP Options ==========================================================
142 
143  if (node["icpIterations"])
144  {
145  options.icpIterations = node["icpIterations"].as<int>();
146  }
147 
148  if (node["icpMaxDistance"])
149  {
150  options.icpMaxDistance = node["icpMaxDistance"].as<double>();
151  }
152 
153  if (node["maxLeafSize"])
154  {
155  options.maxLeafSize = node["maxLeafSize"].as<int>();
156  }
157 
158  if (node["epsilon"])
159  {
160  options.epsilon = node["epsilon"].as<double>();
161  }
162 
163  // ==================== SLAM Options =========================================================
164 
165  if (node["doLoopClosing"])
166  {
167  options.doLoopClosing = node["doLoopClosing"].as<bool>();
168  }
169 
170  if (node["doGraphSLAM"])
171  {
172  options.doGraphSLAM = node["doGraphSLAM"].as<bool>();
173  }
174 
175  if (node["closeLoopDistance"])
176  {
177  options.closeLoopDistance = node["closeLoopDistance"].as<double>();
178  }
179 
180  if (node["closeLoopPairs"])
181  {
182  options.closeLoopPairs = node["closeLoopPairs"].as<int>();
183  }
184 
185  if (node["loopSize"])
186  {
187  options.loopSize = node["loopSize"].as<int>();
188  }
189 
190  if (node["slamIterations"])
191  {
192  options.slamIterations = node["slamIterations"].as<int>();
193  }
194 
195  if (node["slamMaxDistance"])
196  {
197  options.slamMaxDistance = node["slamMaxDistance"].as<double>();
198  }
199 
200  if (node["slamEpsilon"])
201  {
202  options.slamEpsilon = node["slamEpsilon"].as<double>();
203  }
204 
205  if (node["diffPosition"])
206  {
207  options.diffPosition = node["diffPosition"].as<double>();
208  }
209 
210  if (node["diffAngle"])
211  {
212  options.diffAngle = node["diffAngle"].as<double>();
213  }
214 
215  if (node["useScanOrder"])
216  {
217  options.useScanOrder = node["useScanOrder"].as<bool>();
218  }
219 
220  if (node["rotate_angle"])
221  {
222  options.rotate_angle = node["rotate_angle"].as<double>();
223  }
224 
225  return true;
226  }
227 };
228 } // namespace YAML
229 
230 #endif
double minDistance
Ignore all Points closer than to the origin of a scan.
Definition: SLAMOptions.hpp:70
double slamEpsilon
The epsilon difference of SLAM corrections for the stop criterion of SLAM.
double reduction
The Voxel size for Octree based reduction.
Definition: SLAMOptions.hpp:67
double rotate_angle
rotate this angle around y axis
bool trustPose
Use the unmodified Pose of new Scans. If false, apply the relative refinement of previous Scans...
Definition: SLAMOptions.hpp:50
const kaboom::Options * options
bool createFrames
Keep track of all previous Transformations of Scans for Animation purposes like &#39;show&#39; from slam6D...
Definition: SLAMOptions.hpp:56
double epsilon
The epsilon difference between ICP-errors for the stop criterion of ICP.
Definition: SLAMOptions.hpp:88
void convert(COORD_SYSTEM from, COORD_SYSTEM to, float *point)
A struct to configure SLAMAlign.
Definition: SLAMOptions.hpp:45
bool verbose
Show more detailed output. Useful for fine-tuning Parameters or debugging.
Definition: SLAMOptions.hpp:59
int slamIterations
Number of ICP iterations during Loopclosing and number of GraphSLAM iterations.
bool useHDF
Indicates if a HDF file containing the scans should be used.
Definition: SLAMOptions.hpp:62
static Node encode(const lvr2::SLAMOptions &options)
static bool decode(const Node &node, lvr2::SLAMOptions &options)
double diffAngle
max difference of angle (sum of 3 angles) new and old
double slamMaxDistance
The maximum distance between two points during SLAM.
bool useScanOrder
use scan order as icp order (if false: start with lowest distance)
int maxLeafSize
The maximum number of Points in a Leaf of a KDTree.
Definition: SLAMOptions.hpp:85
double diffPosition
max difference of position (euclidean distance) new and old
double icpMaxDistance
The maximum distance between two points during ICP.
Definition: SLAMOptions.hpp:82
bool doGraphSLAM
Use complex Loopclosing with GraphSLAM.
Definition: SLAMOptions.hpp:96
double maxDistance
Ignore all Points farther away than from the origin of a scan.
Definition: SLAMOptions.hpp:73
bool metascan
Match scans to the combined Pointcloud of all previous Scans instead of just the last Scan...
Definition: SLAMOptions.hpp:53
bool doLoopClosing
Use simple Loopclosing.
Definition: SLAMOptions.hpp:93


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