YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FakeDepthCameraDriver_ParamsParser.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6
7// Generated by yarpDeviceParamParserGenerator (2.2)
8// This is an automatically generated file. Please do not edit it.
9// It will be re-generated if the cmake flag ALLOW_DEVICE_PARAM_PARSER_GENERATION is ON.
10
11// Generated on: Tue Jul 28 23:33:12 2026
12
13
15#include <yarp/os/LogStream.h>
16#include <yarp/os/Value.h>
17
18namespace {
19 YARP_LOG_COMPONENT(FakeDepthCameraDriverParamsCOMPONENT, "yarp.device.FakeDepthCameraDriver")
20}
21
22
26
27
29{
30 std::vector<std::string> params;
31 params.push_back("rgb_h");
32 params.push_back("rgb_w");
33 params.push_back("dep_h");
34 params.push_back("dep_w");
35 params.push_back("accuracy");
36 params.push_back("rgb_Vfov");
37 params.push_back("rgb_Hfov");
38 params.push_back("dep_Vfov");
39 params.push_back("dep_Hfov");
40 params.push_back("dep_near");
41 params.push_back("dep_far");
42 params.push_back("test_distance_constant");
43 return params;
44}
45
46
47bool FakeDepthCameraDriver_ParamsParser::getParamValue(const std::string& paramName, std::string& paramValue) const
48{
49 if (paramName =="rgb_h")
50 {
51 paramValue = std::to_string(m_rgb_h);
52 return true;
53 }
54 if (paramName =="rgb_w")
55 {
56 paramValue = std::to_string(m_rgb_w);
57 return true;
58 }
59 if (paramName =="dep_h")
60 {
61 paramValue = std::to_string(m_dep_h);
62 return true;
63 }
64 if (paramName =="dep_w")
65 {
66 paramValue = std::to_string(m_dep_w);
67 return true;
68 }
69 if (paramName =="accuracy")
70 {
71 paramValue = std::to_string(m_accuracy);
72 return true;
73 }
74 if (paramName =="rgb_Vfov")
75 {
76 paramValue = std::to_string(m_rgb_Vfov);
77 return true;
78 }
79 if (paramName =="rgb_Hfov")
80 {
81 paramValue = std::to_string(m_rgb_Hfov);
82 return true;
83 }
84 if (paramName =="dep_Vfov")
85 {
86 paramValue = std::to_string(m_dep_Vfov);
87 return true;
88 }
89 if (paramName =="dep_Hfov")
90 {
91 paramValue = std::to_string(m_dep_Hfov);
92 return true;
93 }
94 if (paramName =="dep_near")
95 {
96 paramValue = std::to_string(m_dep_near);
97 return true;
98 }
99 if (paramName =="dep_far")
100 {
101 paramValue = std::to_string(m_dep_far);
102 return true;
103 }
104 if (paramName =="test_distance_constant")
105 {
106 paramValue = std::to_string(m_test_distance_constant);
107 return true;
108 }
109
110 yError() <<"parameter '" << paramName << "' was not found";
111 return false;
112
113}
114
115
117{
118 //This is a sub-optimal solution.
119 //Ideally getConfiguration() should return all parameters but it is currently
120 //returning only user provided parameters (excluding default values)
121 //This behaviour will be fixed in the near future.
122 std::string s_cfg = m_provided_configuration;
123 return s_cfg;
124}
125
127{
128 //Check for --help option
129 if (config.check("help"))
130 {
131 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << getDocumentationOfDeviceParams();
132 }
133
136 //Parser of parameter rgb_h
137 {
138 if (config.check("rgb_h"))
139 {
140 m_rgb_h = config.find("rgb_h").asFloat64();
141 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_h' using value:" << m_rgb_h;
142 }
143 else
144 {
145 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_h' using DEFAULT value:" << m_rgb_h;
146 }
147 prop_check.unput("rgb_h");
148 }
149
150 //Parser of parameter rgb_w
151 {
152 if (config.check("rgb_w"))
153 {
154 m_rgb_w = config.find("rgb_w").asFloat64();
155 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_w' using value:" << m_rgb_w;
156 }
157 else
158 {
159 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_w' using DEFAULT value:" << m_rgb_w;
160 }
161 prop_check.unput("rgb_w");
162 }
163
164 //Parser of parameter dep_h
165 {
166 if (config.check("dep_h"))
167 {
168 m_dep_h = config.find("dep_h").asFloat64();
169 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_h' using value:" << m_dep_h;
170 }
171 else
172 {
173 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_h' using DEFAULT value:" << m_dep_h;
174 }
175 prop_check.unput("dep_h");
176 }
177
178 //Parser of parameter dep_w
179 {
180 if (config.check("dep_w"))
181 {
182 m_dep_w = config.find("dep_w").asFloat64();
183 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_w' using value:" << m_dep_w;
184 }
185 else
186 {
187 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_w' using DEFAULT value:" << m_dep_w;
188 }
189 prop_check.unput("dep_w");
190 }
191
192 //Parser of parameter accuracy
193 {
194 if (config.check("accuracy"))
195 {
196 m_accuracy = config.find("accuracy").asFloat64();
197 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'accuracy' using value:" << m_accuracy;
198 }
199 else
200 {
201 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'accuracy' using DEFAULT value:" << m_accuracy;
202 }
203 prop_check.unput("accuracy");
204 }
205
206 //Parser of parameter rgb_Vfov
207 {
208 if (config.check("rgb_Vfov"))
209 {
210 m_rgb_Vfov = config.find("rgb_Vfov").asFloat64();
211 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_Vfov' using value:" << m_rgb_Vfov;
212 }
213 else
214 {
215 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_Vfov' using DEFAULT value:" << m_rgb_Vfov;
216 }
217 prop_check.unput("rgb_Vfov");
218 }
219
220 //Parser of parameter rgb_Hfov
221 {
222 if (config.check("rgb_Hfov"))
223 {
224 m_rgb_Hfov = config.find("rgb_Hfov").asFloat64();
225 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_Hfov' using value:" << m_rgb_Hfov;
226 }
227 else
228 {
229 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'rgb_Hfov' using DEFAULT value:" << m_rgb_Hfov;
230 }
231 prop_check.unput("rgb_Hfov");
232 }
233
234 //Parser of parameter dep_Vfov
235 {
236 if (config.check("dep_Vfov"))
237 {
238 m_dep_Vfov = config.find("dep_Vfov").asFloat64();
239 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_Vfov' using value:" << m_dep_Vfov;
240 }
241 else
242 {
243 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_Vfov' using DEFAULT value:" << m_dep_Vfov;
244 }
245 prop_check.unput("dep_Vfov");
246 }
247
248 //Parser of parameter dep_Hfov
249 {
250 if (config.check("dep_Hfov"))
251 {
252 m_dep_Hfov = config.find("dep_Hfov").asFloat64();
253 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_Hfov' using value:" << m_dep_Hfov;
254 }
255 else
256 {
257 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_Hfov' using DEFAULT value:" << m_dep_Hfov;
258 }
259 prop_check.unput("dep_Hfov");
260 }
261
262 //Parser of parameter dep_near
263 {
264 if (config.check("dep_near"))
265 {
266 m_dep_near = config.find("dep_near").asFloat64();
267 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_near' using value:" << m_dep_near;
268 }
269 else
270 {
271 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_near' using DEFAULT value:" << m_dep_near;
272 }
273 prop_check.unput("dep_near");
274 }
275
276 //Parser of parameter dep_far
277 {
278 if (config.check("dep_far"))
279 {
280 m_dep_far = config.find("dep_far").asFloat64();
281 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_far' using value:" << m_dep_far;
282 }
283 else
284 {
285 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'dep_far' using DEFAULT value:" << m_dep_far;
286 }
287 prop_check.unput("dep_far");
288 }
289
290 //Parser of parameter test_distance_constant
291 {
292 if (config.check("test_distance_constant"))
293 {
294 m_test_distance_constant = config.find("test_distance_constant").asFloat64();
295 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'test_distance_constant' using value:" << m_test_distance_constant;
296 }
297 else
298 {
299 yCInfo(FakeDepthCameraDriverParamsCOMPONENT) << "Parameter 'test_distance_constant' using DEFAULT value:" << m_test_distance_constant;
300 }
301 prop_check.unput("test_distance_constant");
302 }
303
304 /*
305 //This code check if the user set some parameter which are not check by the parser
306 //If the parser is set in strict mode, this will generate an error
307 if (prop_check.size() > 0)
308 {
309 bool extra_params_found = false;
310 for (auto it=prop_check.begin(); it!=prop_check.end(); it++)
311 {
312 if (m_parser_is_strict)
313 {
314 yCError(FakeDepthCameraDriverParamsCOMPONENT) << "User asking for parameter: "<<it->name <<" which is unknown to this parser!";
315 extra_params_found = true;
316 }
317 else
318 {
319 yCWarning(FakeDepthCameraDriverParamsCOMPONENT) << "User asking for parameter: "<< it->name <<" which is unknown to this parser!";
320 }
321 }
322
323 if (m_parser_is_strict && extra_params_found)
324 {
325 return false;
326 }
327 }
328 */
329 return true;
330}
331
332
334{
335 std::string doc;
336 doc = doc + std::string("\n=============================================\n");
337 doc = doc + std::string("This is the help for device: FakeDepthCameraDriver\n");
338 doc = doc + std::string("\n");
339 doc = doc + std::string("This is the list of the parameters accepted by the device:\n");
340 doc = doc + std::string("'rgb_h': rgb_h\n");
341 doc = doc + std::string("'rgb_w': rgb_w\n");
342 doc = doc + std::string("'dep_h': dep_h\n");
343 doc = doc + std::string("'dep_w': dep_w\n");
344 doc = doc + std::string("'accuracy': accuracy\n");
345 doc = doc + std::string("'rgb_Vfov': rgb_Vfov\n");
346 doc = doc + std::string("'rgb_Hfov': rgb_Hfov\n");
347 doc = doc + std::string("'dep_Vfov': dep_Vfov\n");
348 doc = doc + std::string("'dep_Hfov': dep_Hfov\n");
349 doc = doc + std::string("'dep_near': dep_near\n");
350 doc = doc + std::string("'dep_far': dep_far\n");
351 doc = doc + std::string("'test_distance_constant': if set != 0, it will set all the pixels of the generated depth to constant distance of x meters\n");
352 doc = doc + std::string("\n");
353 doc = doc + std::string("Here are some examples of invocation command with yarpdev, with all params:\n");
354 doc = doc + " yarpdev --device fakeDepthCamera --rgb_h 480.0 --rgb_w 640.0 --dep_h 480.0 --dep_w 640.0 --accuracy 0.001 --rgb_Vfov 50.0 --rgb_Hfov 36.0 --dep_Vfov 50.0 --dep_Hfov 36.0 --dep_near 0.2 --dep_far 6.0 --test_distance_constant 2.0\n";
355 doc = doc + std::string("Using only mandatory params:\n");
356 doc = doc + " yarpdev --device fakeDepthCamera\n";
357 doc = doc + std::string("=============================================\n\n"); return doc;
358}
#define yError(...)
Definition Log.h:361
std::string getDocumentationOfDeviceParams() const override
Get the documentation of the DeviceDriver's parameters.
std::string getConfiguration() const override
Return the configuration of the device.
bool getParamValue(const std::string &paramName, std::string &paramValue) const override
Return the value (represented as a string) of the requested parameter.
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
A class for storing options and configuration information.
Definition Property.h:32
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
A base class for nested structures that can be searched.
Definition Searchable.h:31
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
#define yCInfo(component,...)
#define YARP_LOG_COMPONENT(name,...)