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")
53 std::ostringstream oss;
60 paramValue = oss.str();
63 if (paramName ==
"GENERAL::AxisName")
65 std::ostringstream oss;
72 paramValue = oss.str();
75 if (paramName ==
"GENERAL::AxisType")
77 std::ostringstream oss;
84 paramValue = oss.str();
87 if (paramName ==
"GENERAL::ampsToSensor")
89 std::ostringstream oss;
96 paramValue = oss.str();
99 if (paramName ==
"GENERAL::fullscalePWM")
101 std::ostringstream oss;
108 paramValue = oss.str();
111 if (paramName ==
"GENERAL::Encoder")
113 std::ostringstream oss;
120 paramValue = oss.str();
123 if (paramName ==
"LIMITS::Max")
125 std::ostringstream oss;
132 paramValue = oss.str();
135 if (paramName ==
"LIMITS::Min")
137 std::ostringstream oss;
144 paramValue = oss.str();
148 yError() <<
"parameter '" << paramName <<
"' was not found";
167 if (config.
check(
"help"))
178 if (sectionp.
check(
"Joints"))
181 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'GENERAL::Joints' using value:" <<
m_GENERAL_Joints;
185 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'GENERAL::Joints' using DEFAULT value:" <<
m_GENERAL_Joints;
187 prop_check.
unput(
"GENERAL::Joints");
194 if (sectionp.
check(
"AxisMap"))
201 std::string tempBots = tempBot->
toString();
202 for (
size_t i=0; i<tempBot->
size(); i++)
209 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'GENERAL_AxisMap' is not a properly formatted bottle";
216 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisMap' using DEFAULT value:" <<
m_GENERAL_AxisMap;
218 prop_check.
unput(
"GENERAL::AxisMap");
225 if (sectionp.
check(
"AxisName"))
232 std::string tempBots = tempBot->
toString();
233 for (
size_t i=0; i<tempBot->
size(); i++)
240 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'GENERAL_AxisName' is not a properly formatted bottle";
247 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisName' using DEFAULT value:" <<
m_GENERAL_AxisName;
249 prop_check.
unput(
"GENERAL::AxisName");
256 if (sectionp.
check(
"AxisType"))
263 std::string tempBots = tempBot->
toString();
264 for (
size_t i=0; i<tempBot->
size(); i++)
271 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'GENERAL_AxisType' is not a properly formatted bottle";
278 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisType' using DEFAULT value:" <<
m_GENERAL_AxisType;
280 prop_check.
unput(
"GENERAL::AxisType");
287 if (sectionp.
check(
"ampsToSensor"))
294 std::string tempBots = tempBot->
toString();
295 for (
size_t i=0; i<tempBot->
size(); i++)
302 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'GENERAL_ampsToSensor' is not a properly formatted bottle";
311 prop_check.
unput(
"GENERAL::ampsToSensor");
318 if (sectionp.
check(
"fullscalePWM"))
325 std::string tempBots = tempBot->
toString();
326 for (
size_t i=0; i<tempBot->
size(); i++)
333 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'GENERAL_fullscalePWM' is not a properly formatted bottle";
342 prop_check.
unput(
"GENERAL::fullscalePWM");
349 if (sectionp.
check(
"Encoder"))
356 std::string tempBots = tempBot->
toString();
357 for (
size_t i=0; i<tempBot->
size(); i++)
364 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'GENERAL_Encoder' is not a properly formatted bottle";
371 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'GENERAL::Encoder' using DEFAULT value:" <<
m_GENERAL_Encoder;
373 prop_check.
unput(
"GENERAL::Encoder");
380 if (sectionp.
check(
"Max"))
387 std::string tempBots = tempBot->
toString();
388 for (
size_t i=0; i<tempBot->
size(); i++)
395 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'LIMITS_Max' is not a properly formatted bottle";
398 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'LIMITS::Max' using value:" <<
m_LIMITS_Max;
402 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'LIMITS::Max' using DEFAULT value:" <<
m_LIMITS_Max;
404 prop_check.
unput(
"LIMITS::Max");
411 if (sectionp.
check(
"Min"))
418 std::string tempBots = tempBot->
toString();
419 for (
size_t i=0; i<tempBot->
size(); i++)
426 yCError(FakeMotionControlParamsCOMPONENT) <<
"parameter 'LIMITS_Min' is not a properly formatted bottle";
429 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'LIMITS::Min' using value:" <<
m_LIMITS_Min;
433 yCInfo(FakeMotionControlParamsCOMPONENT) <<
"Parameter 'LIMITS::Min' using DEFAULT value:" <<
m_LIMITS_Min;
435 prop_check.
unput(
"LIMITS::Min");
470 doc = doc + std::string(
"\n=============================================\n");
471 doc = doc + std::string(
"This is the help for device: FakeMotionControl\n");
472 doc = doc + std::string(
"\n");
473 doc = doc + std::string(
"This is the list of the parameters accepted by the device:\n");
474 doc = doc + std::string(
"'GENERAL::Joints': Number of degrees of freedom\n");
475 doc = doc + std::string(
"'GENERAL::AxisMap': a list of reordered indices for the axes\n");
476 doc = doc + std::string(
"'GENERAL::AxisName': a list of strings representing the axes names\n");
477 doc = doc + std::string(
"'GENERAL::AxisType': a list of strings representing the axes type (revolute/prismatic)\n");
478 doc = doc + std::string(
"'GENERAL::ampsToSensor': a list of scales for the ampsToSensor conversion factors\n");
479 doc = doc + std::string(
"'GENERAL::fullscalePWM': a list of scales for the fullscalePWM conversion factors\n");
480 doc = doc + std::string(
"'GENERAL::Encoder': a list of scales for the encoders\n");
481 doc = doc + std::string(
"'LIMITS::Max': max encoder position\n");
482 doc = doc + std::string(
"'LIMITS::Min': min encoder position\n");
483 doc = doc + std::string(
"\n");
484 doc = doc + std::string(
"Here are some examples of invocation command with yarpdev, with all params:\n");
485 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";
486 doc = doc + std::string(
"Using only mandatory params:\n");
487 doc = doc +
" yarpdev --device fakeMotionControl\n";
488 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,...)