19 YARP_LOG_COMPONENT(FakeMotionControlMicroParamsCOMPONENT,
"yarp.device.FakeMotionControlMicro")
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::Encoder");
42 if (paramName ==
"GENERAL::Joints")
47 if (paramName ==
"GENERAL::AxisMap")
49 std::ostringstream oss;
56 paramValue = oss.str();
59 if (paramName ==
"GENERAL::AxisName")
61 std::ostringstream oss;
68 paramValue = oss.str();
71 if (paramName ==
"GENERAL::AxisType")
73 std::ostringstream oss;
80 paramValue = oss.str();
83 if (paramName ==
"GENERAL::Encoder")
85 std::ostringstream oss;
92 paramValue = oss.str();
96 yError() <<
"parameter '" << paramName <<
"' was not found";
115 if (config.
check(
"help"))
126 if (sectionp.
check(
"Joints"))
129 yCInfo(FakeMotionControlMicroParamsCOMPONENT) <<
"Parameter 'GENERAL::Joints' using value:" <<
m_GENERAL_Joints;
133 yCInfo(FakeMotionControlMicroParamsCOMPONENT) <<
"Parameter 'GENERAL::Joints' using DEFAULT value:" <<
m_GENERAL_Joints;
135 prop_check.
unput(
"GENERAL::Joints");
142 if (sectionp.
check(
"AxisMap"))
149 std::string tempBots = tempBot->
toString();
150 for (
size_t i=0; i<tempBot->
size(); i++)
157 yCError(FakeMotionControlMicroParamsCOMPONENT) <<
"parameter 'GENERAL_AxisMap' is not a properly formatted bottle";
160 yCInfo(FakeMotionControlMicroParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisMap' using value:" <<
m_GENERAL_AxisMap;
164 yCInfo(FakeMotionControlMicroParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisMap' using DEFAULT value:" <<
m_GENERAL_AxisMap;
166 prop_check.
unput(
"GENERAL::AxisMap");
173 if (sectionp.
check(
"AxisName"))
180 std::string tempBots = tempBot->
toString();
181 for (
size_t i=0; i<tempBot->
size(); i++)
188 yCError(FakeMotionControlMicroParamsCOMPONENT) <<
"parameter 'GENERAL_AxisName' is not a properly formatted bottle";
191 yCInfo(FakeMotionControlMicroParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisName' using value:" <<
m_GENERAL_AxisName;
195 yCInfo(FakeMotionControlMicroParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisName' using DEFAULT value:" <<
m_GENERAL_AxisName;
197 prop_check.
unput(
"GENERAL::AxisName");
204 if (sectionp.
check(
"AxisType"))
211 std::string tempBots = tempBot->
toString();
212 for (
size_t i=0; i<tempBot->
size(); i++)
219 yCError(FakeMotionControlMicroParamsCOMPONENT) <<
"parameter 'GENERAL_AxisType' is not a properly formatted bottle";
222 yCInfo(FakeMotionControlMicroParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisType' using value:" <<
m_GENERAL_AxisType;
226 yCInfo(FakeMotionControlMicroParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisType' using DEFAULT value:" <<
m_GENERAL_AxisType;
228 prop_check.
unput(
"GENERAL::AxisType");
235 if (sectionp.
check(
"Encoder"))
242 std::string tempBots = tempBot->
toString();
243 for (
size_t i=0; i<tempBot->
size(); i++)
250 yCError(FakeMotionControlMicroParamsCOMPONENT) <<
"parameter 'GENERAL_Encoder' is not a properly formatted bottle";
253 yCInfo(FakeMotionControlMicroParamsCOMPONENT) <<
"Parameter 'GENERAL::Encoder' using value:" <<
m_GENERAL_Encoder;
257 yCInfo(FakeMotionControlMicroParamsCOMPONENT) <<
"Parameter 'GENERAL::Encoder' using DEFAULT value:" <<
m_GENERAL_Encoder;
259 prop_check.
unput(
"GENERAL::Encoder");
294 doc = doc + std::string(
"\n=============================================\n");
295 doc = doc + std::string(
"This is the help for device: FakeMotionControlMicro\n");
296 doc = doc + std::string(
"\n");
297 doc = doc + std::string(
"This is the list of the parameters accepted by the device:\n");
298 doc = doc + std::string(
"'GENERAL::Joints': Number of degrees of freedom\n");
299 doc = doc + std::string(
"'GENERAL::AxisMap': a list of reordered indices for the axes\n");
300 doc = doc + std::string(
"'GENERAL::AxisName': a list of strings representing the axes names\n");
301 doc = doc + std::string(
"'GENERAL::AxisType': a list of strings representing the axes type (revolute/prismatic)\n");
302 doc = doc + std::string(
"'GENERAL::Encoder': a list of scales for the encoders\n");
303 doc = doc + std::string(
"\n");
304 doc = doc + std::string(
"Here are some examples of invocation command with yarpdev, with all params:\n");
305 doc = doc +
" yarpdev --device fakeMotionControlMicro --GENERAL::Joints 1 --GENERAL::AxisMap <optional_value> --GENERAL::AxisName <optional_value> --GENERAL::AxisType <optional_value> --GENERAL::Encoder <optional_value>\n";
306 doc = doc + std::string(
"Using only mandatory params:\n");
307 doc = doc +
" yarpdev --device fakeMotionControlMicro\n";
308 doc = doc + std::string(
"=============================================\n\n");
return doc;
std::string getConfiguration() const override
Return the configuration of the device.
std::vector< int > m_GENERAL_AxisMap
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
std::string m_provided_configuration
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
std::string getDocumentationOfDeviceParams() const override
Get the documentation of the DeviceDriver's parameters.
std::vector< std::string > m_GENERAL_AxisName
std::vector< std::string > m_GENERAL_AxisType
std::vector< int > m_GENERAL_Encoder
FakeMotionControlMicro_ParamsParser()
bool getParamValue(const std::string ¶mName, std::string ¶mValue) const override
Return the value (represented as a string) of the requested parameter.
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 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,...)