31 if (tempBot && tempBot->
size()!=0)
33 for (
size_t i=0; i<tempBot->
size(); i++)
40 yError() <<
"parameter 'LIMITS_jntPosMin' is not a properly formatted bottle";
50 if (tempBot && tempBot->
size()!=0)
52 for (
size_t i=0; i<tempBot->
size(); i++)
59 yError() <<
"parameter 'LIMITS_jntPosMax' is not a properly formatted bottle";
69 if (tempBot && tempBot->
size()!=0)
71 for (
size_t i=0; i<tempBot->
size(); i++)
78 yError() <<
"parameter 'LIMITS_jntVelMin' is not a properly formatted bottle";
88 if (tempBot && tempBot->
size()!=0)
90 for (
size_t i=0; i<tempBot->
size(); i++)
97 yError() <<
"parameter 'LIMITS_jntVelMax' is not a properly formatted bottle";
107 if (tempBot && tempBot->
size()!=0)
109 for (
size_t i=0; i<tempBot->
size(); i++)
116 yError() <<
"parameter 'GENERAL_AxisName' is not a properly formatted bottle";
126 if (tempBot && tempBot->
size()!=0)
128 for (
size_t i=0; i<tempBot->
size(); i++)
135 yError() <<
"parameter 'GENERAL_AxisType' is not a properly formatted bottle";
145 if (tempBot && tempBot->
size()!=0)
147 for (
size_t i=0; i<tempBot->
size(); i++)
154 yError() <<
"parameter 'GENERAL_AxisMap' is not a properly formatted bottle";
163 std::vector<std::string> params;
164 params.push_back(
"connection_type");
165 params.push_back(
"RS485::port");
166 params.push_back(
"RS485::baudrate");
167 params.push_back(
"ETHERCAT::eth_ifname");
168 params.push_back(
"PID::kp");
169 params.push_back(
"PID::ki");
170 params.push_back(
"PID::kd");
171 params.push_back(
"TORQUE::tor_max");
172 params.push_back(
"MODE::mode");
173 params.push_back(
"LIMITS::jntPosMin");
174 params.push_back(
"LIMITS::jntPosMax");
175 params.push_back(
"LIMITS::jntVelMin");
176 params.push_back(
"LIMITS::jntVelMax");
177 params.push_back(
"GENERAL::AxisName");
178 params.push_back(
"GENERAL::AxisType");
179 params.push_back(
"GENERAL::AxisMap");
186 if (paramName ==
"connection_type")
191 if (paramName ==
"RS485::port")
196 if (paramName ==
"RS485::baudrate")
201 if (paramName ==
"ETHERCAT::eth_ifname")
206 if (paramName ==
"PID::kp")
208 paramValue = std::to_string(
m_PID_kp);
211 if (paramName ==
"PID::ki")
213 paramValue = std::to_string(
m_PID_ki);
216 if (paramName ==
"PID::kd")
218 paramValue = std::to_string(
m_PID_kd);
221 if (paramName ==
"TORQUE::tor_max")
226 if (paramName ==
"MODE::mode")
231 if (paramName ==
"LIMITS::jntPosMin")
235 if (paramName ==
"LIMITS::jntPosMax")
239 if (paramName ==
"LIMITS::jntVelMin")
243 if (paramName ==
"LIMITS::jntVelMax")
247 if (paramName ==
"GENERAL::AxisName")
251 if (paramName ==
"GENERAL::AxisType")
255 if (paramName ==
"GENERAL::AxisMap")
260 yError() <<
"parameter '" << paramName <<
"' was not found";
279 if (config.
check(
"help"))
288 if (config.
check(
"connection_type"))
295 yCError(xHandControlBoardParamsCOMPONENT) <<
"Mandatory parameter 'connection_type' not found!";
296 yCError(xHandControlBoardParamsCOMPONENT) <<
"Description of the parameter: Specify the connection type";
299 prop_check.
unput(
"connection_type");
306 if (sectionp.
check(
"port"))
309 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'RS485::port' using value:" <<
m_RS485_port;
313 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'RS485::port' using DEFAULT value:" <<
m_RS485_port;
315 prop_check.
unput(
"RS485::port");
322 if (sectionp.
check(
"baudrate"))
325 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'RS485::baudrate' using value:" <<
m_RS485_baudrate;
329 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'RS485::baudrate' using DEFAULT value:" <<
m_RS485_baudrate;
331 prop_check.
unput(
"RS485::baudrate");
338 if (sectionp.
check(
"eth_ifname"))
347 prop_check.
unput(
"ETHERCAT::eth_ifname");
354 if (sectionp.
check(
"kp"))
357 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'PID::kp' using value:" <<
m_PID_kp;
361 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'PID::kp' using DEFAULT value:" <<
m_PID_kp;
363 prop_check.
unput(
"PID::kp");
370 if (sectionp.
check(
"ki"))
373 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'PID::ki' using value:" <<
m_PID_ki;
377 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'PID::ki' using DEFAULT value:" <<
m_PID_ki;
379 prop_check.
unput(
"PID::ki");
386 if (sectionp.
check(
"kd"))
389 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'PID::kd' using value:" <<
m_PID_kd;
393 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'PID::kd' using DEFAULT value:" <<
m_PID_kd;
395 prop_check.
unput(
"PID::kd");
402 if (sectionp.
check(
"tor_max"))
405 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'TORQUE::tor_max' using value:" <<
m_TORQUE_tor_max;
409 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'TORQUE::tor_max' using DEFAULT value:" <<
m_TORQUE_tor_max;
411 prop_check.
unput(
"TORQUE::tor_max");
418 if (sectionp.
check(
"mode"))
421 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'MODE::mode' using value:" <<
m_MODE_mode;
425 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'MODE::mode' using DEFAULT value:" <<
m_MODE_mode;
427 prop_check.
unput(
"MODE::mode");
434 if (sectionp.
check(
"jntPosMin"))
441 std::string tempBots = tempBot->
toString();
442 for (
size_t i=0; i<tempBot->
size(); i++)
449 yCError(xHandControlBoardParamsCOMPONENT) <<
"parameter 'LIMITS_jntPosMin' is not a properly formatted bottle";
456 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'LIMITS::jntPosMin' using DEFAULT value:" <<
m_LIMITS_jntPosMin;
458 prop_check.
unput(
"LIMITS::jntPosMin");
465 if (sectionp.
check(
"jntPosMax"))
472 std::string tempBots = tempBot->
toString();
473 for (
size_t i=0; i<tempBot->
size(); i++)
480 yCError(xHandControlBoardParamsCOMPONENT) <<
"parameter 'LIMITS_jntPosMax' is not a properly formatted bottle";
487 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'LIMITS::jntPosMax' using DEFAULT value:" <<
m_LIMITS_jntPosMax;
489 prop_check.
unput(
"LIMITS::jntPosMax");
496 if (sectionp.
check(
"jntVelMin"))
503 std::string tempBots = tempBot->
toString();
504 for (
size_t i=0; i<tempBot->
size(); i++)
511 yCError(xHandControlBoardParamsCOMPONENT) <<
"parameter 'LIMITS_jntVelMin' is not a properly formatted bottle";
518 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'LIMITS::jntVelMin' using DEFAULT value:" <<
m_LIMITS_jntVelMin;
520 prop_check.
unput(
"LIMITS::jntVelMin");
527 if (sectionp.
check(
"jntVelMax"))
534 std::string tempBots = tempBot->
toString();
535 for (
size_t i=0; i<tempBot->
size(); i++)
542 yCError(xHandControlBoardParamsCOMPONENT) <<
"parameter 'LIMITS_jntVelMax' is not a properly formatted bottle";
549 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'LIMITS::jntVelMax' using DEFAULT value:" <<
m_LIMITS_jntVelMax;
551 prop_check.
unput(
"LIMITS::jntVelMax");
558 if (sectionp.
check(
"AxisName"))
565 std::string tempBots = tempBot->
toString();
566 for (
size_t i=0; i<tempBot->
size(); i++)
573 yCError(xHandControlBoardParamsCOMPONENT) <<
"parameter 'GENERAL_AxisName' is not a properly formatted bottle";
580 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisName' using DEFAULT value:" <<
m_GENERAL_AxisName;
582 prop_check.
unput(
"GENERAL::AxisName");
589 if (sectionp.
check(
"AxisType"))
596 std::string tempBots = tempBot->
toString();
597 for (
size_t i=0; i<tempBot->
size(); i++)
604 yCError(xHandControlBoardParamsCOMPONENT) <<
"parameter 'GENERAL_AxisType' is not a properly formatted bottle";
611 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisType' using DEFAULT value:" <<
m_GENERAL_AxisType;
613 prop_check.
unput(
"GENERAL::AxisType");
620 if (sectionp.
check(
"AxisMap"))
627 std::string tempBots = tempBot->
toString();
628 for (
size_t i=0; i<tempBot->
size(); i++)
635 yCError(xHandControlBoardParamsCOMPONENT) <<
"parameter 'GENERAL_AxisMap' is not a properly formatted bottle";
642 yCInfo(xHandControlBoardParamsCOMPONENT) <<
"Parameter 'GENERAL::AxisMap' using DEFAULT value:" <<
m_GENERAL_AxisMap;
644 prop_check.
unput(
"GENERAL::AxisMap");
679 doc = doc + std::string(
"\n=============================================\n");
680 doc = doc + std::string(
"This is the help for device: xHandControlBoard\n");
681 doc = doc + std::string(
"\n");
682 doc = doc + std::string(
"This is the list of the parameters accepted by the device:\n");
683 doc = doc + std::string(
"'connection_type': Specify the connection type\n");
684 doc = doc + std::string(
"'RS485::port': Specify the port to use for the serial connection\n");
685 doc = doc + std::string(
"'RS485::baudrate': Specify the baudrate for the serial connection\n");
686 doc = doc + std::string(
"'ETHERCAT::eth_ifname': Specify the interface name for the ethercat connection\n");
687 doc = doc + std::string(
"'PID::kp': Finger motors P gain\n");
688 doc = doc + std::string(
"'PID::ki': Finger motors I gain\n");
689 doc = doc + std::string(
"'PID::kd': Finger motors D gain\n");
690 doc = doc + std::string(
"'TORQUE::tor_max': Note: 350 is the value from their ethercat_test\n");
691 doc = doc + std::string(
"'MODE::mode': Powerless = 0; Powerfull = 3; Check the manual for others\n");
692 doc = doc + std::string(
"'LIMITS::jntPosMin': \n");
693 doc = doc + std::string(
"'LIMITS::jntPosMax': \n");
694 doc = doc + std::string(
"'LIMITS::jntVelMin': \n");
695 doc = doc + std::string(
"'LIMITS::jntVelMax': \n");
696 doc = doc + std::string(
"'GENERAL::AxisName': \n");
697 doc = doc + std::string(
"'GENERAL::AxisType': \n");
698 doc = doc + std::string(
"'GENERAL::AxisMap': \n");
699 doc = doc + std::string(
"\n");
700 doc = doc + std::string(
"Here are some examples of invocation command with yarpdev, with all params:\n");
701 doc = doc +
" yarpdev --device xHandControlBoard --connection_type EtherCAT --RS485::port /dev/ttyUSB0 --RS485::baudrate 3000000 --ETHERCAT::eth_ifname <optional_value> --PID::kp 225 --PID::ki 0 --PID::kd 12000 --TORQUE::tor_max 350 --MODE::mode 3 --LIMITS::jntPosMin \" (0.0 -60.0 -0.0 -5.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0) \" --LIMITS::jntPosMax \" (90.0 90.0 90.0 17.0 110.0 110.0 110.0 110.0 110.0 110.0 110.0 110.0) \" --LIMITS::jntVelMin \" (0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0) \" --LIMITS::jntVelMax \" (100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0) \" --GENERAL::AxisName \" (a a a a a a a a a a a a) \" --GENERAL::AxisType \" (a a a a a a a a a a a a) \" --GENERAL::AxisMap \" (0 0 0 0 0 0 0 0 0 0 0 0) \"\n";
702 doc = doc + std::string(
"Using only mandatory params:\n");
703 doc = doc +
" yarpdev --device xHandControlBoard --connection_type EtherCAT\n";
704 doc = doc + std::string(
"=============================================\n\n");
return doc;
const std::string m_GENERAL_AxisType_defaultValue
std::string m_provided_configuration
const std::string m_GENERAL_AxisMap_defaultValue
const std::string m_GENERAL_AxisName_defaultValue
xHandControlBoard_ParamsParser()
std::vector< double > m_LIMITS_jntVelMax
std::vector< double > m_LIMITS_jntPosMin
std::vector< std::string > m_GENERAL_AxisName
std::vector< std::string > m_GENERAL_AxisType
std::vector< double > m_LIMITS_jntVelMin
const std::string m_LIMITS_jntPosMin_defaultValue
const std::string m_LIMITS_jntPosMax_defaultValue
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
std::string getConfiguration() const override
Return the configuration of the device.
std::string getDocumentationOfDeviceParams() const override
Get the documentation of the DeviceDriver's parameters.
const std::string m_LIMITS_jntVelMin_defaultValue
std::vector< int > m_GENERAL_AxisMap
std::vector< double > m_LIMITS_jntPosMax
const std::string m_LIMITS_jntVelMax_defaultValue
std::string m_ETHERCAT_eth_ifname
std::string m_connection_type
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
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 Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
A single value (typically within a Bottle).
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.
void fromString(const char *str)
Set value to correspond to a textual representation.
virtual std::string asString() const
Get string value.
#define yCInfo(component,...)
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)