31 #define NEW_JSTATUS_STRUCT 1
32 #define VELOCITY_WATCHDOG 0.1
33 #define OPENLOOP_WATCHDOG 0.1
34 #define PWM_CONSTANT 0.1
42 for (
int i=0;i <_njoints ;i++)
47 if (this->_command_speeds[i]!=0)
50 double increment = _command_speeds[i]*elapsed;
57 this->_command_speeds[i]=0.0;
63 if (this->refpwm[i]!=0)
78 pos[i] = _posDir_references[i];
82 pos[i] = _posCtrl_references[i];
104 yCError(FAKEMOTIONCONTROL) << txt <<
"is not yet implemented for FakeMotionControl";
110 yCError(FAKEMOTIONCONTROL) << txt <<
"has been deprecated for FakeMotionControl";
123 std::ostringstream oss;
130 bool FakeMotionControl::extractGroup(
Bottle &input,
Bottle &out,
const std::string &key1,
const std::string &txt,
int size)
137 yCError(FAKEMOTIONCONTROL) << key1.c_str() <<
"parameter not found";
141 if(tmp.
size()!=(
size_t) size)
143 yCError(FAKEMOTIONCONTROL) << key1.c_str() <<
"incorrect number of entries";
153 pos.resize(_njoints);
154 dpos.resize(_njoints);
155 vel.resize(_njoints);
156 speed.resize(_njoints);
157 acc.resize(_njoints);
158 loc.resize(_njoints);
159 amp.resize(_njoints);
161 current.resize(_njoints);
162 nominalCurrent.resize(_njoints);
163 maxCurrent.resize(_njoints);
164 peakCurrent.resize(_njoints);
165 pwm.resize(_njoints);
166 refpwm.resize(_njoints);
167 pwmLimit.resize(_njoints);
168 supplyVoltage.resize(_njoints);
169 last_velocity_command.resize(_njoints);
170 last_pwm_command.resize(_njoints);
181 nominalCurrent.zero();
188 supplyVoltage.zero();
193 _axisMap = allocAndCheck<int>(nj);
194 _controlModes = allocAndCheck<int>(nj);
195 _interactMode = allocAndCheck<int>(nj);
196 _angleToEncoder = allocAndCheck<double>(nj);
197 _dutycycleToPWM = allocAndCheck<double>(nj);
198 _ampsToSensor = allocAndCheck<double>(nj);
199 _encodersStamp = allocAndCheck<double>(nj);
200 _DEPRECATED_encoderconversionoffset = allocAndCheck<float>(nj);
201 _DEPRECATED_encoderconversionfactor = allocAndCheck<float>(nj);
204 _jointEncoderRes = allocAndCheck<int>(nj);
205 _rotorEncoderRes = allocAndCheck<int>(nj);
206 _gearbox = allocAndCheck<double>(nj);
207 _torqueSensorId= allocAndCheck<int>(nj);
208 _torqueSensorChan= allocAndCheck<int>(nj);
209 _maxTorque=allocAndCheck<double>(nj);
210 _torques = allocAndCheck<double>(nj);
211 _maxJntCmdVelocity = allocAndCheck<double>(nj);
212 _maxMotorVelocity = allocAndCheck<double>(nj);
213 _newtonsToSensor=allocAndCheck<double>(nj);
214 _hasHallSensor = allocAndCheck<bool>(nj);
215 _hasTempSensor = allocAndCheck<bool>(nj);
216 _hasRotorEncoder = allocAndCheck<bool>(nj);
217 _hasRotorEncoderIndex = allocAndCheck<bool>(nj);
218 _rotorIndexOffset = allocAndCheck<int>(nj);
219 _motorPoles = allocAndCheck<int>(nj);
220 _rotorlimits_max = allocAndCheck<double>(nj);
221 _rotorlimits_min = allocAndCheck<double>(nj);
223 _ppids=allocAndCheck<Pid>(nj);
224 _tpids=allocAndCheck<Pid>(nj);
225 _cpids = allocAndCheck<Pid>(nj);
226 _vpids = allocAndCheck<Pid>(nj);
227 _ppids_ena=allocAndCheck<bool>(nj);
228 _tpids_ena=allocAndCheck<bool>(nj);
229 _cpids_ena = allocAndCheck<bool>(nj);
230 _vpids_ena = allocAndCheck<bool>(nj);
231 _ppids_lim=allocAndCheck<double>(nj);
232 _tpids_lim=allocAndCheck<double>(nj);
233 _cpids_lim = allocAndCheck<double>(nj);
234 _vpids_lim = allocAndCheck<double>(nj);
235 _ppids_ref=allocAndCheck<double>(nj);
236 _tpids_ref=allocAndCheck<double>(nj);
237 _cpids_ref = allocAndCheck<double>(nj);
238 _vpids_ref = allocAndCheck<double>(nj);
242 _axisName =
new string[nj];
245 _limitsMax=allocAndCheck<double>(nj);
246 _limitsMin=allocAndCheck<double>(nj);
247 _kinematic_mj=allocAndCheck<double>(16);
249 _motorPwmLimits=allocAndCheck<double>(nj);
250 checking_motiondone=allocAndCheck<bool>(nj);
252 _velocityShifts=allocAndCheck<int>(nj);
253 _velocityTimeout=allocAndCheck<int>(nj);
254 _kbemf=allocAndCheck<double>(nj);
255 _ktau=allocAndCheck<double>(nj);
256 _kbemf_scale = allocAndCheck<int>(nj);
257 _ktau_scale = allocAndCheck<int>(nj);
258 _filterType=allocAndCheck<int>(nj);
259 _last_position_move_time=allocAndCheck<double>(nj);
262 _posCtrl_references = allocAndCheck<double>(nj);
263 _posDir_references = allocAndCheck<double>(nj);
264 _command_speeds = allocAndCheck<double>(nj);
265 _ref_speeds = allocAndCheck<double>(nj);
266 _ref_accs = allocAndCheck<double>(nj);
267 _ref_torques = allocAndCheck<double>(nj);
268 _ref_currents = allocAndCheck<double>(nj);
269 _enabledAmp = allocAndCheck<bool>(nj);
270 _enabledPid = allocAndCheck<bool>(nj);
271 _calibrated = allocAndCheck<bool>(nj);
279 bool FakeMotionControl::dealloc()
381 _angleToEncoder(nullptr),
382 _encodersStamp (nullptr),
383 _ampsToSensor (nullptr),
384 _dutycycleToPWM(nullptr),
385 _DEPRECATED_encoderconversionfactor (nullptr),
386 _DEPRECATED_encoderconversionoffset (nullptr),
387 _jointEncoderRes (nullptr),
388 _rotorEncoderRes (nullptr),
390 _hasHallSensor (nullptr),
391 _hasTempSensor (nullptr),
392 _hasRotorEncoder (nullptr),
393 _hasRotorEncoderIndex (nullptr),
394 _rotorIndexOffset (nullptr),
395 _motorPoles (nullptr),
396 _rotorlimits_max (nullptr),
397 _rotorlimits_min (nullptr),
402 _ppids_ena (nullptr),
403 _tpids_ena (nullptr),
404 _cpids_ena (nullptr),
405 _vpids_ena (nullptr),
406 _ppids_lim (nullptr),
407 _tpids_lim (nullptr),
408 _cpids_lim (nullptr),
409 _vpids_lim (nullptr),
410 _ppids_ref (nullptr),
411 _tpids_ref (nullptr),
412 _cpids_ref (nullptr),
413 _vpids_ref (nullptr),
415 _jointType (nullptr),
416 _limitsMin (nullptr),
417 _limitsMax (nullptr),
418 _kinematic_mj (nullptr),
419 _maxJntCmdVelocity (nullptr),
420 _maxMotorVelocity (nullptr),
421 _velocityShifts (nullptr),
422 _velocityTimeout (nullptr),
425 _kbemf_scale (nullptr),
426 _ktau_scale (nullptr),
427 _filterType (nullptr),
428 _torqueSensorId (nullptr),
429 _torqueSensorChan (nullptr),
430 _maxTorque (nullptr),
431 _newtonsToSensor (nullptr),
432 checking_motiondone (nullptr),
433 _last_position_move_time(nullptr),
434 _motorPwmLimits (nullptr),
436 useRawEncoderData (false),
437 _pwmIsLimited (false),
438 _torqueControlEnabled (false),
439 _torqueControlUnits (T_MACHINE_UNITS),
440 _positionControlUnits (P_MACHINE_UNITS),
441 _controlModes (nullptr),
442 _interactMode (nullptr),
443 _enabledAmp (nullptr),
444 _enabledPid (nullptr),
445 _calibrated (nullptr),
446 _posCtrl_references (nullptr),
447 _posDir_references (nullptr),
448 _ref_speeds (nullptr),
449 _command_speeds (nullptr),
451 _ref_torques (nullptr),
452 _ref_currents (nullptr),
455 verbose (VERY_VERBOSE)
459 verbosewhenok = (tmp !=
"") ? (
bool)NetType::toInt(tmp) :
477 for(
int i=0; i<_njoints; i++)
480 pwmLimit[i] = (33+i)*10;
481 current[i] = (33+i)*100;
482 maxCurrent[i] = (33+i)*1000;
483 peakCurrent[i] = (33+i)*2;
484 nominalCurrent[i] = (33+i)*20;
485 supplyVoltage[i] = (33+i)*200;
486 last_velocity_command[i] = -1;
487 last_pwm_command[i] = -1;
489 _maxJntCmdVelocity[i]=50.0;
531 yCTrace(FAKEMOTIONCONTROL) << str;
536 _njoints = config.
findGroup(
"GENERAL").
check(
"Joints",
Value(1),
"Number of degrees of freedom").asInt32();
537 yCInfo(FAKEMOTIONCONTROL,
"Using %d joint%s", _njoints, ((_njoints != 1) ?
"s" :
""));
541 yCError(FAKEMOTIONCONTROL) <<
"Malloc failed";
546 for(
int i=0; i<_njoints; i++)
547 _newtonsToSensor[i] = 1;
551 yCError(FAKEMOTIONCONTROL) <<
"Missing parameters in config file";
563 ControlBoardHelper cb(_njoints, _axisMap, _angleToEncoder,
nullptr, _newtonsToSensor, _ampsToSensor, _dutycycleToPWM);
565 ImplementControlCalibration::initialize(_njoints, _axisMap, _angleToEncoder,
nullptr);
566 ImplementAmplifierControl::initialize(_njoints, _axisMap, _angleToEncoder,
nullptr);
567 ImplementEncodersTimed::initialize(_njoints, _axisMap, _angleToEncoder,
nullptr);
568 ImplementMotorEncoders::initialize(_njoints, _axisMap, _angleToEncoder,
nullptr);
569 ImplementPositionControl::initialize(_njoints, _axisMap, _angleToEncoder,
nullptr);
570 ImplementPidControl::initialize(_njoints, _axisMap, _angleToEncoder,
nullptr, _newtonsToSensor, _ampsToSensor, _dutycycleToPWM);
573 ImplementControlMode::initialize(_njoints, _axisMap);
574 ImplementVelocityControl::initialize(_njoints, _axisMap, _angleToEncoder,
nullptr);
575 ImplementControlLimits::initialize(_njoints, _axisMap, _angleToEncoder,
nullptr);
576 ImplementImpedanceControl::initialize(_njoints, _axisMap, _angleToEncoder,
nullptr, _newtonsToSensor);
577 ImplementTorqueControl::initialize(_njoints, _axisMap, _angleToEncoder,
nullptr, _newtonsToSensor, _ampsToSensor, _dutycycleToPWM, bemfToRaw.
data(), ktauToRaw.
data());
578 ImplementPositionDirect::initialize(_njoints, _axisMap, _angleToEncoder,
nullptr);
579 ImplementInteractionMode::initialize(_njoints, _axisMap, _angleToEncoder,
nullptr);
580 ImplementMotor::initialize(_njoints, _axisMap);
581 ImplementAxisInfo::initialize(_njoints, _axisMap);
582 ImplementPWMControl::initialize(_njoints, _axisMap, _dutycycleToPWM);
583 ImplementCurrentControl::initialize(_njoints, _axisMap, _ampsToSensor);
584 ImplementVirtualAnalogSensor::initialize(_njoints, _axisMap, _newtonsToSensor);
587 bool init = this->
start();
590 yCError(FAKEMOTIONCONTROL) <<
"open() has an error in call of FakeMotionControl::init() for board" ;
597 yCDebug(FAKEMOTIONCONTROL) <<
"init() has successfully initted board ";
610 if (!extractGroup(pidsGroup, xtmp,
"stiffness",
"stiffness parameter", _njoints)) {
613 for (j=0; j<_njoints; j++) {
617 if (!extractGroup(pidsGroup, xtmp,
"damping",
"damping parameter", _njoints)) {
620 for (j=0; j<_njoints; j++) {
627 bool FakeMotionControl::parsePositionPidsGroup(
Bottle& pidsGroup,
Pid myPid[])
632 if (!extractGroup(pidsGroup, xtmp,
"kp",
"Pid kp parameter", _njoints)) {
635 for (j=0; j<_njoints; j++) {
639 if (!extractGroup(pidsGroup, xtmp,
"kd",
"Pid kd parameter", _njoints)) {
642 for (j=0; j<_njoints; j++) {
646 if (!extractGroup(pidsGroup, xtmp,
"ki",
"Pid kp parameter", _njoints)) {
649 for (j=0; j<_njoints; j++) {
653 if (!extractGroup(pidsGroup, xtmp,
"maxInt",
"Pid maxInt parameter", _njoints)) {
656 for (j=0; j<_njoints; j++) {
660 if (!extractGroup(pidsGroup, xtmp,
"maxPwm",
"Pid maxPwm parameter", _njoints)) {
663 for (j=0; j<_njoints; j++) {
667 if (!extractGroup(pidsGroup, xtmp,
"shift",
"Pid shift parameter", _njoints)) {
670 for (j=0; j<_njoints; j++) {
674 if (!extractGroup(pidsGroup, xtmp,
"ko",
"Pid ko parameter", _njoints)) {
677 for (j=0; j<_njoints; j++) {
681 if (!extractGroup(pidsGroup, xtmp,
"stictionUp",
"Pid stictionUp", _njoints)) {
684 for (j=0; j<_njoints; j++) {
688 if (!extractGroup(pidsGroup, xtmp,
"stictionDwn",
"Pid stictionDwn", _njoints)) {
691 for (j=0; j<_njoints; j++) {
695 if (!extractGroup(pidsGroup, xtmp,
"kff",
"Pid kff parameter", _njoints)) {
698 for (j=0; j<_njoints; j++) {
703 if (_positionControlUnits==P_METRIC_UNITS)
705 for (j=0; j<_njoints; j++)
707 myPid[j].
kp = myPid[j].
kp / _angleToEncoder[j];
708 myPid[j].
ki = myPid[j].
ki / _angleToEncoder[j];
709 myPid[j].
kd = myPid[j].
kd / _angleToEncoder[j];
720 if (!extractGroup(pidsGroup, xtmp,
"limPwm",
"Limited PWD", _njoints))
722 yCError(FAKEMOTIONCONTROL) <<
"The PID parameter limPwm was requested but was not correctly set in the configuration file, please fill it.";
726 yCInfo(FAKEMOTIONCONTROL) <<
"Using LIMITED PWM!!";
727 for (j=0; j<_njoints; j++)
734 bool FakeMotionControl::parseTorquePidsGroup(
Bottle& pidsGroup,
Pid myPid[],
double kbemf[],
double ktau[],
int filterType[])
738 if (!extractGroup(pidsGroup, xtmp,
"kp",
"Pid kp parameter", _njoints)) {
741 for (j=0; j<_njoints; j++) {
745 if (!extractGroup(pidsGroup, xtmp,
"kd",
"Pid kd parameter", _njoints)) {
748 for (j=0; j<_njoints; j++) {
752 if (!extractGroup(pidsGroup, xtmp,
"ki",
"Pid kp parameter", _njoints)) {
755 for (j=0; j<_njoints; j++) {
759 if (!extractGroup(pidsGroup, xtmp,
"maxInt",
"Pid maxInt parameter", _njoints)) {
762 for (j=0; j<_njoints; j++) {
766 if (!extractGroup(pidsGroup, xtmp,
"maxPwm",
"Pid maxPwm parameter", _njoints)) {
769 for (j=0; j<_njoints; j++) {
773 if (!extractGroup(pidsGroup, xtmp,
"shift",
"Pid shift parameter", _njoints)) {
776 for (j=0; j<_njoints; j++) {
780 if (!extractGroup(pidsGroup, xtmp,
"ko",
"Pid ko parameter", _njoints)) {
783 for (j=0; j<_njoints; j++) {
787 if (!extractGroup(pidsGroup, xtmp,
"stictionUp",
"Pid stictionUp", _njoints)) {
790 for (j=0; j<_njoints; j++) {
794 if (!extractGroup(pidsGroup, xtmp,
"stictionDwn",
"Pid stictionDwn", _njoints)) {
797 for (j=0; j<_njoints; j++) {
801 if (!extractGroup(pidsGroup, xtmp,
"kff",
"Pid kff parameter", _njoints)) {
804 for (j=0; j<_njoints; j++) {
808 if (!extractGroup(pidsGroup, xtmp,
"kbemf",
"kbemf parameter", _njoints)) {
811 for (j=0; j<_njoints; j++) {
815 if (!extractGroup(pidsGroup, xtmp,
"ktau",
"ktau parameter", _njoints)) {
818 for (j=0; j<_njoints; j++) {
822 if (!extractGroup(pidsGroup, xtmp,
"filterType",
"filterType param", _njoints)) {
825 for (j=0; j<_njoints; j++) {
842 if (!extractGroup(pidsGroup, xtmp,
"limPwm",
"Limited PWM", _njoints))
844 yCError(FAKEMOTIONCONTROL) <<
"The PID parameter limPwm was requested but was not correctly set in the configuration file, please fill it.";
848 yCInfo(FAKEMOTIONCONTROL) <<
"Using LIMITED PWM!!";
849 for (j=0; j<_njoints; j++) myPid[j].max_output = xtmp.
get(j+1).
asFloat64();
862 if(general.
check(
"AxisMap"))
864 if(extractGroup(general, xtmp,
"AxisMap",
"a list of reordered indices for the axes", _njoints))
866 for (i = 1; (size_t) i < xtmp.
size(); i++)
874 yCInfo(FAKEMOTIONCONTROL) <<
"Using default AxisMap";
875 for (i = 0; i < _njoints; i++)
879 if(general.
check(
"AxisName"))
881 if (extractGroup(general, xtmp,
"AxisName",
"a list of strings representing the axes names", _njoints))
884 for (i = 1; (size_t) i < xtmp.
size(); i++)
886 _axisName[_axisMap[i - 1]] = xtmp.
get(i).
asString();
894 yCInfo(FAKEMOTIONCONTROL) <<
"Using default AxisName";
895 for (i = 0; i < _njoints; i++)
897 _axisName[_axisMap[i]] =
"joint" +
toString(i);
900 if(general.
check(
"AxisType"))
902 if (extractGroup(general, xtmp,
"AxisType",
"a list of strings representing the axes type (revolute/prismatic)", _njoints))
905 for (i = 1; (size_t) i < xtmp.
size(); i++)
912 yCError(FAKEMOTIONCONTROL,
"Unknown AxisType value %s!", typeString.c_str());
923 yCInfo(FAKEMOTIONCONTROL) <<
"Using default AxisType (revolute)";
924 for (i = 0; i < _njoints; i++)
931 if (general.
check(
"ampsToSensor"))
933 if (extractGroup(general, xtmp,
"ampsToSensor",
"a list of scales for the ampsToSensor conversion factors", _njoints))
935 for (i = 1; (size_t) i < xtmp.
size(); i++)
948 yCInfo(FAKEMOTIONCONTROL) <<
"Using default ampsToSensor";
949 for (i = 0; i < _njoints; i++)
951 _ampsToSensor[i] = 1.0;
956 if (general.
check(
"fullscalePWM"))
958 if (extractGroup(general, xtmp,
"fullscalePWM",
"a list of scales for the fullscalePWM conversion factors", _njoints))
960 for (i = 1; (size_t) i < xtmp.
size(); i++)
964 _dutycycleToPWM[i - 1] = xtmp.
get(i).
asFloat64() / 100.0;
973 yCInfo(FAKEMOTIONCONTROL) <<
"Using default dutycycleToPWM=1.0";
974 for (i = 0; i < _njoints; i++)
975 _dutycycleToPWM[i] = 1.0;
980 if(general.
check(
"Encoder"))
982 if (extractGroup(general, xtmp,
"Encoder",
"a list of scales for the encoders", _njoints))
984 for (i = 1; (size_t) i < xtmp.
size(); i++)
994 yCInfo(FAKEMOTIONCONTROL) <<
"Using default Encoder";
995 for (i = 0; i < _njoints; i++)
996 _angleToEncoder[i] = 1;
1433 yCTrace(FAKEMOTIONCONTROL) <<
" close()";
1435 ImplementControlMode::uninitialize();
1436 ImplementEncodersTimed::uninitialize();
1437 ImplementMotorEncoders::uninitialize();
1438 ImplementPositionControl::uninitialize();
1439 ImplementVelocityControl::uninitialize();
1440 ImplementPidControl::uninitialize();
1441 ImplementControlCalibration::uninitialize();
1442 ImplementAmplifierControl::uninitialize();
1443 ImplementImpedanceControl::uninitialize();
1444 ImplementControlLimits::uninitialize();
1445 ImplementTorqueControl::uninitialize();
1446 ImplementPositionDirect::uninitialize();
1447 ImplementInteractionMode::uninitialize();
1448 ImplementAxisInfo::uninitialize();
1449 ImplementVirtualAnalogSensor::uninitialize();
1456 void FakeMotionControl::cleanup()
1467 yCDebug(FAKEMOTIONCONTROL) <<
"setPidRaw" << pidtype << j << pid.
kp;
1491 for(
int j=0; j< _njoints; j++)
1523 for(
int j=0, index=0; j< _njoints; j++, index++)
1535 _ppids_lim[j]=limit;
1538 _vpids_lim[j]=limit;
1541 _cpids_lim[j]=limit;
1544 _tpids_lim[j]=limit;
1555 for(
int j=0, index=0; j< _njoints; j++, index++)
1587 for(
int j=0; j< _njoints; j++)
1613 yCDebug(FAKEMOTIONCONTROL) <<
"getPidRaw" << pidtype << j << pid->
kp;
1623 for(
int j=0, index=0; j<_njoints; j++, index++)
1658 for(
int j=0; j< _njoints; j++)
1670 *limit=_ppids_lim[j];
1673 *limit=_vpids_lim[j];
1676 *limit=_cpids_lim[j];
1679 *limit=_tpids_lim[j];
1690 for(
int j=0, index=0; j<_njoints; j++, index++)
1707 _ppids_ena[j]=
false;
1710 _vpids_ena[j]=
false;
1713 _cpids_ena[j]=
false;
1716 _tpids_ena[j]=
false;
1748 yCDebug(FAKEMOTIONCONTROL) <<
"setPidOffsetRaw" << pidtype << j << v;
1774 *enabled=_ppids_ena[j];
1777 *enabled=_vpids_ena[j];
1780 *enabled=_cpids_ena[j];
1783 *enabled=_tpids_ena[j];
1810 yCDebug(FAKEMOTIONCONTROL) <<
"getPidOutputRaw" << pidtype << j << *out;
1817 for(
int j=0; j< _njoints; j++)
1837 yCError(FAKEMOTIONCONTROL) <<
"velocityMoveRaw: skipping command because board " <<
" joint " << j <<
" is not in VOCAB_CM_VELOCITY mode";
1839 _command_speeds[j] = sp;
1848 for(
int i=0; i<_njoints; i++)
1860 yCTrace(FAKEMOTIONCONTROL) <<
"setCalibrationParametersRaw for joint" << j;
1866 yCTrace(FAKEMOTIONCONTROL) <<
"calibrateRaw for joint" << j;
1872 bool result =
false;
1890 if(verbose >= VERY_VERBOSE)
1891 yCTrace(FAKEMOTIONCONTROL) <<
"j " << j <<
" ref " << ref;
1906 yCError(FAKEMOTIONCONTROL) <<
"positionMoveRaw: skipping command because joint " << j <<
" is not in VOCAB_CM_POSITION mode";
1908 _posCtrl_references[j] = ref;
1914 if(verbose >= VERY_VERBOSE)
1918 for(
int j=0, index=0; j< _njoints; j++, index++)
1927 if(verbose >= VERY_VERBOSE)
1928 yCTrace(FAKEMOTIONCONTROL) <<
"j " << j <<
" ref " << delta;
1942 yCError(FAKEMOTIONCONTROL) <<
"relativeMoveRaw: skipping command because joint " << j <<
" is not in VOCAB_CM_POSITION mode";
1944 _posCtrl_references[j] += delta;
1950 if(verbose >= VERY_VERBOSE)
1954 for(
int j=0, index=0; j< _njoints; j++, index++)
1964 if(verbose >= VERY_VERBOSE)
1965 yCTrace(FAKEMOTIONCONTROL) <<
"j ";
1973 if(verbose >= VERY_VERBOSE)
1977 bool val, tot_res =
true;
1979 for(
int j=0, index=0; j< _njoints; j++, index++)
1993 _ref_speeds[index] = sp;
2001 for(
int j=0, index=0; j< _njoints; j++, index++)
2003 _ref_speeds[index] = spds[index];
2015 _ref_accs[j ] = 1e6;
2017 else if (acc < -1e6)
2019 _ref_accs[j ] = -1e6;
2023 _ref_accs[j ] = acc;
2033 for(
int j=0, index=0; j< _njoints; j++, index++)
2037 _ref_accs[index] = 1e6;
2039 else if (accs[j] < -1e6)
2041 _ref_accs[index] = -1e6;
2045 _ref_accs[index] = accs[j];
2053 *spd = _ref_speeds[j];
2059 memcpy(spds, _ref_speeds,
sizeof(
double) * _njoints);
2065 *acc = _ref_accs[j];
2071 memcpy(accs, _ref_accs,
sizeof(
double) * _njoints);
2083 for(
int j=0; j< _njoints; j++)
2097 if(verbose >= VERY_VERBOSE)
2098 yCTrace(FAKEMOTIONCONTROL) <<
" -> n_joint " << n_joint;
2100 for(
int j=0; j<n_joint; j++)
2102 yCDebug(FAKEMOTIONCONTROL,
"j: %d; ref %f;\n", joints[j], refs[j]); fflush(stdout);
2106 for(
int j=0; j<n_joint; j++)
2115 if(verbose >= VERY_VERBOSE)
2116 yCTrace(FAKEMOTIONCONTROL) <<
"n_joint " << _njoints;
2119 for(
int j=0; j<n_joint; j++)
2128 if(verbose >= VERY_VERBOSE)
2129 yCTrace(FAKEMOTIONCONTROL) <<
"n_joint " << _njoints;
2133 bool tot_val =
true;
2135 for(
int j=0; j<n_joint; j++)
2146 if(verbose >= VERY_VERBOSE)
2147 yCTrace(FAKEMOTIONCONTROL) <<
"n_joint " << _njoints;
2150 for(
int j=0; j<n_joint; j++)
2159 if(verbose >= VERY_VERBOSE)
2160 yCTrace(FAKEMOTIONCONTROL) <<
"n_joint " << _njoints;
2163 for(
int j=0; j<n_joint; j++)
2172 if(verbose >= VERY_VERBOSE)
2173 yCTrace(FAKEMOTIONCONTROL) <<
"n_joint " << _njoints;
2176 for(
int j=0; j<n_joint; j++)
2185 if(verbose >= VERY_VERBOSE)
2186 yCTrace(FAKEMOTIONCONTROL) <<
"n_joint " << _njoints;
2189 for(
int j=0; j<n_joint; j++)
2198 if(verbose >= VERY_VERBOSE)
2199 yCTrace(FAKEMOTIONCONTROL) <<
"n_joint " << _njoints;
2202 for(
int j=0; j<n_joint; j++)
2216 if(verbose > VERY_VERY_VERBOSE)
2217 yCTrace(FAKEMOTIONCONTROL) <<
"j: " << j;
2219 *v = _controlModes[j];
2227 for(
int j=0; j< _njoints; j++)
2237 for(
int j=0; j< n_joint; j++)
2251 if(verbose >= VERY_VERBOSE)
2260 _controlModes[j] = _mode;
2262 _posCtrl_references[j] = pos[j];
2269 if(verbose >= VERY_VERBOSE)
2270 yCTrace(FAKEMOTIONCONTROL) <<
"n_joints: " << n_joint;
2273 for(
int i=0; i<n_joint; i++)
2282 if(verbose >= VERY_VERBOSE)
2286 for(
int i=0; i<_njoints; i++)
2330 for(
int j=0; j< _njoints; j++)
2349 for(
int j=0; j< _njoints; j++)
2367 for(
int j=0; j< _njoints; j++)
2380 for(
int i=0; i<_njoints; i++)
2381 stamps[i] = _encodersStamp[i];
2390 *stamp = _encodersStamp[j];
2443 for(
int j=0; j< _njoints; j++)
2460 for(
int j=0; j< _njoints; j++)
2476 for(
int j=0; j< _njoints; j++)
2487 for(
int i=0; i<_njoints; i++)
2488 stamps[i] = _encodersStamp[i];
2498 *stamp = _encodersStamp[m];
2520 *value = current[j];
2528 for(
int j=0; j< _njoints; j++)
2537 maxCurrent[m] = val;
2543 *val = maxCurrent[m];
2549 (_enabledAmp[j ]) ? *st = 1 : *st = 0;
2556 for(
int j=0; j<_njoints; j++)
2558 sts[j] = _enabledAmp[j];
2565 *val = peakCurrent[m];
2571 peakCurrent[m] = val;
2577 *val = nominalCurrent[m];
2583 nominalCurrent[m] = val;
2607 *val = supplyVoltage[m];
2656 yCError(FAKEMOTIONCONTROL,
"getKinematicMJRaw not yet implemented");
2692 if (axis >= 0 && axis < _njoints)
2694 name = _axisName[axis];
2706 if (axis >= 0 && axis < _njoints)
2708 type = _jointType[axis];
2726 *max = _maxJntCmdVelocity[axis];
2740 for (
int i = 0; i < _njoints; i++)
2760 for(
int j=0; j<_njoints &&
ret; j++)
2812 params->
bemf = _kbemf[j];
2814 params->
ktau = _ktau[j];
2822 _kbemf[j] = params.
bemf;
2823 _ktau[j] = params.
ktau;
2834 for(
int i=0; i<n_joint; i++)
2844 _posDir_references[j] = ref;
2850 for(
int i=0; i< n_joint; i++)
2852 _posDir_references[joints[i]] = refs[i];
2859 for(
int i=0; i< _njoints; i++)
2861 _posDir_references[i] = refs[i];
2869 if(verbose >= VERY_VERBOSE)
2870 yCTrace(FAKEMOTIONCONTROL) <<
"j " << axis <<
" ref " << _posCtrl_references[axis];
2878 yCWarning(FAKEMOTIONCONTROL) <<
"getTargetPosition: Joint " << axis <<
" is not in POSITION mode, therefore the value returned by " <<
2879 "this call is for reference only and may not reflect the actual behaviour of the motor/firmware.";
2881 *ref = _posCtrl_references[axis];
2888 for(
int i=0; i<_njoints; i++)
2896 for (
int i = 0; i<nj; i++)
2905 *ref = _command_speeds[axis];
2912 for (
int i = 0; i<_njoints; i++)
2922 for (
int i = 0; i<nj; i++)
2938 yCWarning(FAKEMOTIONCONTROL) <<
"getRefPosition: Joint " << axis <<
" is not in POSITION_DIRECT mode, therefore the value returned by \
2939 this call is for reference only and may not reflect the actual behaviour of the motor/firmware.";
2942 *ref = _posDir_references[axis];
2950 for (
int i = 0; i<_njoints; i++)
2960 for (
int i = 0; i<nj; i++)
2971 if(verbose > VERY_VERY_VERBOSE)
2972 yCTrace(FAKEMOTIONCONTROL) <<
"j: " << j;
2980 for(
int j=0; j< n_joints; j++)
2991 for(
int j=0; j<_njoints; j++)
3001 if(verbose >= VERY_VERBOSE)
3004 _interactMode[j] = _mode;
3013 for(
int i=0; i<n_joints; i++)
3023 for(
int i=0; i<_njoints; i++)
3045 for(
int j=0; j< _njoints; j++)
3073 for (
int i = 0; i < _njoints; i++)
3088 for (
int i = 0; i < _njoints; i++)
3103 for (
int i = 0; i < _njoints; i++)
3125 *min = _ref_currents[j] / 100;
3126 *max = _ref_currents[j] * 100;
3133 for (
int i = 0; i < _njoints; i++)
3135 min[i] = _ref_currents[i] / 100;
3136 max[i] = _ref_currents[i] * 100;
3143 for (
int i = 0; i < _njoints; i++)
3145 _ref_currents[i] =
t[i];
3146 current[i] =
t[i] / 2;
3153 _ref_currents[j] =
t;
3161 for (
int j = 0; j<n_joint; j++)
3170 for (
int i = 0; i < _njoints; i++)
3172 t[i] = _ref_currents[i];
3179 *
t = _ref_currents[j];
3200 for (
int i = 0; i < _njoints; i++)
3202 measure[i] = _torques[i];
3209 _torques[ch] = measure;
void checkAndDestroy(T *&p)
constexpr yarp::conf::vocab32_t VOCAB_CM_MIXED
constexpr yarp::conf::vocab32_t VOCAB_CM_PWM
constexpr yarp::conf::vocab32_t VOCAB_CM_IMPEDANCE_VEL
constexpr yarp::conf::vocab32_t VOCAB_CM_IDLE
constexpr yarp::conf::vocab32_t VOCAB_CM_POSITION
constexpr yarp::conf::vocab32_t VOCAB_CM_IMPEDANCE_POS
constexpr yarp::conf::vocab32_t VOCAB_CM_POSITION_DIRECT
constexpr yarp::conf::vocab32_t VOCAB_CM_VELOCITY
constexpr yarp::conf::vocab32_t VOCAB_CM_FORCE_IDLE
bool getPowerSupplyVoltageRaw(int j, double *val) override
bool getRefSpeedRaw(int j, double *ref) override
Get reference speed for a joint.
virtual bool getHasTempSensorsRaw(int j, int &ret)
bool setRefCurrentsRaw(const double *t) override
Set the reference value of the currents for all motors.
bool setRefTorqueRaw(int j, double t) override
Set the reference value of the torque for a given joint.
bool getCurrentsRaw(double *vals) override
bool getImpedanceOffsetRaw(int j, double *offset) override
Get current force Offset for a specific joint.
bool getTargetPositionRaw(const int joint, double *ref) override
Get the last position reference for the specified axis.
bool getTorqueRangeRaw(int j, double *min, double *max) override
Get the full scale of the torque sensor of a given joint.
bool getCurrentImpedanceLimitRaw(int j, double *min_stiff, double *max_stiff, double *min_damp, double *max_damp) override
Get the current impedandance limits for a specific joint.
bool setTemperatureLimitRaw(int m, const double temp) override
Set the temperature limit for a specific motor.
bool getPidErrorRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *err) override
Get the current error for a joint.
bool setPeakCurrentRaw(int m, const double val) override
bool velocityMoveRaw(int j, double sp) override
Start motion at a given speed, single joint.
bool checkMotionDoneRaw(bool *flag) override
Check if the current trajectory is terminated.
bool getMotorEncoderSpeedRaw(int m, double *sp) override
Read the istantaneous speed of a motor encoder.
virtual bool getJointEncoderTypeRaw(int j, int &type)
bool setRefDutyCycleRaw(int j, double v) override
Sets the reference dutycycle of a single motor.
bool getTemperatureRaw(int m, double *val) override
Get temperature of a motor.
bool getEncoderAccelerationRaw(int j, double *spds) override
Read the instantaneous acceleration of an axis.
bool getRefAccelerationRaw(int j, double *acc) override
Get reference acceleration for a joint.
bool getMotorEncoderSpeedsRaw(double *spds) override
Read the instantaneous speed of all motor encoders.
bool setPidsRaw(const yarp::dev::PidControlTypeEnum &pidtype, const yarp::dev::Pid *pids) override
Set new pid value on multiple axes.
bool setVelLimitsRaw(int axis, double min, double max) override
Set the software speed limits for a particular axis, the behavior of the control card when these limi...
bool getJointTypeRaw(int axis, yarp::dev::JointTypeEnum &type) override
bool setMotorEncoderRaw(int m, const double val) override
Set the value of the motor encoder for a given motor.
bool getPidErrorLimitRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *limit) override
Get the error limit for the controller on a specific joint.
bool getPidOutputRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *out) override
Get the output of the controller (e.g.
bool setControlModeRaw(const int j, const int mode) override
bool getMotorEncoderAccelerationRaw(int m, double *spds) override
Read the instantaneous acceleration of a motor encoder.
bool open(yarp::os::Searchable &par) override
Open the DeviceDriver.
virtual bool getHasHallSensorRaw(int j, int &ret)
bool getTemperatureLimitRaw(int m, double *temp) override
Retreives the current temperature limit for a specific motor.
bool getNumberOfMotorsRaw(int *num) override
Retrieves the number of controlled motors from the current physical interface.
bool disableAmpRaw(int j) override
Disable the amplifier on a specific joint.
bool setMotorTorqueParamsRaw(int j, const yarp::dev::MotorTorqueParameters params) override
Set the motor parameters.
bool calibrateAxisWithParamsRaw(int axis, unsigned int type, double p1, double p2, double p3) override
Start calibration, this method is very often platform specific.
bool setRefAccelerationRaw(int j, double acc) override
Set reference acceleration for a joint.
virtual bool initialised()
bool setEncodersRaw(const double *vals) override
Set the value of all encoders.
bool getPidOutputsRaw(const yarp::dev::PidControlTypeEnum &pidtype, double *outs) override
Get the output of the controllers (e.g.
bool isPidEnabledRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, bool *enabled) override
Get the current status (enabled/disabled) of the pid controller.
bool setRefSpeedsRaw(const double *spds) override
Set reference speed on all joints.
bool getTargetPositionsRaw(double *refs) override
Get the last position reference for all axes.
bool getRefDutyCycleRaw(int j, double *v) override
Gets the last reference sent using the setRefDutyCycleRaw function.
bool setMotorEncoderCountsPerRevolutionRaw(int m, const double cpr) override
Sets number of counts per revolution for motor encoder m.
bool setPidErrorLimitsRaw(const yarp::dev::PidControlTypeEnum &pidtype, const double *limits) override
Get the error limit for the controller on all joints.
bool getPidReferenceRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *ref) override
Get the current reference of the pid controller for a specific joint.
bool getNominalCurrentRaw(int m, double *val) override
bool getControlModeRaw(int j, int *v) override
bool calibrationDoneRaw(int j) override
Check if the calibration is terminated, on a particular joint.
bool threadInit() override
Initialization method.
bool getRefDutyCyclesRaw(double *v) override
Gets the last reference sent using the setRefDutyCyclesRaw function.
bool getRefVelocityRaw(const int joint, double *ref) override
Get the last reference speed set by velocityMove for single joint.
bool getEncoderTimedRaw(int j, double *encs, double *stamp) override
Read the instantaneous acceleration of all axes.
bool disablePidRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j) override
Disable the pid computation for a joint.
yarp::dev::VAS_status getVirtualAnalogSensorStatusRaw(int ch) override
Check the status of a given channel.
bool getMotorEncodersRaw(double *encs) override
Read the position of all motor encoders.
bool getTorqueRangesRaw(double *min, double *max) override
Get the full scale of the torque sensors of all joints.
bool getRefCurrentsRaw(double *t) override
Get the reference value of the currents for all motors.
bool setRefDutyCyclesRaw(const double *v) override
Sets the reference dutycycle for all motors.
bool getEncoderSpeedRaw(int j, double *sp) override
Read the instantaneous speed of an axis.
int getVirtualAnalogSensorChannelsRaw() override
Get the number of channels of the virtual sensor.
bool resetPidRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j) override
Reset the controller of a given joint, usually sets the current status of the joint as the reference ...
bool getCurrentRangesRaw(double *min, double *max) override
Get the full scale of the current measurements for all motors motor (e.g.
bool getEncoderRaw(int j, double *v) override
Read the value of an encoder.
bool getPidErrorLimitsRaw(const yarp::dev::PidControlTypeEnum &pidtype, double *limits) override
Get the error limit for all controllers.
bool enableAmpRaw(int j) override
Enable the amplifier on a specific joint.
bool fromConfig(yarp::os::Searchable &config)
bool getPidsRaw(const yarp::dev::PidControlTypeEnum &pidtype, yarp::dev::Pid *pids) override
Get current pid value for a specific joint.
bool getRefPositionsRaw(double *refs) override
Get the last position reference for all axes.
bool getMotorTorqueParamsRaw(int j, yarp::dev::MotorTorqueParameters *params) override
Get the motor parameters.
bool setControlModesRaw(const int n_joint, const int *joints, int *modes) override
bool setRefSpeedRaw(int j, double sp) override
Set reference speed for a joint, this is the speed used during the interpolation of the trajectory.
virtual bool getHasRotorEncoderIndexRaw(int j, int &ret)
bool updateVirtualAnalogSensorMeasureRaw(yarp::sig::Vector &measure) override
Set a vector of torque values for virtual sensor.
void resizeBuffers()
Resize previously allocated buffers.
void threadRelease() override
Release method.
bool getAmpStatusRaw(int *st) override
bool setImpedanceRaw(int j, double stiffness, double damping) override
Set current impedance parameters (stiffness,damping) for a specific joint.
bool setPWMLimitRaw(int j, const double val) override
bool relativeMoveRaw(int j, double delta) override
Set relative position.
virtual bool getMotorPolesRaw(int j, int &poles)
bool getPidRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, yarp::dev::Pid *pid) override
Get current pid value for a specific joint.
bool getCurrentRaw(int j, double *val) override
bool getPeakCurrentRaw(int m, double *val) override
bool getDutyCyclesRaw(double *v) override
Gets the current dutycycle of the output of the amplifier (i.e.
bool setEncoderRaw(int j, double val) override
Set the value of the encoder for a given joint.
bool getRefPositionRaw(const int joint, double *ref) override
Get the last position reference for the specified axis.
bool getLimitsRaw(int axis, double *min, double *max) override
Get the software limits for a particular axis.
virtual bool getRotorIndexOffsetRaw(int j, double &rotorOffset)
bool getVelLimitsRaw(int axis, double *min, double *max) override
Get the software speed limits for a particular axis.
bool setPositionsRaw(const int n_joint, const int *joints, const double *refs) override
Set new reference point for all axes.
bool setPidReferenceRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, double ref) override
Set the controller reference for a given axis.
bool resetEncodersRaw() override
Reset encoders.
bool getPWMRaw(int j, double *val) override
bool getAxisNameRaw(int axis, std::string &name) override
bool setCalibrationParametersRaw(int axis, const yarp::dev::CalibrationParameters ¶ms) override
Start calibration, this method is very often platform specific.
bool setPidOffsetRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, double v) override
Set an offset value on the ourput of pid controller.
bool getInteractionModeRaw(int j, yarp::dev::InteractionModeEnum *_mode) override
Get the current interaction mode of the robot, values can be stiff or compliant.
bool getCurrentRangeRaw(int j, double *min, double *max) override
Get the full scale of the current measurement for a given motor (e.g.
bool stopRaw() override
Stop motion, multiple joints.
virtual bool getKinematicMJRaw(int j, double &rotres)
bool getRefSpeedsRaw(double *spds) override
Get reference speed of all joints.
bool getRefAccelerationsRaw(double *accs) override
Get reference acceleration of all joints.
virtual bool getJointEncoderResolutionRaw(int m, double &jntres)
bool getAxes(int *ax) override
Get the number of controlled axes.
bool setMaxCurrentRaw(int j, double val) override
bool alloc(int njoints)
Allocated buffers.
bool resetMotorEncodersRaw() override
Reset motor encoders.
bool setRefTorquesRaw(const double *t) override
Set the reference value of the torque for all joints.
bool getEncodersRaw(double *encs) override
Read the position of all axes.
bool setRefAccelerationsRaw(const double *accs) override
Set reference acceleration on all joints.
bool getControlModesRaw(int *v) override
bool setPidRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, const yarp::dev::Pid &pid) override
Set new pid value for a joint axis.
bool getPWMLimitRaw(int j, double *val) override
virtual bool getRotorEncoderTypeRaw(int j, int &type)
bool getRefCurrentRaw(int j, double *t) override
Get the reference value of the current for a single motor.
bool getDutyCycleRaw(int j, double *v) override
Gets the current dutycycle of the output of the amplifier (i.e.
bool setPidErrorLimitRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, double limit) override
Set the error limit for the controller on a specific joint.
bool getInteractionModesRaw(int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
Get the current interaction mode of the robot for a set of joints, values can be stiff or compliant.
bool positionMoveRaw(int j, double ref) override
Set new reference point for a single axis.
bool getMotorEncoderCountsPerRevolutionRaw(int m, double *v) override
Gets number of counts per revolution for motor encoder m.
bool setImpedanceOffsetRaw(int j, double offset) override
Set current force Offset for a specific joint.
bool setMotorEncodersRaw(const double *vals) override
Set the value of all motor encoders.
bool getPidErrorsRaw(const yarp::dev::PidControlTypeEnum &pidtype, double *errs) override
Get the error of all joints.
bool getGearboxRatioRaw(int m, double *gearbox) override
Get the gearbox ratio for a specific motor.
bool getMaxCurrentRaw(int j, double *val) override
Returns the maximum electric current allowed for a given motor.
bool close() override
Close the DeviceDriver.
bool getRefTorquesRaw(double *t) override
Get the reference value of the torque for all joints.
bool setRefCurrentRaw(int j, double t) override
Set the reference value of the current for a single motor.
bool getNumberOfMotorEncodersRaw(int *num) override
Get the number of available motor encoders.
bool getPidReferencesRaw(const yarp::dev::PidControlTypeEnum &pidtype, double *refs) override
Get the current reference of all pid controllers.
bool getTorqueRaw(int j, double *t) override
Get the value of the torque on a given joint (this is the feedback if you have a torque sensor).
bool getImpedanceRaw(int j, double *stiffness, double *damping) override
Get current impedance parameters (stiffness,damping,offset) for a specific joint.
bool enablePidRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j) override
Enable the pid computation for a joint.
bool getRefVelocitiesRaw(double *refs) override
Get the last reference speed set by velocityMove for all joints.
bool setPositionRaw(int j, double ref) override
Set new position for a single axis.
bool getEncoderAccelerationsRaw(double *accs) override
Read the instantaneous acceleration of all axes.
bool setPidReferencesRaw(const yarp::dev::PidControlTypeEnum &pidtype, const double *refs) override
Set the controller reference, multiple axes.
bool getMotorEncoderRaw(int m, double *v) override
Read the value of a motor encoder.
bool getRefTorqueRaw(int j, double *t) override
Set the reference value of the torque for a given joint.
bool getMotorEncoderAccelerationsRaw(double *accs) override
Read the instantaneous acceleration of all motor encoders.
bool setInteractionModesRaw(int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
Set the interaction mode of the robot for a set of joints, values can be stiff or compliant.
bool getTemperaturesRaw(double *vals) override
Get temperature of all the motors.
bool resetMotorEncoderRaw(int m) override
Reset motor encoder, single motor.
bool setNominalCurrentRaw(int m, const double val) override
virtual bool getRotorEncoderResolutionRaw(int m, double &rotres)
virtual bool getHasRotorEncoderRaw(int j, int &ret)
bool getMotorEncodersTimedRaw(double *encs, double *stamps) override
Read the instantaneous position of all motor encoders.
bool resetEncoderRaw(int j) override
Reset encoder, single joint.
bool getTorquesRaw(double *t) override
Get the value of the torque for all joints (this is the feedback if you have torque sensors).
bool setLimitsRaw(int axis, double min, double max) override
Set the software limits for a particular axis, the behavior of the control card when these limits are...
bool setInteractionModeRaw(int j, yarp::dev::InteractionModeEnum _mode) override
Set the interaction mode of the robot, values can be stiff or compliant.
void run() override
Loop function.
bool getMotorEncoderTimedRaw(int m, double *encs, double *stamp) override
Read the instantaneous position of a motor encoder.
bool getEncodersTimedRaw(double *encs, double *stamps) override
Read the instantaneous acceleration of all axes.
bool getEncoderSpeedsRaw(double *spds) override
Read the instantaneous acceleration of an axis.
virtual bool getTorqueControlFilterType(int j, int &type)
class ImplementControlLimits; class StubImplControlLimitsRaw;
Interface settings the way the robot interacts with the environment: basic interaction types are Stif...
Default implementation of the IPositionControl interface.
Default implementation of the IPositionDirect interface.
Contains the parameters for a PID.
double scale
scale for the pid output
double offset
pwm offset added to the pid output
double stiction_down_val
down stiction offset added to the pid output
double stiction_up_val
up stiction offset added to the pid output
double max_output
max output
double kff
feedforward gain
double ki
integrative gain
double max_int
saturation threshold for the integrator
double kp
proportional gain
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.
Bottle & findGroup(const std::string &key) const override
Gets a list corresponding to a given keyword.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
bool isNull() const override
Checks if the object is invalid.
An abstraction for a periodic thread.
bool start()
Call this to start the thread.
A base class for nested structures that can be searched.
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.
A single value (typically within a Bottle).
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
virtual bool isFloat64() const
Checks if value is a 64-bit floating point number.
virtual bool isInt32() const
Checks if value is a 32-bit integer.
virtual std::string asString() const
Get string value.
void resize(size_t size) override
Resize the vector.
T * data()
Return a pointer to the first element of the vector.
#define OPENLOOP_WATCHDOG
std::string toString(const T &value)
convert an arbitrary type to string.
static bool NOT_YET_IMPLEMENTED(const char *txt)
static bool DEPRECATED(const char *txt)
#define VELOCITY_WATCHDOG
#define yCInfo(component,...)
#define yCError(component,...)
#define yCTrace(component,...)
#define yCWarning(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
std::string getEnvironment(const char *key, bool *found=nullptr)
Read a variable from the environment.
An interface for the device drivers.
@ VOCAB_JOINTTYPE_REVOLUTE
@ VOCAB_JOINTTYPE_PRISMATIC
@ VOCAB_JOINTTYPE_UNKNOWN
double now()
Return the current time in seconds, relative to an arbitrary starting point.
std::string decode(NetInt32 code)
Convert a vocabulary identifier into a string.
The components from which ports and connections are built.
An interface to the operating system, including Port based communication.
VectorOf< double > Vector