Loading [MathJax]/extensions/tex2jax.js
iCub-main
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
embObjMotionControl.h
Go to the documentation of this file.
1// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3
4/* Copyright (C) 2012 iCub Facility, Istituto Italiano di Tecnologia
5 * Author: Alberto Cardellino
6 * email: alberto.cardellino@iit.it
7 * Permission is granted to copy, distribute, and/or modify this program
8 * under the terms of the GNU General Public License, version 2 or any
9 * later version published by the Free Software Foundation.
10 *
11 * A copy of the license can be found at
12 * http://www.robotcub.org/icub/license/gpl.txt
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17 * Public License for more details
18 */
19
20
21
22
23//
24// $Id: embObjMotionControl.h,v 1.5 2008/06/25 22:33:53 nat Exp $
25//
26
27#ifndef __embObjMotionControlh__
28#define __embObjMotionControlh__
29
30
31using namespace std;
32
33// system std include
34#include <string>
35#include <mutex>
36#include <math.h>
37// Yarp stuff
38#include <yarp/os/Bottle.h>
39#include <yarp/os/BufferedPort.h>
40#include <yarp/os/Timer.h>
41#include <yarp/dev/DeviceDriver.h>
42#include <yarp/dev/PolyDriver.h>
43#include <yarp/dev/ControlBoardHelper.h>
44
45#include <yarp/dev/IVirtualAnalogSensor.h>
46
47#include<yarp/dev/ImplementJointFault.h>
48
49#include <abstractEthResource.h>
50
52
53// local include
54#include "IethResource.h"
55#include"EoError.h"
56#include <ethManager.h>
57
58#include "serviceParser.h"
59#include "eomcParser.h"
60#include "measuresConverter.h"
61
62#include "mcEventDownsampler.h"
63#include "ethParser.h"
64
65
66#ifdef NETWORK_PERFORMANCE_BENCHMARK
68#endif
69
70// - public #define --------------------------------------------------------------------------------------------------
71
72#undef VERIFY_ROP_SETIMPEDANCE // this macro let you send setimpedence rop with signature.
73 // if you want use this feature, you should compiled ems firmware with same macro.
74#undef VERIFY_ROP_SETPOSITIONRAW // this macro let you send setposition rop with signature.
75 // if you want use this feature, yuo should compiled ems firmware with same macro.
76
77// marco.accame: we dont manage mais anymore from the embObjMotionControl class.
78// the mais is now initted by the ems board with default params (datarate = 10, mode = eoas_maismode_txdatacontinuously)
79// and never swicthed off.
80// only embObjAnalog can override its behaviour
81
82#define EMBOBJMC_DONT_USE_MAIS
83
84//
85// helper structures
86//
87namespace yarp {
88 namespace dev {
89 namespace eomc {
90
91typedef struct
92{
93 vector<int> joint2set;
94 vector <vector <int> > set2joint;
96 vector<eOmc_jointset_configuration_t> jointset_cfgs;
98
99typedef struct
100{
101 eOmc_encoder_t type;
102 double tolerance;
104} encoder_t;
105
112
113typedef struct // this struct is used to store the configuration of flags and value for maintenance mode
114{
117
119{
120
121private:
122
123bool _isStarted;
124uint32_t _count;
125double _time;
126double _abstime;
127uint32_t _threshold; // use 10000 as limit on the watchdog for the error on the temperature sensor receiving of the values -
128 // since the ETH callback timing is 2ms by default so using 10000 we can set a checking threshould of 5 second
129 // in which we can allow the tdb to not respond. If cannot receive response over 1s we trigger the error
130public:
131
132Watchdog(): _count(0), _isStarted(false), _threshold(60000), _time(0), _abstime(yarp::os::Time::now()){;}
133Watchdog(uint32_t threshold):_count(0), _isStarted(false), _threshold(threshold), _time(0), _abstime(yarp::os::Time::now()){;}
134~Watchdog() = default;
135Watchdog(const Watchdog& other) = default;
136Watchdog(Watchdog&& other) noexcept = default;
137Watchdog& operator=(const Watchdog& other) = default;
138Watchdog& operator=(Watchdog&& other) noexcept = default;
139
140
141bool isStarted(){return _isStarted;}
142void start() {_count = 0; _time = yarp::os::Time::now(); _isStarted = true;}
143bool isExpired() {return (_count >= _threshold);}
144void increment() {++_count;}
145void clear(){_isStarted=false;}
146double getStartTime() {return _time;}
147uint32_t getCount() {return _count; }
148void setThreshold(uint8_t txrateOfRegularROPs){ if(txrateOfRegularROPs != 0) _threshold = _threshold / txrateOfRegularROPs;}
149uint32_t getThreshold(){return _threshold;}
150double getAbsoluteTime(){return _abstime;}
151
152};
153
155{
156private:
157 uint32_t _threshold; // threshold for the delta between current and previous temperature --> set to 20 Celsius deg by default --> over 20 deg delta spike
158 double _motorTempPrev; // motor temperature at previous instant for checking positive temperature spikes
159 bool _isStarted;
160 int32_t _initCounter;
161 std::vector<double> _initTempBuffer;
162public:
163 TemperatureFilter(): _threshold(20), _isStarted(false), _initCounter(50), _initTempBuffer(0), _motorTempPrev(0){;}
164 TemperatureFilter(uint32_t threshold, int32_t initCounter): _threshold(threshold), _isStarted(false), _initCounter(initCounter), _initTempBuffer(0), _motorTempPrev(0){;}
166 TemperatureFilter(const TemperatureFilter& other) = default;
167 TemperatureFilter(TemperatureFilter&& other) noexcept = default;
169 TemperatureFilter& operator=(TemperatureFilter&& other) noexcept = default;
170
171 bool isStarted(){return _isStarted;}
172 uint32_t getTemperatureThreshold() {return _threshold; }
173 double getPrevTemperature(){return _motorTempPrev;}
174 void updatePrevTemperature(double temperature){_motorTempPrev = temperature;}
175 void start(double temperature)
176 {
177 if(_initCounter < 0)
178 {
179 int median_pos = std::ceil(_initTempBuffer.size() / 2) -1;
180 _motorTempPrev = _initTempBuffer.at(median_pos);
181 _isStarted = true;
182 }
183 else
184 {
185 _initTempBuffer.push_back(temperature);
186 --_initCounter;
187 }
188
189 }
190};
191
192}}}
193
194namespace yarp {
195 namespace dev {
197 }
198}
199
200
202{
203 eOmn_serv_diagn_cfg_t config;
204 std::vector<BufferedPort<Bottle>*> ports;
205};
206
207using namespace yarp::dev;
208using namespace iCub;
209
210
230class yarp::dev::embObjMotionControl: public DeviceDriver,
231 public IPidControlRaw,
232 public IControlCalibrationRaw,
233 public IAmplifierControlRaw,
234 public IEncodersTimedRaw,
235 public IMotorEncodersRaw,
236 public ImplementEncodersTimed,
237 public ImplementMotorEncoders,
238 public IMotorRaw,
239 public ImplementMotor,
240 public IPositionControlRaw,
241 public IVelocityControlRaw,
242 public IControlModeRaw,
243 public ImplementControlMode,
244 public IControlLimitsRaw,
245 public IImpedanceControlRaw,
246 public ImplementImpedanceControl,
247 public ImplementControlLimits,
248 public ImplementAmplifierControl,
249 public ImplementPositionControl,
250 public ImplementControlCalibration,
251 public ImplementPidControl,
252 public ImplementVelocityControl,
253 public ITorqueControlRaw,
254 public ImplementTorqueControl,
255 public IVirtualAnalogSensor,
256 public IPositionDirectRaw,
257 public ImplementPositionDirect,
258 public IInteractionModeRaw,
259 public ImplementInteractionMode,
260 public IRemoteVariablesRaw,
261 public ImplementRemoteVariables,
262 public IAxisInfoRaw,
263 public ImplementAxisInfo,
264 public IPWMControlRaw,
265 public ImplementPWMControl,
266 public ICurrentControlRaw,
267 public ImplementCurrentControl,
268 public eth::IethResource,
269 public IJointFaultRaw,
270 public ImplementJointFault,
272 {
273private:
274 eth::TheEthManager* ethManager;
276 ServiceParser* parser;
277 eomc::Parser * _mcparser;
278 ControlBoardHelper* _measureConverter;
279 std::mutex _mutex;
280
281 bool opened; //internal state
282
283 MCdiagnostics mcdiagnostics;
284
286 int _njoints;
287 eomc::behaviour_flags_t behFlags;
288 servConfigMC_t serviceConfig;
289 double * _gearbox_M2J;
290 double * _gearbox_E2J;
291 double * _deadzone;
292 std::vector<eomc::kalmanFilterParams_t> _kalman_params;
293 eomc::maintenanceModeCfg_t _maintenanceModeCfg;
295 std::vector<std::unique_ptr<eomc::ITemperatureSensor>> _temperatureSensorsVector;
296
297 eomc::focBasedSpecificInfo_t * _foc_based_info;
298
299 std::vector<eomc::encoder_t> _jointEncs;
300 std::vector<eomc::encoder_t> _motorEncs;
301
302 std::vector<eomc::rotorLimits_t> _rotorsLimits;
303 std::vector<eomc::jointLimits_t> _jointsLimits;
304 std::vector<eomc::motorCurrentLimits_t> _currentLimits;
305 std::vector<eomc::temperatureLimits_t> _temperatureLimits;
306 eomc::couplingInfo_t _couplingInfo;
307 std::vector<eomc::JointsSet> _jsets;
308 std::vector<int> _joint2set;
309 std::vector<eomc::timeouts_t> _timeouts;
310
311 std::vector<eomc::impedanceParameters_t> _impedance_params; // TODO doubled!!! optimize using just one of the 2!!!
312 std::vector<eomc::lugreParameters_t> _lugre_params;
313 eomc::impedanceLimits_t * _impedance_limits;
316 eomc::PidInfo * _trj_pids;
317 //eomc::PidInfo * _dir_pids;
318 eomc::TrqPidInfo * _trq_pids;
319 eomc::PidInfo * _cur_pids;
320 eomc::PidInfo * _spd_pids;
321
322 int * _axisMap;
323 std::vector<eomc::axisInfo_t> _axesInfo;
325
326 // event downsampler
327 mced::mcEventDownsampler* event_downsampler;
328
330
331#ifdef VERIFY_ROP_SETIMPEDANCE
332 uint32_t *impedanceSignature;
333#endif
334
335#ifdef VERIFY_ROP_SETPOSITIONRAW
336 uint32_t *refRawSignature;
337 bool *sendingDirects;
338#endif
339
340
341
342 double SAFETY_THRESHOLD;
343
344
345 // internal stuff
346 bool *_enabledAmp; // Middle step toward a full enabled motor controller. Amp (pwm) plus Pid enable command must be sent in order to get the joint into an active state.
347 bool *_enabledPid; // Depends on enabledAmp. When both are set, the joint exits the idle mode and goes into position mode. If one of them is disabled, it falls to idle.
348 bool *_calibrated; // Flag to know if the calibrate function has been called for the joint
349 double *_ref_command_positions;// used for position control.
350 double *_ref_speeds; // used for position control.
351 double *_ref_command_speeds; // used for velocity control.
352 double *_ref_positions; // used for direct position control.
353 double *_ref_accs; // for velocity control, in position min jerk eq is used.
354 double *_encodersStamp;
355 bool *checking_motiondone; /* flag telling if I'm already waiting for motion done */
356 #define MAX_POSITION_MOVE_INTERVAL 0.080
357 double *_last_position_move_time;
358 eOmc_impedance_t *_cacheImpedance; /* cache impedance value to split up the 2 sets */
359 std::vector<yarp::dev::eomc::Watchdog> _temperatureSensorErrorWatchdog; /* counter used to filter error coming from tdb reading fromm 2FOC board*/
360 std::vector<yarp::dev::eomc::Watchdog> _temperatureExceededLimitWatchdog; /* counter used to filter the print of the exeded limits*/
361 std::vector<yarp::dev::eomc::TemperatureFilter> _temperatureSpikesFilter;
362
363 std::map<std::string, rawValuesKeyMetadata> _rawValuesMetadataMap;
364 std::vector<std::int32_t> _rawDataAuxVector;
365
366#ifdef NETWORK_PERFORMANCE_BENCHMARK
367 Tools:Emb_RensponseTimingVerifier m_responseTimingVerifier;
368#endif
369
370private:
371
372 std::string getBoardInfo(void);
373 bool askRemoteValue(eOprotID32_t id32, void* value, uint16_t& size);
374 template <class T>
375 bool askRemoteValues(eOprotEndpoint_t ep, eOprotEntity_t entity, eOprotTag_t tag, std::vector<T>& values);
376 bool checkRemoteControlModeStatus(int joint, int target_mode);
377
378 bool dealloc();
379
380
381 bool verifyUserControlLawConsistencyInJointSet(eomc::PidInfo *ipdInfo);
382 bool verifyUserControlLawConsistencyInJointSet(eomc::TrqPidInfo *pidInfo);
383 bool verifyTorquePidshasSameUnitTypes(yarp::dev::PidFeedbackUnitsEnum &fbk_pidunits, yarp::dev::PidOutputUnitsEnum& out_pidunits);
384 bool verifyUseMotorSpeedFbkInJointSet(int useMotorSpeedFbk []);
385 bool updatedJointsetsCfgWithControlInfo(void);
386 bool saveCouplingsData(void);
387 void debugUtil_printJointsetInfo(void);
388
389 bool isTorqueControlEnabled(int joint);
390 bool isVelocityControlEnabled(int joint);
391
392 bool iNeedCouplingsInfo(void); //the device needs coupling info if it manages joints controlled by 2foc and mc4plus.
393
394 bool getJointConfiguration(int joint, eOmc_joint_config_t *jntCfg_ptr);
395 bool getMotorConfiguration(int axis, eOmc_motor_config_t *motCfg_ptr);
396 bool getGerabox_E2J(int joint, double *gearbox_E2J_ptr);
397 bool getJointEncTolerance(int joint, double *jEncTolerance_ptr);
398 bool getMotorEncTolerance(int axis, double *mEncTolerance_ptr);
399 void updateDeadZoneWithDefaultValues(void);
400 bool getJointDeadZoneRaw(int j, double &jntDeadZone);
401
402private:
403
404 //functions used in init this object
405 bool fromConfig(yarp::os::Searchable &config);
406 int fromConfig_NumOfJoints(yarp::os::Searchable &config);
407 bool fromConfig_getGeneralInfo(yarp::os::Searchable &config); //get general info: useRawEncoderData, useLiitedPwm, etc....
408 bool fromConfig_Step2(yarp::os::Searchable &config);
409 bool fromConfig_readServiceCfg(yarp::os::Searchable &config);
410 bool initializeInterfaces(measureConvFactors &f);
411 bool alloc(int njoints);
412 bool init(void);
413
414 //function used in the closing this object
415 void cleanup(void);
416
417 //used in pid interface
418 bool helper_setPosPidRaw( int j, const Pid &pid);
419 bool helper_getPosPidRaw(int j, Pid *pid);
420 bool helper_getPosPidsRaw(Pid *pid);
421
422 //used in torque control interface
423 bool helper_setTrqPidRaw( int j, const Pid &pid);
424 bool helper_getTrqPidRaw(int j, Pid *pid);
425 bool helper_getTrqPidsRaw(Pid *pid);
426
427 //used in velocity control interface
428 bool helper_setVelPidRaw( int j, const Pid &pid);
429 bool helper_getVelPidRaw(int j, Pid *pid);
430 bool helper_getVelPidsRaw(Pid *pid);
431
432 //used in current control interface
433 bool helper_setCurPidRaw(int j, const Pid &pid);
434 bool helper_getCurPidRaw(int j, Pid *pid);
435 bool helper_getCurPidsRaw(Pid *pid);
436
437 //used in low level speed control interface
438 bool helper_setSpdPidRaw(int j, const Pid &pid);
439 bool helper_getSpdPidRaw(int j, Pid *pid);
440 bool helper_getSpdPidsRaw(Pid *pid);
441
442 bool checkCalib14RotationParam(int32_t calib_param4);
443
444 // used in rawvaluespublisher interface
445 bool getRawData_core(std::string key, std::vector<std::int32_t> &data);
446
447public:
448
451
452
453 // Device Driver
454 virtual bool open(yarp::os::Searchable &par);
455 virtual bool close();
456
457 virtual bool initialised();
458 virtual eth::iethresType_t type();
459 virtual bool update(eOprotID32_t id32, double timestamp, void *rxdata);
460 virtual bool getEntityName(uint32_t entityId, std::string &entityName);
461 virtual bool getEncoderTypeName(uint32_t jomoId, eOmc_position_t pos, std::string &encoderTypeName) override;
462
464 virtual bool setPidRaw(const PidControlTypeEnum& pidtype, int j, const Pid &pid) override;
465 virtual bool setPidsRaw(const PidControlTypeEnum& pidtype, const Pid *pids) override;
466 virtual bool setPidReferenceRaw(const PidControlTypeEnum& pidtype, int j, double ref) override;
467 virtual bool setPidReferencesRaw(const PidControlTypeEnum& pidtype, const double *refs) override;
468 virtual bool setPidErrorLimitRaw(const PidControlTypeEnum& pidtype, int j, double limit) override;
469 virtual bool setPidErrorLimitsRaw(const PidControlTypeEnum& pidtype, const double *limits) override;
470 virtual bool getPidErrorRaw(const PidControlTypeEnum& pidtype, int j, double *err) override;
471 virtual bool getPidErrorsRaw(const PidControlTypeEnum& pidtype, double *errs) override;
472 virtual bool getPidOutputRaw(const PidControlTypeEnum& pidtype, int j, double *out) override;
473 virtual bool getPidOutputsRaw(const PidControlTypeEnum& pidtype, double *outs) override;
474 virtual bool getPidRaw(const PidControlTypeEnum& pidtype, int j, Pid *pid) override;
475 virtual bool getPidsRaw(const PidControlTypeEnum& pidtype, Pid *pids) override;
476 virtual bool getPidReferenceRaw(const PidControlTypeEnum& pidtype, int j, double *ref) override;
477 virtual bool getPidReferencesRaw(const PidControlTypeEnum& pidtype, double *refs) override;
478 virtual bool getPidErrorLimitRaw(const PidControlTypeEnum& pidtype, int j, double *limit) override;
479 virtual bool getPidErrorLimitsRaw(const PidControlTypeEnum& pidtype, double *limits) override;
480 virtual bool resetPidRaw(const PidControlTypeEnum& pidtype, int j) override;
481 virtual bool disablePidRaw(const PidControlTypeEnum& pidtype, int j) override;
482 virtual bool enablePidRaw(const PidControlTypeEnum& pidtype, int j) override;
483 virtual bool setPidOffsetRaw(const PidControlTypeEnum& pidtype, int j, double v) override;
484 virtual bool isPidEnabledRaw(const PidControlTypeEnum& pidtype, int j, bool* enabled) override;
485
486 // POSITION CONTROL INTERFACE RAW
487 virtual bool getAxes(int *ax) override;
488 virtual bool positionMoveRaw(int j, double ref) override;
489 virtual bool positionMoveRaw(const double *refs) override;
490 virtual bool relativeMoveRaw(int j, double delta) override;
491 virtual bool relativeMoveRaw(const double *deltas) override;
492 virtual bool checkMotionDoneRaw(bool *flag) override;
493 virtual bool checkMotionDoneRaw(int j, bool *flag) override;
494 virtual bool setRefSpeedRaw(int j, double sp) override;
495 virtual bool setRefSpeedsRaw(const double *spds) override;
496 virtual bool setRefAccelerationRaw(int j, double acc) override;
497 virtual bool setRefAccelerationsRaw(const double *accs) override;
498 virtual bool getRefSpeedRaw(int j, double *ref) override;
499 virtual bool getRefSpeedsRaw(double *spds) override;
500 virtual bool getRefAccelerationRaw(int j, double *acc) override;
501 virtual bool getRefAccelerationsRaw(double *accs) override;
502 virtual bool stopRaw(int j) override;
503 virtual bool stopRaw() override;
504
505
506 // Position Control2 Interface
507 virtual bool positionMoveRaw(const int n_joint, const int *joints, const double *refs) override;
508 virtual bool relativeMoveRaw(const int n_joint, const int *joints, const double *deltas) override;
509 virtual bool checkMotionDoneRaw(const int n_joint, const int *joints, bool *flags) override;
510 virtual bool setRefSpeedsRaw(const int n_joint, const int *joints, const double *spds) override;
511 virtual bool setRefAccelerationsRaw(const int n_joint, const int *joints, const double *accs) override;
512 virtual bool getRefSpeedsRaw(const int n_joint, const int *joints, double *spds) override;
513 virtual bool getRefAccelerationsRaw(const int n_joint, const int *joints, double *accs) override;
514 virtual bool stopRaw(const int n_joint, const int *joints) override;
515 virtual bool getTargetPositionRaw(const int joint, double *ref) override;
516 virtual bool getTargetPositionsRaw(double *refs) override;
517 virtual bool getTargetPositionsRaw(const int n_joint, const int *joints, double *refs) override;
518
519 // Velocity control interface raw
520 virtual bool velocityMoveRaw(int j, double sp) override;
521 virtual bool velocityMoveRaw(const double *sp) override;
522
523
524 // calibration2raw
525 virtual bool setCalibrationParametersRaw(int axis, const CalibrationParameters& params) override;
526 virtual bool calibrateAxisWithParamsRaw(int axis, unsigned int type, double p1, double p2, double p3) override;
527 virtual bool calibrationDoneRaw(int j) override;
528
529
531
532 // ControlMode
533 virtual bool getControlModeRaw(int j, int *v) override;
534 virtual bool getControlModesRaw(int *v) override;
535
536 // ControlMode 2
537 virtual bool getControlModesRaw(const int n_joint, const int *joints, int *modes) override;
538 virtual bool setControlModeRaw(const int j, const int mode) override;
539 virtual bool setControlModesRaw(const int n_joint, const int *joints, int *modes) override;
540 virtual bool setControlModesRaw(int *modes) override;
541
543 virtual bool resetEncoderRaw(int j) override;
544 virtual bool resetEncodersRaw() override;
545 virtual bool setEncoderRaw(int j, double val) override;
546 virtual bool setEncodersRaw(const double *vals) override;
547 virtual bool getEncoderRaw(int j, double *v) override;
548 virtual bool getEncodersRaw(double *encs) override;
549 virtual bool getEncoderSpeedRaw(int j, double *sp) override;
550 virtual bool getEncoderSpeedsRaw(double *spds) override;
551 virtual bool getEncoderAccelerationRaw(int j, double *spds) override;
552 virtual bool getEncoderAccelerationsRaw(double *accs) override;
554
555 virtual bool getEncodersTimedRaw(double *encs, double *stamps) override;
556 virtual bool getEncoderTimedRaw(int j, double *encs, double *stamp) override;
557
559 virtual bool getNumberOfMotorEncodersRaw(int * num) override;
560 virtual bool resetMotorEncoderRaw(int m) override;
561 virtual bool resetMotorEncodersRaw() override;
562 virtual bool setMotorEncoderRaw(int m, const double val) override;
563 virtual bool setMotorEncodersRaw(const double *vals) override;
564 virtual bool getMotorEncoderRaw(int m, double *v) override;
565 virtual bool getMotorEncodersRaw(double *encs) override;
566 virtual bool getMotorEncoderSpeedRaw(int m, double *sp) override;
567 virtual bool getMotorEncoderSpeedsRaw(double *spds) override;
568 virtual bool getMotorEncoderAccelerationRaw(int m, double *spds) override;
569 virtual bool getMotorEncoderAccelerationsRaw(double *accs) override;
570 virtual bool getMotorEncodersTimedRaw(double *encs, double *stamps) override;
571 virtual bool getMotorEncoderTimedRaw(int m, double *encs, double *stamp) override;
572 virtual bool getMotorEncoderCountsPerRevolutionRaw(int m, double *v) override;
573 virtual bool setMotorEncoderCountsPerRevolutionRaw(int m, const double cpr) override;
575
577 virtual bool getRemoteVariableRaw(std::string key, yarp::os::Bottle& val) override;
578 virtual bool setRemoteVariableRaw(std::string key, const yarp::os::Bottle& val) override;
579 virtual bool getRemoteVariablesListRaw(yarp::os::Bottle* listOfKeys) override;
581
583 virtual bool getAxisNameRaw(int axis, std::string& name) override;
584 virtual bool getJointTypeRaw(int axis, yarp::dev::JointTypeEnum& type) override;
586
587 //Internal use, not exposed by Yarp (yet)
588 bool getRotorEncoderResolutionRaw(int m, double &rotres) ;
589 bool getJointEncoderResolutionRaw(int m, double &jntres) ;
590 bool getJointEncoderTypeRaw(int j, int &type) ;
591 bool getRotorEncoderTypeRaw(int j, int &type) ;
592 bool getKinematicMJRaw(int j, double &rotres) ;
593 bool getTemperatureSensorTypeRaw(int j, std::string& ret) ;
594 bool getHasTempSensorsRaw(int j, int& ret) ;
595 bool getHasHallSensorRaw(int j, int& ret) ;
596 bool getHasRotorEncoderRaw(int j, int& ret) ;
597 bool getHasRotorEncoderIndexRaw(int j, int& ret) ;
598 bool getMotorPolesRaw(int j, int& poles) ;
599 bool getRotorIndexOffsetRaw(int j, double& rotorOffset) ;
600 bool getTorqueControlFilterType(int j, int& type) ;
601 bool getRotorLimitsRaw(int j, double *rotorMin, double *rotorMax) ;
602 bool getWholeImpedanceRaw(int j, eOmc_impedance_t &imped);
603
605 virtual bool enableAmpRaw(int j) override;
606 virtual bool disableAmpRaw(int j) override;
607 virtual bool getCurrentsRaw(double *vals) override;
608 virtual bool getCurrentRaw(int j, double *val) override;
609 virtual bool setMaxCurrentRaw(int j, double val) override;
610 virtual bool getMaxCurrentRaw(int j, double *val) override;
611 virtual bool getAmpStatusRaw(int *st) override;
612 virtual bool getAmpStatusRaw(int j, int *st) override;
613 virtual bool getPWMRaw(int j, double* val) override;
614 virtual bool getPWMLimitRaw(int j, double* val) override;
615 virtual bool setPWMLimitRaw(int j, const double val) override;
616 virtual bool getPowerSupplyVoltageRaw(int j, double* val) override;
617
619
620 // virtual analog sensor
621 virtual yarp::dev::VAS_status getVirtualAnalogSensorStatus(int ch) override;
622 virtual int getVirtualAnalogSensorChannels() override;
623 virtual bool updateVirtualAnalogSensorMeasure(yarp::sig::Vector &fTorques) override;
624 virtual bool updateVirtualAnalogSensorMeasure(int j, double &fTorque) override;
625
626#ifdef IMPLEMENT_DEBUG_INTERFACE
627 //----------------------------------------------
628 // Debug interface
629 //----------------------------------------------
630 virtual bool setParameterRaw(int j, unsigned int type, double value) override;
631 virtual bool getParameterRaw(int j, unsigned int type, double *value) override;
632 virtual bool setDebugParameterRaw(int j, unsigned int index, double value) override;
633 virtual bool setDebugReferencePositionRaw(int j, double value) override;
634 virtual bool getDebugParameterRaw(int j, unsigned int index, double *value) override;
635 virtual bool getDebugReferencePositionRaw(int j, double *value) override;
636#endif
637
638 // Limits
639 virtual bool setLimitsRaw(int axis, double min, double max) override;
640 virtual bool getLimitsRaw(int axis, double *min, double *max) override;
641 // Limits 2
642 virtual bool setVelLimitsRaw(int axis, double min, double max) override;
643 virtual bool getVelLimitsRaw(int axis, double *min, double *max) override;
644
645 // Torque control
646 virtual bool getTorqueRaw(int j, double *t) override;
647 virtual bool getTorquesRaw(double *t) override;
648 virtual bool getTorqueRangeRaw(int j, double *min, double *max) override;
649 virtual bool getTorqueRangesRaw(double *min, double *max) override;
650 virtual bool setRefTorquesRaw(const double *t) override;
651 virtual bool setRefTorqueRaw(int j, double t) override;
652 virtual bool setRefTorquesRaw(const int n_joint, const int *joints, const double *t) override;
653 virtual bool getRefTorquesRaw(double *t) override;
654 virtual bool getRefTorqueRaw(int j, double *t) override;
655 virtual bool getMotorTorqueParamsRaw(int j, MotorTorqueParameters *params) override;
656 virtual bool setMotorTorqueParamsRaw(int j, const MotorTorqueParameters params) override;
657
658
659 // IVelocityControl2
660 virtual bool velocityMoveRaw(const int n_joint, const int *joints, const double *spds) override;
661 virtual bool getRefVelocityRaw(const int joint, double *ref) override;
662 virtual bool getRefVelocitiesRaw(double *refs) override;
663 virtual bool getRefVelocitiesRaw(const int n_joint, const int *joints, double *refs) override;
664
665
666 // Impedance interface
667 virtual bool getImpedanceRaw(int j, double *stiffness, double *damping) override;
668 virtual bool setImpedanceRaw(int j, double stiffness, double damping) override;
669 virtual bool setImpedanceOffsetRaw(int j, double offset) override;
670 virtual bool getImpedanceOffsetRaw(int j, double *offset) override;
671 virtual bool getCurrentImpedanceLimitRaw(int j, double *min_stiff, double *max_stiff, double *min_damp, double *max_damp) override;
672
673 // PositionDirect Interface
674 virtual bool setPositionRaw(int j, double ref) override;
675 virtual bool setPositionsRaw(const int n_joint, const int *joints, const double *refs) override;
676 virtual bool setPositionsRaw(const double *refs) override;
677 virtual bool getRefPositionRaw(const int joint, double *ref) override;
678 virtual bool getRefPositionsRaw(double *refs) override;
679 virtual bool getRefPositionsRaw(const int n_joint, const int *joints, double *refs) override;
680
681 // InteractionMode interface
682 virtual bool getInteractionModeRaw(int j, yarp::dev::InteractionModeEnum* _mode) override;
683 virtual bool getInteractionModesRaw(int n_joints, int *joints, yarp::dev::InteractionModeEnum* modes) override;
684 virtual bool getInteractionModesRaw(yarp::dev::InteractionModeEnum* modes) override;
685 virtual bool setInteractionModeRaw(int j, yarp::dev::InteractionModeEnum _mode) override;
686 virtual bool setInteractionModesRaw(int n_joints, int *joints, yarp::dev::InteractionModeEnum* modes) override;
687 virtual bool setInteractionModesRaw(yarp::dev::InteractionModeEnum* modes) override;
688
689 // IMotor interface
690 virtual bool getNumberOfMotorsRaw(int * num) override;
691 virtual bool getTemperatureRaw(int m, double* val) override;
692 virtual bool getTemperaturesRaw(double *vals) override;
693 virtual bool getTemperatureLimitRaw(int m, double *temp) override;
694 virtual bool setTemperatureLimitRaw(int m, const double temp) override;
695 virtual bool getPeakCurrentRaw(int m, double *val) override;
696 virtual bool setPeakCurrentRaw(int m, const double val) override;
697 virtual bool getNominalCurrentRaw(int m, double *val) override;
698 virtual bool setNominalCurrentRaw(int m, const double val) override;
699 virtual bool getGearboxRatioRaw(int m, double *gearbox) override;
700
701 // PWMControl
702 virtual bool setRefDutyCycleRaw(int j, double v) override;
703 virtual bool setRefDutyCyclesRaw(const double *v) override;
704 virtual bool getRefDutyCycleRaw(int j, double *v) override;
705 virtual bool getRefDutyCyclesRaw(double *v) override;
706 virtual bool getDutyCycleRaw(int j, double *v) override;
707 virtual bool getDutyCyclesRaw(double *v) override;
708
709 // CurrentControl
710 // virtual bool getAxes(int *ax) override;
711 //virtual bool getCurrentRaw(int j, double *t) override;
712 //virtual bool getCurrentsRaw(double *t) override;
713 virtual bool getCurrentRangeRaw(int j, double *min, double *max) override;
714 virtual bool getCurrentRangesRaw(double *min, double *max) override;
715 virtual bool setRefCurrentsRaw(const double *t) override;
716 virtual bool setRefCurrentRaw(int j, double t) override;
717 virtual bool setRefCurrentsRaw(const int n_joint, const int *joints, const double *t) override;
718 virtual bool getRefCurrentsRaw(double *t) override;
719 virtual bool getRefCurrentRaw(int j, double *t) override;
720
721 // Used in joint faults interface
722 // Teturns true if it was successful and writes the fault code in the fault parameter
723 // with the associated string in message. If no fault is detected the fault parameters is set to -1.
724 // Returns false and fault is set to -2 if retrieval was unsuccessful.
725 virtual bool getLastJointFaultRaw(int j, int& fault, std::string& message) override;
726
727 // IRawValuesPublisher
728 virtual bool getRawDataMap(std::map<std::string, std::vector<std::int32_t>> &map) override;
729 virtual bool getRawData(std::string key, std::vector<std::int32_t> &data) override;
730 virtual bool getKeys(std::vector<std::string> &keys) override;
731 virtual int getNumberOfKeys() override;
732 virtual bool getMetadataMap(rawValuesKeyMetadataMap &metamap) override;
733 virtual bool getKeyMetadata(std::string key, rawValuesKeyMetadata &meta) override;
734};
735
736#endif // include guard
@ data
embObjMotionControl : driver for iCub motor control boards EMS on a ETH bus.
virtual bool getPidReferenceRaw(const PidControlTypeEnum &pidtype, int j, double *ref) override
virtual bool setVelLimitsRaw(int axis, double min, double max) override
virtual bool setMaxCurrentRaw(int j, double val) override
virtual bool getMotorEncoderRaw(int m, double *v) override
virtual bool enablePidRaw(const PidControlTypeEnum &pidtype, int j) override
virtual bool getRawData(std::string key, std::vector< std::int32_t > &data) override
virtual bool setPidErrorLimitsRaw(const PidControlTypeEnum &pidtype, const double *limits) override
virtual bool setRefSpeedsRaw(const double *spds) override
virtual bool getEncoderTypeName(uint32_t jomoId, eOmc_position_t pos, std::string &encoderTypeName) override
virtual bool getTorqueRangesRaw(double *min, double *max) override
virtual bool getControlModesRaw(int *v) override
virtual bool getRefCurrentRaw(int j, double *t) override
virtual bool setInteractionModeRaw(int j, yarp::dev::InteractionModeEnum _mode) override
virtual bool getPidOutputRaw(const PidControlTypeEnum &pidtype, int j, double *out) override
virtual bool getInteractionModesRaw(int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
virtual bool setInteractionModesRaw(int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
bool getRotorEncoderTypeRaw(int j, int &type)
virtual bool setRefAccelerationsRaw(const double *accs) override
virtual bool disablePidRaw(const PidControlTypeEnum &pidtype, int j) override
virtual bool getImpedanceRaw(int j, double *stiffness, double *damping) override
virtual bool update(eOprotID32_t id32, double timestamp, void *rxdata)
virtual bool setPidOffsetRaw(const PidControlTypeEnum &pidtype, int j, double v) override
virtual bool getPowerSupplyVoltageRaw(int j, double *val) override
virtual bool setPidsRaw(const PidControlTypeEnum &pidtype, const Pid *pids) override
virtual bool getPidErrorLimitRaw(const PidControlTypeEnum &pidtype, int j, double *limit) override
virtual bool setPeakCurrentRaw(int m, const double val) override
virtual bool enableAmpRaw(int j) override
bool getHasRotorEncoderRaw(int j, int &ret)
virtual bool setRefTorqueRaw(int j, double t) override
virtual bool relativeMoveRaw(int j, double delta) override
virtual bool disableAmpRaw(int j) override
virtual bool getRefVelocityRaw(const int joint, double *ref) override
virtual bool getEncodersRaw(double *encs) override
virtual bool getLastJointFaultRaw(int j, int &fault, std::string &message) override
virtual bool getDutyCyclesRaw(double *v) override
virtual bool getPidReferencesRaw(const PidControlTypeEnum &pidtype, double *refs) override
virtual bool getMotorEncoderAccelerationsRaw(double *accs) override
virtual bool resetMotorEncoderRaw(int m) override
virtual bool checkMotionDoneRaw(bool *flag) override
virtual bool getPWMLimitRaw(int j, double *val) override
virtual bool getControlModeRaw(int j, int *v) override
virtual bool getPWMRaw(int j, double *val) override
bool getRotorLimitsRaw(int j, double *rotorMin, double *rotorMax)
virtual bool getTorqueRaw(int j, double *t) override
virtual bool getMotorEncodersRaw(double *encs) override
virtual bool open(yarp::os::Searchable &par)
virtual bool getEncodersTimedRaw(double *encs, double *stamps) override
bool getJointEncoderResolutionRaw(int m, double &jntres)
virtual bool getRefSpeedsRaw(double *spds) override
virtual bool getInteractionModeRaw(int j, yarp::dev::InteractionModeEnum *_mode) override
virtual bool getEntityName(uint32_t entityId, std::string &entityName)
virtual eth::iethresType_t type()
bool getTemperatureSensorTypeRaw(int j, std::string &ret)
virtual bool getCurrentRangesRaw(double *min, double *max) override
virtual bool getLimitsRaw(int axis, double *min, double *max) override
virtual bool setPidReferenceRaw(const PidControlTypeEnum &pidtype, int j, double ref) override
virtual bool updateVirtualAnalogSensorMeasure(yarp::sig::Vector &fTorques) override
virtual bool setImpedanceRaw(int j, double stiffness, double damping) override
virtual bool setRemoteVariableRaw(std::string key, const yarp::os::Bottle &val) override
virtual bool getCurrentsRaw(double *vals) override
virtual bool getTorqueRangeRaw(int j, double *min, double *max) override
virtual bool getTorquesRaw(double *t) override
virtual bool getAmpStatusRaw(int *st) override
virtual yarp::dev::VAS_status getVirtualAnalogSensorStatus(int ch) override
virtual bool setRefCurrentsRaw(const double *t) override
virtual bool getTargetPositionRaw(const int joint, double *ref) override
virtual bool setMotorEncoderCountsPerRevolutionRaw(int m, const double cpr) override
virtual bool getGearboxRatioRaw(int m, double *gearbox) override
virtual bool resetEncodersRaw() override
virtual bool getTemperatureLimitRaw(int m, double *temp) override
virtual bool setCalibrationParametersRaw(int axis, const CalibrationParameters &params) override
virtual bool getRawDataMap(std::map< std::string, std::vector< std::int32_t > > &map) override
virtual bool setNominalCurrentRaw(int m, const double val) override
virtual bool setMotorTorqueParamsRaw(int j, const MotorTorqueParameters params) override
virtual bool setRefCurrentRaw(int j, double t) override
virtual bool setTemperatureLimitRaw(int m, const double temp) override
virtual bool getRemoteVariableRaw(std::string key, yarp::os::Bottle &val) override
virtual bool calibrationDoneRaw(int j) override
virtual bool getEncoderTimedRaw(int j, double *encs, double *stamp) override
virtual bool getMetadataMap(rawValuesKeyMetadataMap &metamap) override
virtual bool getAxisNameRaw(int axis, std::string &name) override
virtual bool setPWMLimitRaw(int j, const double val) override
virtual bool getRefAccelerationRaw(int j, double *acc) override
virtual bool resetPidRaw(const PidControlTypeEnum &pidtype, int j) override
virtual bool getPidRaw(const PidControlTypeEnum &pidtype, int j, Pid *pid) override
virtual bool setPositionRaw(int j, double ref) override
virtual bool getRefSpeedRaw(int j, double *ref) override
virtual bool setPidErrorLimitRaw(const PidControlTypeEnum &pidtype, int j, double limit) override
virtual bool setControlModesRaw(const int n_joint, const int *joints, int *modes) override
bool getRotorEncoderResolutionRaw(int m, double &rotres)
virtual bool setRefDutyCycleRaw(int j, double v) override
virtual bool getImpedanceOffsetRaw(int j, double *offset) override
bool getWholeImpedanceRaw(int j, eOmc_impedance_t &imped)
virtual bool getEncoderSpeedsRaw(double *spds) override
virtual bool setPositionsRaw(const int n_joint, const int *joints, const double *refs) override
virtual bool resetMotorEncodersRaw() override
bool getJointEncoderTypeRaw(int j, int &type)
virtual bool getNumberOfMotorEncodersRaw(int *num) override
virtual bool getPidErrorLimitsRaw(const PidControlTypeEnum &pidtype, double *limits) override
virtual bool setMotorEncoderRaw(int m, const double val) override
virtual bool getMotorEncoderTimedRaw(int m, double *encs, double *stamp) override
virtual bool setEncoderRaw(int j, double val) override
virtual bool resetEncoderRaw(int j) override
virtual bool setPidRaw(const PidControlTypeEnum &pidtype, int j, const Pid &pid) override
virtual bool getRefAccelerationsRaw(double *accs) override
virtual bool getPidOutputsRaw(const PidControlTypeEnum &pidtype, double *outs) override
virtual bool getRefPositionsRaw(double *refs) override
virtual bool getJointTypeRaw(int axis, yarp::dev::JointTypeEnum &type) override
virtual bool calibrateAxisWithParamsRaw(int axis, unsigned int type, double p1, double p2, double p3) override
virtual bool getNominalCurrentRaw(int m, double *val) override
virtual bool setRefTorquesRaw(const double *t) override
virtual bool getRefDutyCyclesRaw(double *v) override
virtual bool getCurrentRaw(int j, double *val) override
bool getMotorPolesRaw(int j, int &poles)
virtual bool getCurrentRangeRaw(int j, double *min, double *max) override
virtual bool getRefTorquesRaw(double *t) override
virtual bool setEncodersRaw(const double *vals) override
virtual bool getEncoderRaw(int j, double *v) override
virtual bool getKeys(std::vector< std::string > &keys) override
virtual bool setControlModeRaw(const int j, const int mode) override
virtual bool positionMoveRaw(int j, double ref) override
bool getKinematicMJRaw(int j, double &rotres)
virtual bool setLimitsRaw(int axis, double min, double max) override
virtual bool getEncoderAccelerationRaw(int j, double *spds) override
virtual bool getMotorTorqueParamsRaw(int j, MotorTorqueParameters *params) override
virtual bool getTemperatureRaw(int m, double *val) override
virtual bool setPidReferencesRaw(const PidControlTypeEnum &pidtype, const double *refs) override
virtual bool getCurrentImpedanceLimitRaw(int j, double *min_stiff, double *max_stiff, double *min_damp, double *max_damp) override
virtual bool getVelLimitsRaw(int axis, double *min, double *max) override
virtual bool getRefTorqueRaw(int j, double *t) override
virtual bool getNumberOfMotorsRaw(int *num) override
virtual bool setRefSpeedRaw(int j, double sp) override
virtual bool getMotorEncoderSpeedsRaw(double *spds) override
virtual bool getMaxCurrentRaw(int j, double *val) override
virtual bool getTemperaturesRaw(double *vals) override
virtual bool getMotorEncoderCountsPerRevolutionRaw(int m, double *v) override
virtual bool getEncoderAccelerationsRaw(double *accs) override
virtual bool getPidsRaw(const PidControlTypeEnum &pidtype, Pid *pids) override
virtual bool getRemoteVariablesListRaw(yarp::os::Bottle *listOfKeys) override
bool getTorqueControlFilterType(int j, int &type)
virtual bool getRefCurrentsRaw(double *t) override
virtual bool getPidErrorRaw(const PidControlTypeEnum &pidtype, int j, double *err) override
virtual bool setImpedanceOffsetRaw(int j, double offset) override
virtual bool getRefDutyCycleRaw(int j, double *v) override
virtual bool getMotorEncodersTimedRaw(double *encs, double *stamps) override
virtual int getVirtualAnalogSensorChannels() override
bool getRotorIndexOffsetRaw(int j, double &rotorOffset)
virtual bool setMotorEncodersRaw(const double *vals) override
virtual bool isPidEnabledRaw(const PidControlTypeEnum &pidtype, int j, bool *enabled) override
virtual bool setRefAccelerationRaw(int j, double acc) override
virtual bool getEncoderSpeedRaw(int j, double *sp) override
virtual bool getMotorEncoderSpeedRaw(int m, double *sp) override
virtual bool getMotorEncoderAccelerationRaw(int m, double *spds) override
virtual bool getAxes(int *ax) override
virtual bool getRefPositionRaw(const int joint, double *ref) override
virtual bool setRefDutyCyclesRaw(const double *v) override
virtual bool getKeyMetadata(std::string key, rawValuesKeyMetadata &meta) override
virtual bool velocityMoveRaw(int j, double sp) override
virtual bool getPeakCurrentRaw(int m, double *val) override
virtual bool getPidErrorsRaw(const PidControlTypeEnum &pidtype, double *errs) override
virtual bool getRefVelocitiesRaw(double *refs) override
virtual bool getTargetPositionsRaw(double *refs) override
bool getHasRotorEncoderIndexRaw(int j, int &ret)
virtual bool getDutyCycleRaw(int j, double *v) override
void updatePrevTemperature(double temperature)
TemperatureFilter(TemperatureFilter &&other) noexcept=default
TemperatureFilter & operator=(const TemperatureFilter &other)=default
TemperatureFilter(const TemperatureFilter &other)=default
TemperatureFilter & operator=(TemperatureFilter &&other) noexcept=default
TemperatureFilter(uint32_t threshold, int32_t initCounter)
Watchdog & operator=(const Watchdog &other)=default
void setThreshold(uint8_t txrateOfRegularROPs)
Watchdog(const Watchdog &other)=default
Watchdog(Watchdog &&other) noexcept=default
Watchdog & operator=(Watchdog &&other) noexcept=default
_3f_vect_t acc
Definition dataTypes.h:1
In the Tools namespace there are classes useful to check some kinds of performance on robot.
iethresType_t
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.
Copyright (C) 2008 RobotCub Consortium.
out
Definition sine.m:8
degrees offset
Definition sine.m:4
std::vector< BufferedPort< Bottle > * > ports
eOmn_serv_diagn_cfg_t config
bool useRawEncoderData
its value depends on environment variable "ETH_VERBOSEWHENOK"
bool pwmIsLimited
if true than do not use calibration data
int resolution
Num of error bits passable for joint encoder.
double tolerance
joint encoder type
vector< eOmc_jointset_configuration_t > jointset_cfgs