30 std::vector<std::string> params;
31 params.push_back(
"GENERAL::Joints");
32 params.push_back(
"GENERAL::AxisMap");
33 params.push_back(
"GENERAL::AxisName");
34 params.push_back(
"GENERAL::AxisType");
35 params.push_back(
"GENERAL::ampsToSensor");
36 params.push_back(
"GENERAL::fullscalePWM");
37 params.push_back(
"GENERAL::Encoder");
38 params.push_back(
"LIMITS::Max");
39 params.push_back(
"LIMITS::Min");
46 if (paramName ==
"GENERAL::Joints")
51 if (paramName ==
"GENERAL::AxisMap")
55 if (paramName ==
"GENERAL::AxisName")
59 if (paramName ==
"GENERAL::AxisType")
63 if (paramName ==
"GENERAL::ampsToSensor")
67 if (paramName ==
"GENERAL::fullscalePWM")
71 if (paramName ==
"GENERAL::Encoder")
75 if (paramName ==
"LIMITS::Max")
79 if (paramName ==
"LIMITS::Min")
84 yError() <<
"parameter '" << paramName <<
"' was not found";
103 if (config.
check(
"help"))
114 if (sectionp.
check(
"Joints"))
117 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'GENERAL::Joints' using value:" <<
m_GENERAL_Joints;
121 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'GENERAL::Joints' using DEFAULT value:" <<
m_GENERAL_Joints;
123 prop_check.
unput(
"GENERAL::Joints");
130 if (sectionp.
check(
"AxisMap"))
137 std::string tempBots = tempBot->
toString();
138 for (
size_t i=0; i<tempBot->
size(); i++)
145 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'GENERAL_AxisMap' is not a properly formatted bottle";
152 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisMap' using DEFAULT value:" <<
m_GENERAL_AxisMap;
154 prop_check.
unput(
"GENERAL::AxisMap");
161 if (sectionp.
check(
"AxisName"))
168 std::string tempBots = tempBot->
toString();
169 for (
size_t i=0; i<tempBot->
size(); i++)
176 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'GENERAL_AxisName' is not a properly formatted bottle";
183 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisName' using DEFAULT value:" <<
m_GENERAL_AxisName;
185 prop_check.
unput(
"GENERAL::AxisName");
192 if (sectionp.
check(
"AxisType"))
199 std::string tempBots = tempBot->
toString();
200 for (
size_t i=0; i<tempBot->
size(); i++)
207 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'GENERAL_AxisType' is not a properly formatted bottle";
214 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisType' using DEFAULT value:" <<
m_GENERAL_AxisType;
216 prop_check.
unput(
"GENERAL::AxisType");
223 if (sectionp.
check(
"ampsToSensor"))
230 std::string tempBots = tempBot->
toString();
231 for (
size_t i=0; i<tempBot->
size(); i++)
238 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'GENERAL_ampsToSensor' is not a properly formatted bottle";
247 prop_check.
unput(
"GENERAL::ampsToSensor");
254 if (sectionp.
check(
"fullscalePWM"))
261 std::string tempBots = tempBot->
toString();
262 for (
size_t i=0; i<tempBot->
size(); i++)
269 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'GENERAL_fullscalePWM' is not a properly formatted bottle";
278 prop_check.
unput(
"GENERAL::fullscalePWM");
285 if (sectionp.
check(
"Encoder"))
292 std::string tempBots = tempBot->
toString();
293 for (
size_t i=0; i<tempBot->
size(); i++)
300 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'GENERAL_Encoder' is not a properly formatted bottle";
307 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'GENERAL::Encoder' using DEFAULT value:" <<
m_GENERAL_Encoder;
309 prop_check.
unput(
"GENERAL::Encoder");
316 if (sectionp.
check(
"Max"))
323 std::string tempBots = tempBot->
toString();
324 for (
size_t i=0; i<tempBot->
size(); i++)
331 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'LIMITS_Max' is not a properly formatted bottle";
334 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'LIMITS::Max' using value:" <<
m_LIMITS_Max;
338 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'LIMITS::Max' using DEFAULT value:" <<
m_LIMITS_Max;
340 prop_check.
unput(
"LIMITS::Max");
347 if (sectionp.
check(
"Min"))
354 std::string tempBots = tempBot->
toString();
355 for (
size_t i=0; i<tempBot->
size(); i++)
362 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'LIMITS_Min' is not a properly formatted bottle";
365 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'LIMITS::Min' using value:" <<
m_LIMITS_Min;
369 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'LIMITS::Min' using DEFAULT value:" <<
m_LIMITS_Min;
371 prop_check.
unput(
"LIMITS::Min");
406 doc = doc + std::string(
"\n=============================================\n");
407 doc = doc + std::string(
"This is the help for device: FakeMotionControl\n");
408 doc = doc + std::string(
"\n");
409 doc = doc + std::string(
"This is the list of the parameters accepted by the device:\n");
410 doc = doc + std::string(
"'GENERAL::Joints': Number of degrees of freedom\n");
411 doc = doc + std::string(
"'GENERAL::AxisMap': a list of reordered indices for the axes\n");
412 doc = doc + std::string(
"'GENERAL::AxisName': a list of strings representing the axes names\n");
413 doc = doc + std::string(
"'GENERAL::AxisType': a list of strings representing the axes type (revolute/prismatic)\n");
414 doc = doc + std::string(
"'GENERAL::ampsToSensor': a list of scales for the ampsToSensor conversion factors\n");
415 doc = doc + std::string(
"'GENERAL::fullscalePWM': a list of scales for the fullscalePWM conversion factors\n");
416 doc = doc + std::string(
"'GENERAL::Encoder': a list of scales for the encoders\n");
417 doc = doc + std::string(
"'LIMITS::Max': max encoder position\n");
418 doc = doc + std::string(
"'LIMITS::Min': min encoder position\n");
419 doc = doc + std::string(
"\n");
420 doc = doc + std::string(
"Here are some examples of invocation command with yarpdev, with all params:\n");
421 doc = doc +
" yarpdev --device fakeMotionControl --GENERAL::Joints 1 --GENERAL::AxisMap <optional_value> --GENERAL::AxisName <optional_value> --GENERAL::AxisType <optional_value> --GENERAL::ampsToSensor <optional_value> --GENERAL::fullscalePWM <optional_value> --GENERAL::Encoder <optional_value> --LIMITS::Max <optional_value> --LIMITS::Min <optional_value>\n";
422 doc = doc + std::string(
"Using only mandatory params:\n");
423 doc = doc +
" yarpdev --device fakeMotionControl\n";
424 doc = doc + std::string(
"=============================================\n\n");
return doc;
std::vector< double > m_LIMITS_Min
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
std::vector< std::string > m_GENERAL_AxisName
bool getParamValue(const std::string ¶mName, std::string ¶mValue) const override
Return the value (represented as a string) of the requested parameter.
std::vector< int > m_GENERAL_Encoder
std::vector< double > m_LIMITS_Max
std::vector< std::string > m_GENERAL_AxisType
FakeMotionControl_ParamsParser()
std::vector< int > m_GENERAL_AxisMap
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.
std::string m_provided_configuration
std::string getConfiguration() const override
Return the configuration of the device.
std::vector< double > m_GENERAL_fullscalePWM
std::vector< double > m_GENERAL_ampsToSensor
A simple collection of objects that can be described and transmitted in a portable way.
size_type size() const
Gets the number of elements in the bottle.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
A class for storing options and configuration information.
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.
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 Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
virtual std::int64_t asInt64() const
Get 64-bit integer value.
virtual Bottle * asList() const
Get list value.
virtual std::string asString() const
Get string value.
#define yCInfo(component,...)
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)