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
YAML
Definition: LSROptionsYamlExtensions.hpp:42
options
const kaboom::Options * options
Definition: src/tools/lvr2_kaboom/Main.cpp:45
lvr2::convert
void convert(COORD_SYSTEM from, COORD_SYSTEM to, float *point)
Definition: CoordinateTransform.cpp:46
SLAMOptions.hpp
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::SLAMOptions
A struct to configure SLAMAlign.
Definition: SLAMOptions.hpp:45
YAML::convert< lvr2::SLAMOptions >::encode
static Node encode(const lvr2::SLAMOptions &options)
Definition: SLAMOptionsYamlExtensions.hpp:47
YAML::convert< lvr2::SLAMOptions >::decode
static bool decode(const Node &node, lvr2::SLAMOptions &options)
Definition: SLAMOptionsYamlExtensions.hpp:90


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:25