YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
RGBDSensorClient_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 (1.0)
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_GERNERATION is ON.
10
11// Generated on: Thu Mar 7 17:59:49 2024
12
13
15#include <yarp/os/LogStream.h>
16#include <yarp/os/Value.h>
17
18namespace {
19 YARP_LOG_COMPONENT(RGBDSensorClientParamsCOMPONENT, "yarp.device.RGBDSensorClient")
20}
21
22
26
27
28std::vector<std::string> RGBDSensorClient_ParamsParser::getListOfParams() const
29{
30 std::vector<std::string> params;
31 params.push_back("period");
32 params.push_back("localImagePort");
33 params.push_back("localDepthPort");
34 params.push_back("remoteImagePort");
35 params.push_back("remoteDepthPort");
36 params.push_back("localRpcPort");
37 params.push_back("remoteRpcPort");
38 params.push_back("ImageCarrier");
39 params.push_back("DepthCarrier");
40 return params;
41}
42
43
45{
46 //Check for --help option
47 if (config.check("help"))
48 {
49 yCInfo(RGBDSensorClientParamsCOMPONENT) << getDocumentationOfDeviceParams();
50 }
51
52 std::string config_string = config.toString();
53 yarp::os::Property prop_check(config_string.c_str());
54 //Parser of parameter period
55 {
56 if (config.check("period"))
57 {
58 m_period = config.find("period").asFloat64();
59 yCInfo(RGBDSensorClientParamsCOMPONENT) << "Parameter 'period' using value:" << m_period;
60 }
61 else
62 {
63 yCInfo(RGBDSensorClientParamsCOMPONENT) << "Parameter 'period' using DEFAULT value:" << m_period;
64 }
65 prop_check.unput("period");
66 }
67
68 //Parser of parameter localImagePort
69 {
70 if (config.check("localImagePort"))
71 {
72 m_localImagePort = config.find("localImagePort").asString();
73 yCInfo(RGBDSensorClientParamsCOMPONENT) << "Parameter 'localImagePort' using value:" << m_localImagePort;
74 }
75 else
76 {
77 yCError(RGBDSensorClientParamsCOMPONENT) << "Mandatory parameter 'localImagePort' not found!";
78 yCError(RGBDSensorClientParamsCOMPONENT) << "Description of the parameter: Full name of the local image streaming port to open";
79 return false;
80 }
81 prop_check.unput("localImagePort");
82 }
83
84 //Parser of parameter localDepthPort
85 {
86 if (config.check("localDepthPort"))
87 {
88 m_localDepthPort = config.find("localDepthPort").asString();
89 yCInfo(RGBDSensorClientParamsCOMPONENT) << "Parameter 'localDepthPort' using value:" << m_localDepthPort;
90 }
91 else
92 {
93 yCError(RGBDSensorClientParamsCOMPONENT) << "Mandatory parameter 'localDepthPort' not found!";
94 yCError(RGBDSensorClientParamsCOMPONENT) << "Description of the parameter: Full name of the local depth streaming port to open";
95 return false;
96 }
97 prop_check.unput("localDepthPort");
98 }
99
100 //Parser of parameter remoteImagePort
101 {
102 if (config.check("remoteImagePort"))
103 {
104 m_remoteImagePort = config.find("remoteImagePort").asString();
105 yCInfo(RGBDSensorClientParamsCOMPONENT) << "Parameter 'remoteImagePort' using value:" << m_remoteImagePort;
106 }
107 else
108 {
109 yCError(RGBDSensorClientParamsCOMPONENT) << "Mandatory parameter 'remoteImagePort' not found!";
110 yCError(RGBDSensorClientParamsCOMPONENT) << "Description of the parameter: Full name of the remote image port to connect to";
111 return false;
112 }
113 prop_check.unput("remoteImagePort");
114 }
115
116 //Parser of parameter remoteDepthPort
117 {
118 if (config.check("remoteDepthPort"))
119 {
120 m_remoteDepthPort = config.find("remoteDepthPort").asString();
121 yCInfo(RGBDSensorClientParamsCOMPONENT) << "Parameter 'remoteDepthPort' using value:" << m_remoteDepthPort;
122 }
123 else
124 {
125 yCError(RGBDSensorClientParamsCOMPONENT) << "Mandatory parameter 'remoteDepthPort' not found!";
126 yCError(RGBDSensorClientParamsCOMPONENT) << "Description of the parameter: Full name of the remote depth port to connect to";
127 return false;
128 }
129 prop_check.unput("remoteDepthPort");
130 }
131
132 //Parser of parameter localRpcPort
133 {
134 if (config.check("localRpcPort"))
135 {
136 m_localRpcPort = config.find("localRpcPort").asString();
137 yCInfo(RGBDSensorClientParamsCOMPONENT) << "Parameter 'localRpcPort' using value:" << m_localRpcPort;
138 }
139 else
140 {
141 yCError(RGBDSensorClientParamsCOMPONENT) << "Mandatory parameter 'localRpcPort' not found!";
142 yCError(RGBDSensorClientParamsCOMPONENT) << "Description of the parameter: Full name of the local rpc port to open";
143 return false;
144 }
145 prop_check.unput("localRpcPort");
146 }
147
148 //Parser of parameter remoteRpcPort
149 {
150 if (config.check("remoteRpcPort"))
151 {
152 m_remoteRpcPort = config.find("remoteRpcPort").asString();
153 yCInfo(RGBDSensorClientParamsCOMPONENT) << "Parameter 'remoteRpcPort' using value:" << m_remoteRpcPort;
154 }
155 else
156 {
157 yCError(RGBDSensorClientParamsCOMPONENT) << "Mandatory parameter 'remoteRpcPort' not found!";
158 yCError(RGBDSensorClientParamsCOMPONENT) << "Description of the parameter: Full name of the remote rpc port to connect to";
159 return false;
160 }
161 prop_check.unput("remoteRpcPort");
162 }
163
164 //Parser of parameter ImageCarrier
165 {
166 if (config.check("ImageCarrier"))
167 {
168 m_ImageCarrier = config.find("ImageCarrier").asString();
169 yCInfo(RGBDSensorClientParamsCOMPONENT) << "Parameter 'ImageCarrier' using value:" << m_ImageCarrier;
170 }
171 else
172 {
173 yCInfo(RGBDSensorClientParamsCOMPONENT) << "Parameter 'ImageCarrier' using DEFAULT value:" << m_ImageCarrier;
174 }
175 prop_check.unput("ImageCarrier");
176 }
177
178 //Parser of parameter DepthCarrier
179 {
180 if (config.check("DepthCarrier"))
181 {
182 m_DepthCarrier = config.find("DepthCarrier").asString();
183 yCInfo(RGBDSensorClientParamsCOMPONENT) << "Parameter 'DepthCarrier' using value:" << m_DepthCarrier;
184 }
185 else
186 {
187 yCInfo(RGBDSensorClientParamsCOMPONENT) << "Parameter 'DepthCarrier' using DEFAULT value:" << m_DepthCarrier;
188 }
189 prop_check.unput("DepthCarrier");
190 }
191
192 /*
193 //This code check if the user set some parameter which are not check by the parser
194 //If the parser is set in strict mode, this will generate an error
195 if (prop_check.size() > 0)
196 {
197 bool extra_params_found = false;
198 for (auto it=prop_check.begin(); it!=prop_check.end(); it++)
199 {
200 if (m_parser_is_strict)
201 {
202 yCError(RGBDSensorClientParamsCOMPONENT) << "User asking for parameter: "<<it->name <<" which is unknown to this parser!";
203 extra_params_found = true;
204 }
205 else
206 {
207 yCWarning(RGBDSensorClientParamsCOMPONENT) << "User asking for parameter: "<< it->name <<" which is unknown to this parser!";
208 }
209 }
210
211 if (m_parser_is_strict && extra_params_found)
212 {
213 return false;
214 }
215 }
216 */
217 return true;
218}
219
220
222{
223 std::string doc;
224 doc = doc + std::string("\n=============================================\n");
225 doc = doc + std::string("This is the help for device: RGBDSensorClient\n");
226 doc = doc + std::string("\n");
227 doc = doc + std::string("This is the list of the parameters accepted by the device:\n");
228 doc = doc + std::string("'period': refresh period (in s) of the broadcasted values through yarp ports\n");
229 doc = doc + std::string("'localImagePort': Full name of the local image streaming port to open\n");
230 doc = doc + std::string("'localDepthPort': Full name of the local depth streaming port to open\n");
231 doc = doc + std::string("'remoteImagePort': Full name of the remote image port to connect to\n");
232 doc = doc + std::string("'remoteDepthPort': Full name of the remote depth port to connect to\n");
233 doc = doc + std::string("'localRpcPort': Full name of the local rpc port to open\n");
234 doc = doc + std::string("'remoteRpcPort': Full name of the remote rpc port to connect to\n");
235 doc = doc + std::string("'ImageCarrier': Carrier for the image stream\n");
236 doc = doc + std::string("'DepthCarrier': Carrier for the depth stream\n");
237 doc = doc + std::string("\n");
238 doc = doc + std::string("Here are some examples of invocation command with yarpdev, with all params:\n");
239 doc = doc + " yarpdev --device RGBDSensorClient --period 0.03 --localImagePort /RGBD_nwc/Image:o --localDepthPort /RGBD_nwc/Depth:o --remoteImagePort /RGBD_nws/Image:o --remoteDepthPort /RGBD_nws/Depth:i --localRpcPort /RGBD_nwc/rpc:o --remoteRpcPort /RGBD_nws/rpc:i --ImageCarrier udp --DepthCarrier udp\n";
240 doc = doc + std::string("Using only mandatory params:\n");
241 doc = doc + " yarpdev --device RGBDSensorClient --localImagePort /RGBD_nwc/Image:o --localDepthPort /RGBD_nwc/Depth:o --remoteImagePort /RGBD_nws/Image:o --remoteDepthPort /RGBD_nws/Depth:i --localRpcPort /RGBD_nwc/rpc:o --remoteRpcPort /RGBD_nws/rpc:i\n";
242 doc = doc + std::string("=============================================\n\n"); return doc;
243}
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
std::string getDocumentationOfDeviceParams() const override
Get the documentation of the DeviceDriver's parameters.
A class for storing options and configuration information.
Definition Property.h:33
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 yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)