iCub-main
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 
31 using namespace std;
32 
33 #include <string>
34 #include <mutex>
35 // Yarp stuff
36 #include <yarp/os/Bottle.h>
37 #include <yarp/os/BufferedPort.h>
38 #include <yarp/os/Timer.h>
39 #include <yarp/dev/DeviceDriver.h>
40 #include <yarp/dev/PolyDriver.h>
41 #include <yarp/dev/ControlBoardHelper.h>
42 
43 #include <yarp/dev/IVirtualAnalogSensor.h>
44 
45 #include<yarp/dev/ImplementJointFault.h>
46 
47 
48 #include "IethResource.h"
49 #include"EoError.h"
50 #include <ethManager.h>
51 #include <abstractEthResource.h>
52 
53 #include "serviceParser.h"
54 #include "eomcParser.h"
55 #include "measuresConverter.h"
56 
57 #include "mcEventDownsampler.h"
58 
59 
60 #ifdef NETWORK_PERFORMANCE_BENCHMARK
61 #include <PeriodicEventsVerifier.h>
62 #endif
63 
64 // - public #define --------------------------------------------------------------------------------------------------
65 
66 #undef VERIFY_ROP_SETIMPEDANCE // this macro let you send setimpedence rop with signature.
67  // if you want use this feature, you should compiled ems firmware with same macro.
68 #undef VERIFY_ROP_SETPOSITIONRAW // this macro let you send setposition rop with signature.
69  // if you want use this feature, yuo should compiled ems firmware with same macro.
70 
71 // marco.accame: we dont manage mais anymore from the embObjMotionControl class.
72 // the mais is now initted by the ems board with default params (datarate = 10, mode = eoas_maismode_txdatacontinuously)
73 // and never swicthed off.
74 // only embObjAnalog can override its behaviour
75 
76 #define EMBOBJMC_DONT_USE_MAIS
77 
78 
79 
80 //
81 // helper structures
82 //
83 namespace yarp {
84  namespace dev {
85  namespace eomc {
86 
87 typedef struct
88 {
89  vector<int> joint2set;
90  vector <vector <int> > set2joint;
92  vector<eOmc_jointset_configuration_t> jointset_cfgs;
94 
95 typedef struct
96 {
97  eOmc_encoder_t type;
98  double tolerance;
100 } encoder_t;
101 
102 typedef struct
103 {
108 
109 }}};
110 
111 namespace yarp {
112  namespace dev {
113  class embObjMotionControl;
114  }
115 }
116 
117 
119 {
120  eOmn_serv_diagn_cfg_t config;
121  std::vector<BufferedPort<Bottle>*> ports;
122 };
123 
124 using namespace yarp::dev;
125 
126 
146 class yarp::dev::embObjMotionControl: public DeviceDriver,
147  public IPidControlRaw,
148  public IControlCalibrationRaw,
149  public IAmplifierControlRaw,
150  public IEncodersTimedRaw,
151  public IMotorEncodersRaw,
152  public ImplementEncodersTimed,
153  public ImplementMotorEncoders,
154  public IMotorRaw,
155  public ImplementMotor,
156  public IPositionControlRaw,
157  public IVelocityControlRaw,
158  public IControlModeRaw,
159  public ImplementControlMode,
160  public IControlLimitsRaw,
161  public IImpedanceControlRaw,
162  public ImplementImpedanceControl,
163  public ImplementControlLimits,
164  public ImplementAmplifierControl,
165  public ImplementPositionControl,
166  public ImplementControlCalibration,
167  public ImplementPidControl,
168  public ImplementVelocityControl,
169  public ITorqueControlRaw,
170  public ImplementTorqueControl,
171  public IVirtualAnalogSensor,
172  public IPositionDirectRaw,
173  public ImplementPositionDirect,
174  public IInteractionModeRaw,
175  public ImplementInteractionMode,
176  public IRemoteVariablesRaw,
177  public ImplementRemoteVariables,
178  public IAxisInfoRaw,
179  public ImplementAxisInfo,
180  public IPWMControlRaw,
181  public ImplementPWMControl,
182  public ICurrentControlRaw,
183  public ImplementCurrentControl,
184  public eth::IethResource,
185  public IJointFaultRaw,
186  public ImplementJointFault
187  {
188 private:
189 
190  eth::TheEthManager* ethManager;
192  ServiceParser* parser;
193  eomc::Parser * _mcparser;
194  ControlBoardHelper* _measureConverter;
195  std::mutex _mutex;
196 
197  bool opened; //internal state
198 
199  MCdiagnostics mcdiagnostics;
200 
202  int _njoints;
203  eomc::behaviour_flags_t behFlags;
204  servConfigMC_t serviceConfig;
205  double * _gearbox_M2J;
206  double * _gearbox_E2J;
207  double * _deadzone;
208  std::vector<eomc::kalmanFilterParams_t> _kalman_params;
210  eomc::focBasedSpecificInfo_t * _foc_based_info;
211 
212  std::vector<eomc::encoder_t> _jointEncs;
213  std::vector<eomc::encoder_t> _motorEncs;
214 
215  std::vector<eomc::rotorLimits_t> _rotorsLimits;
216  std::vector<eomc::jointLimits_t> _jointsLimits;
217  std::vector<eomc::motorCurrentLimits_t> _currentLimits;
218  eomc::couplingInfo_t _couplingInfo;
219  std::vector<eomc::JointsSet> _jsets;
220  std::vector<int> _joint2set;
221  std::vector<eomc::timeouts_t> _timeouts;
222 
223  std::vector<eomc::impedanceParameters_t> _impedance_params; // TODO doubled!!! optimize using just one of the 2!!!
224  eomc::impedanceLimits_t * _impedance_limits;
227  eomc::PidInfo * _trj_pids;
228  //eomc::PidInfo * _dir_pids;
229  eomc::TrqPidInfo * _trq_pids;
230  eomc::PidInfo * _cur_pids;
231  eomc::PidInfo * _spd_pids;
232 
233  int * _axisMap;
234  std::vector<eomc::axisInfo_t> _axesInfo;
236 
237  // event downsampler
238  mced::mcEventDownsampler* event_downsampler;
239 
240 #ifdef VERIFY_ROP_SETIMPEDANCE
241  uint32_t *impedanceSignature;
242 #endif
243 
244 #ifdef VERIFY_ROP_SETPOSITIONRAW
245  uint32_t *refRawSignature;
246  bool *sendingDirects;
247 #endif
248 
249 
250 
251  double SAFETY_THRESHOLD;
252 
253 
254  // internal stuff
255  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.
256  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.
257  bool *_calibrated; // Flag to know if the calibrate function has been called for the joint
258  double *_ref_command_positions;// used for position control.
259  double *_ref_speeds; // used for position control.
260  double *_ref_command_speeds; // used for velocity control.
261  double *_ref_positions; // used for direct position control.
262  double *_ref_accs; // for velocity control, in position min jerk eq is used.
263  double *_encodersStamp;
264  bool *checking_motiondone; /* flag telling if I'm already waiting for motion done */
265  #define MAX_POSITION_MOVE_INTERVAL 0.080
266  double *_last_position_move_time;
267  eOmc_impedance_t *_cacheImpedance; /* cache impedance value to split up the 2 sets */
268 
269 
270 #ifdef NETWORK_PERFORMANCE_BENCHMARK
271  Tools:Emb_RensponseTimingVerifier m_responseTimingVerifier;
272 #endif
273 
274 private:
275 
276  std::string getBoardInfo(void);
277  bool askRemoteValue(eOprotID32_t id32, void* value, uint16_t& size);
278  template <class T>
279  bool askRemoteValues(eOprotEndpoint_t ep, eOprotEntity_t entity, eOprotTag_t tag, std::vector<T>& values);
280  bool checkRemoteControlModeStatus(int joint, int target_mode);
281 
282  bool dealloc();
283 
284 
285  bool verifyUserControlLawConsistencyInJointSet(eomc::PidInfo *ipdInfo);
286  bool verifyUserControlLawConsistencyInJointSet(eomc::TrqPidInfo *pidInfo);
287  bool verifyTorquePidshasSameUnitTypes(yarp::dev::PidFeedbackUnitsEnum &fbk_pidunits, yarp::dev::PidOutputUnitsEnum& out_pidunits);
288  bool verifyUseMotorSpeedFbkInJointSet(int useMotorSpeedFbk []);
289  bool updatedJointsetsCfgWithControlInfo(void);
290  bool saveCouplingsData(void);
291  void debugUtil_printJointsetInfo(void);
292 
293  bool isTorqueControlEnabled(int joint);
294  bool isVelocityControlEnabled(int joint);
295 
296  bool iNeedCouplingsInfo(void); //the device needs coupling info if it manages joints controlled by 2foc and mc4plus.
297 
298  bool getJointConfiguration(int joint, eOmc_joint_config_t *jntCfg_ptr);
299  bool getMotorConfiguration(int axis, eOmc_motor_config_t *motCfg_ptr);
300  bool getGerabox_E2J(int joint, double *gearbox_E2J_ptr);
301  bool getJointEncTolerance(int joint, double *jEncTolerance_ptr);
302  bool getMotorEncTolerance(int axis, double *mEncTolerance_ptr);
303  void updateDeadZoneWithDefaultValues(void);
304  bool getJointDeadZoneRaw(int j, double &jntDeadZone);
305 
306 private:
307 
308  //functions used in init this object
309  bool fromConfig(yarp::os::Searchable &config);
310  int fromConfig_NumOfJoints(yarp::os::Searchable &config);
311  bool fromConfig_getGeneralInfo(yarp::os::Searchable &config); //get general info: useRawEncoderData, useLiitedPwm, etc....
312  bool fromConfig_Step2(yarp::os::Searchable &config);
313  bool fromConfig_readServiceCfg(yarp::os::Searchable &config);
314  bool initializeInterfaces(measureConvFactors &f);
315  bool alloc(int njoints);
316  bool init(void);
317 
318  //function used in the closing this object
319  void cleanup(void);
320 
321  //used in pid interface
322  bool helper_setPosPidRaw( int j, const Pid &pid);
323  bool helper_getPosPidRaw(int j, Pid *pid);
324  bool helper_getPosPidsRaw(Pid *pid);
325 
326  //used in torque control interface
327  bool helper_setTrqPidRaw( int j, const Pid &pid);
328  bool helper_getTrqPidRaw(int j, Pid *pid);
329  bool helper_getTrqPidsRaw(Pid *pid);
330 
331  //used in velocity control interface
332  bool helper_setVelPidRaw( int j, const Pid &pid);
333  bool helper_getVelPidRaw(int j, Pid *pid);
334  bool helper_getVelPidsRaw(Pid *pid);
335 
336  //used in current control interface
337  bool helper_setCurPidRaw(int j, const Pid &pid);
338  bool helper_getCurPidRaw(int j, Pid *pid);
339  bool helper_getCurPidsRaw(Pid *pid);
340 
341  //used in low level speed control interface
342  bool helper_setSpdPidRaw(int j, const Pid &pid);
343  bool helper_getSpdPidRaw(int j, Pid *pid);
344  bool helper_getSpdPidsRaw(Pid *pid);
345 
346 public:
347 
350 
351 
352  // Device Driver
353  virtual bool open(yarp::os::Searchable &par);
354  virtual bool close();
355 
356  virtual bool initialised();
357  virtual eth::iethresType_t type();
358  virtual bool update(eOprotID32_t id32, double timestamp, void *rxdata);
359 
361  virtual bool setPidRaw(const PidControlTypeEnum& pidtype, int j, const Pid &pid) override;
362  virtual bool setPidsRaw(const PidControlTypeEnum& pidtype, const Pid *pids) override;
363  virtual bool setPidReferenceRaw(const PidControlTypeEnum& pidtype, int j, double ref) override;
364  virtual bool setPidReferencesRaw(const PidControlTypeEnum& pidtype, const double *refs) override;
365  virtual bool setPidErrorLimitRaw(const PidControlTypeEnum& pidtype, int j, double limit) override;
366  virtual bool setPidErrorLimitsRaw(const PidControlTypeEnum& pidtype, const double *limits) override;
367  virtual bool getPidErrorRaw(const PidControlTypeEnum& pidtype, int j, double *err) override;
368  virtual bool getPidErrorsRaw(const PidControlTypeEnum& pidtype, double *errs) override;
369  virtual bool getPidOutputRaw(const PidControlTypeEnum& pidtype, int j, double *out) override;
370  virtual bool getPidOutputsRaw(const PidControlTypeEnum& pidtype, double *outs) override;
371  virtual bool getPidRaw(const PidControlTypeEnum& pidtype, int j, Pid *pid) override;
372  virtual bool getPidsRaw(const PidControlTypeEnum& pidtype, Pid *pids) override;
373  virtual bool getPidReferenceRaw(const PidControlTypeEnum& pidtype, int j, double *ref) override;
374  virtual bool getPidReferencesRaw(const PidControlTypeEnum& pidtype, double *refs) override;
375  virtual bool getPidErrorLimitRaw(const PidControlTypeEnum& pidtype, int j, double *limit) override;
376  virtual bool getPidErrorLimitsRaw(const PidControlTypeEnum& pidtype, double *limits) override;
377  virtual bool resetPidRaw(const PidControlTypeEnum& pidtype, int j) override;
378  virtual bool disablePidRaw(const PidControlTypeEnum& pidtype, int j) override;
379  virtual bool enablePidRaw(const PidControlTypeEnum& pidtype, int j) override;
380  virtual bool setPidOffsetRaw(const PidControlTypeEnum& pidtype, int j, double v) override;
381  virtual bool isPidEnabledRaw(const PidControlTypeEnum& pidtype, int j, bool* enabled) override;
382 
383  // POSITION CONTROL INTERFACE RAW
384  virtual bool getAxes(int *ax) override;
385  virtual bool positionMoveRaw(int j, double ref) override;
386  virtual bool positionMoveRaw(const double *refs) override;
387  virtual bool relativeMoveRaw(int j, double delta) override;
388  virtual bool relativeMoveRaw(const double *deltas) override;
389  virtual bool checkMotionDoneRaw(bool *flag) override;
390  virtual bool checkMotionDoneRaw(int j, bool *flag) override;
391  virtual bool setRefSpeedRaw(int j, double sp) override;
392  virtual bool setRefSpeedsRaw(const double *spds) override;
393  virtual bool setRefAccelerationRaw(int j, double acc) override;
394  virtual bool setRefAccelerationsRaw(const double *accs) override;
395  virtual bool getRefSpeedRaw(int j, double *ref) override;
396  virtual bool getRefSpeedsRaw(double *spds) override;
397  virtual bool getRefAccelerationRaw(int j, double *acc) override;
398  virtual bool getRefAccelerationsRaw(double *accs) override;
399  virtual bool stopRaw(int j) override;
400  virtual bool stopRaw() override;
401 
402 
403  // Position Control2 Interface
404  virtual bool positionMoveRaw(const int n_joint, const int *joints, const double *refs) override;
405  virtual bool relativeMoveRaw(const int n_joint, const int *joints, const double *deltas) override;
406  virtual bool checkMotionDoneRaw(const int n_joint, const int *joints, bool *flags) override;
407  virtual bool setRefSpeedsRaw(const int n_joint, const int *joints, const double *spds) override;
408  virtual bool setRefAccelerationsRaw(const int n_joint, const int *joints, const double *accs) override;
409  virtual bool getRefSpeedsRaw(const int n_joint, const int *joints, double *spds) override;
410  virtual bool getRefAccelerationsRaw(const int n_joint, const int *joints, double *accs) override;
411  virtual bool stopRaw(const int n_joint, const int *joints) override;
412  virtual bool getTargetPositionRaw(const int joint, double *ref) override;
413  virtual bool getTargetPositionsRaw(double *refs) override;
414  virtual bool getTargetPositionsRaw(const int n_joint, const int *joints, double *refs) override;
415 
416  // Velocity control interface raw
417  virtual bool velocityMoveRaw(int j, double sp) override;
418  virtual bool velocityMoveRaw(const double *sp) override;
419 
420 
421  // calibration2raw
422  virtual bool setCalibrationParametersRaw(int axis, const CalibrationParameters& params) override;
423  virtual bool calibrateAxisWithParamsRaw(int axis, unsigned int type, double p1, double p2, double p3) override;
424  virtual bool calibrationDoneRaw(int j) override;
425 
426 
428 
429  // ControlMode
430  virtual bool getControlModeRaw(int j, int *v) override;
431  virtual bool getControlModesRaw(int *v) override;
432 
433  // ControlMode 2
434  virtual bool getControlModesRaw(const int n_joint, const int *joints, int *modes) override;
435  virtual bool setControlModeRaw(const int j, const int mode) override;
436  virtual bool setControlModesRaw(const int n_joint, const int *joints, int *modes) override;
437  virtual bool setControlModesRaw(int *modes) override;
438 
440  virtual bool resetEncoderRaw(int j) override;
441  virtual bool resetEncodersRaw() override;
442  virtual bool setEncoderRaw(int j, double val) override;
443  virtual bool setEncodersRaw(const double *vals) override;
444  virtual bool getEncoderRaw(int j, double *v) override;
445  virtual bool getEncodersRaw(double *encs) override;
446  virtual bool getEncoderSpeedRaw(int j, double *sp) override;
447  virtual bool getEncoderSpeedsRaw(double *spds) override;
448  virtual bool getEncoderAccelerationRaw(int j, double *spds) override;
449  virtual bool getEncoderAccelerationsRaw(double *accs) override;
451 
452  virtual bool getEncodersTimedRaw(double *encs, double *stamps) override;
453  virtual bool getEncoderTimedRaw(int j, double *encs, double *stamp) override;
454 
456  virtual bool getNumberOfMotorEncodersRaw(int * num) override;
457  virtual bool resetMotorEncoderRaw(int m) override;
458  virtual bool resetMotorEncodersRaw() override;
459  virtual bool setMotorEncoderRaw(int m, const double val) override;
460  virtual bool setMotorEncodersRaw(const double *vals) override;
461  virtual bool getMotorEncoderRaw(int m, double *v) override;
462  virtual bool getMotorEncodersRaw(double *encs) override;
463  virtual bool getMotorEncoderSpeedRaw(int m, double *sp) override;
464  virtual bool getMotorEncoderSpeedsRaw(double *spds) override;
465  virtual bool getMotorEncoderAccelerationRaw(int m, double *spds) override;
466  virtual bool getMotorEncoderAccelerationsRaw(double *accs) override;
467  virtual bool getMotorEncodersTimedRaw(double *encs, double *stamps) override;
468  virtual bool getMotorEncoderTimedRaw(int m, double *encs, double *stamp) override;
469  virtual bool getMotorEncoderCountsPerRevolutionRaw(int m, double *v) override;
470  virtual bool setMotorEncoderCountsPerRevolutionRaw(int m, const double cpr) override;
472 
474  virtual bool getRemoteVariableRaw(std::string key, yarp::os::Bottle& val) override;
475  virtual bool setRemoteVariableRaw(std::string key, const yarp::os::Bottle& val) override;
476  virtual bool getRemoteVariablesListRaw(yarp::os::Bottle* listOfKeys) override;
478 
480  virtual bool getAxisNameRaw(int axis, std::string& name) override;
481  virtual bool getJointTypeRaw(int axis, yarp::dev::JointTypeEnum& type) override;
483 
484  //Internal use, not exposed by Yarp (yet)
485  bool getRotorEncoderResolutionRaw(int m, double &rotres) ;
486  bool getJointEncoderResolutionRaw(int m, double &jntres) ;
487  bool getJointEncoderTypeRaw(int j, int &type) ;
488  bool getRotorEncoderTypeRaw(int j, int &type) ;
489  bool getKinematicMJRaw(int j, double &rotres) ;
490  bool getHasTempSensorsRaw(int j, int& ret) ;
491  bool getHasHallSensorRaw(int j, int& ret) ;
492  bool getHasRotorEncoderRaw(int j, int& ret) ;
493  bool getHasRotorEncoderIndexRaw(int j, int& ret) ;
494  bool getMotorPolesRaw(int j, int& poles) ;
495  bool getRotorIndexOffsetRaw(int j, double& rotorOffset) ;
496  bool getTorqueControlFilterType(int j, int& type) ;
497  bool getRotorLimitsRaw(int j, double *rotorMin, double *rotorMax) ;
498  bool getWholeImpedanceRaw(int j, eOmc_impedance_t &imped);
499 
501  virtual bool enableAmpRaw(int j) override;
502  virtual bool disableAmpRaw(int j) override;
503  virtual bool getCurrentsRaw(double *vals) override;
504  virtual bool getCurrentRaw(int j, double *val) override;
505  virtual bool setMaxCurrentRaw(int j, double val) override;
506  virtual bool getMaxCurrentRaw(int j, double *val) override;
507  virtual bool getAmpStatusRaw(int *st) override;
508  virtual bool getAmpStatusRaw(int j, int *st) override;
509  virtual bool getPWMRaw(int j, double* val) override;
510  virtual bool getPWMLimitRaw(int j, double* val) override;
511  virtual bool setPWMLimitRaw(int j, const double val) override;
512  virtual bool getPowerSupplyVoltageRaw(int j, double* val) override;
514 
515  // virtual analog sensor
516  virtual yarp::dev::VAS_status getVirtualAnalogSensorStatus(int ch) override;
517  virtual int getVirtualAnalogSensorChannels() override;
518  virtual bool updateVirtualAnalogSensorMeasure(yarp::sig::Vector &fTorques) override;
519  virtual bool updateVirtualAnalogSensorMeasure(int j, double &fTorque) override;
520 
521 #ifdef IMPLEMENT_DEBUG_INTERFACE
522  //----------------------------------------------
523  // Debug interface
524  //----------------------------------------------
525  virtual bool setParameterRaw(int j, unsigned int type, double value) override;
526  virtual bool getParameterRaw(int j, unsigned int type, double *value) override;
527  virtual bool setDebugParameterRaw(int j, unsigned int index, double value) override;
528  virtual bool setDebugReferencePositionRaw(int j, double value) override;
529  virtual bool getDebugParameterRaw(int j, unsigned int index, double *value) override;
530  virtual bool getDebugReferencePositionRaw(int j, double *value) override;
531 #endif
532 
533  // Limits
534  virtual bool setLimitsRaw(int axis, double min, double max) override;
535  virtual bool getLimitsRaw(int axis, double *min, double *max) override;
536  // Limits 2
537  virtual bool setVelLimitsRaw(int axis, double min, double max) override;
538  virtual bool getVelLimitsRaw(int axis, double *min, double *max) override;
539 
540  // Torque control
541  virtual bool getTorqueRaw(int j, double *t) override;
542  virtual bool getTorquesRaw(double *t) override;
543  virtual bool getTorqueRangeRaw(int j, double *min, double *max) override;
544  virtual bool getTorqueRangesRaw(double *min, double *max) override;
545  virtual bool setRefTorquesRaw(const double *t) override;
546  virtual bool setRefTorqueRaw(int j, double t) override;
547  virtual bool setRefTorquesRaw(const int n_joint, const int *joints, const double *t) override;
548  virtual bool getRefTorquesRaw(double *t) override;
549  virtual bool getRefTorqueRaw(int j, double *t) override;
550  virtual bool getMotorTorqueParamsRaw(int j, MotorTorqueParameters *params) override;
551  virtual bool setMotorTorqueParamsRaw(int j, const MotorTorqueParameters params) override;
552 
553 
554  // IVelocityControl2
555  virtual bool velocityMoveRaw(const int n_joint, const int *joints, const double *spds) override;
556  virtual bool getRefVelocityRaw(const int joint, double *ref) override;
557  virtual bool getRefVelocitiesRaw(double *refs) override;
558  virtual bool getRefVelocitiesRaw(const int n_joint, const int *joints, double *refs) override;
559 
560 
561  // Impedance interface
562  virtual bool getImpedanceRaw(int j, double *stiffness, double *damping) override;
563  virtual bool setImpedanceRaw(int j, double stiffness, double damping) override;
564  virtual bool setImpedanceOffsetRaw(int j, double offset) override;
565  virtual bool getImpedanceOffsetRaw(int j, double *offset) override;
566  virtual bool getCurrentImpedanceLimitRaw(int j, double *min_stiff, double *max_stiff, double *min_damp, double *max_damp) override;
567 
568  // PositionDirect Interface
569  virtual bool setPositionRaw(int j, double ref) override;
570  virtual bool setPositionsRaw(const int n_joint, const int *joints, const double *refs) override;
571  virtual bool setPositionsRaw(const double *refs) override;
572  virtual bool getRefPositionRaw(const int joint, double *ref) override;
573  virtual bool getRefPositionsRaw(double *refs) override;
574  virtual bool getRefPositionsRaw(const int n_joint, const int *joints, double *refs) override;
575 
576  // InteractionMode interface
577  virtual bool getInteractionModeRaw(int j, yarp::dev::InteractionModeEnum* _mode) override;
578  virtual bool getInteractionModesRaw(int n_joints, int *joints, yarp::dev::InteractionModeEnum* modes) override;
579  virtual bool getInteractionModesRaw(yarp::dev::InteractionModeEnum* modes) override;
580  virtual bool setInteractionModeRaw(int j, yarp::dev::InteractionModeEnum _mode) override;
581  virtual bool setInteractionModesRaw(int n_joints, int *joints, yarp::dev::InteractionModeEnum* modes) override;
582  virtual bool setInteractionModesRaw(yarp::dev::InteractionModeEnum* modes) override;
583 
584  // IMotor interface
585  virtual bool getNumberOfMotorsRaw(int * num) override;
586  virtual bool getTemperatureRaw(int m, double* val) override;
587  virtual bool getTemperaturesRaw(double *vals) override;
588  virtual bool getTemperatureLimitRaw(int m, double *temp) override;
589  virtual bool setTemperatureLimitRaw(int m, const double temp) override;
590  virtual bool getPeakCurrentRaw(int m, double *val) override;
591  virtual bool setPeakCurrentRaw(int m, const double val) override;
592  virtual bool getNominalCurrentRaw(int m, double *val) override;
593  virtual bool setNominalCurrentRaw(int m, const double val) override;
594  virtual bool getGearboxRatioRaw(int m, double *gearbox) override;
595 
596  // PWMControl
597  virtual bool setRefDutyCycleRaw(int j, double v) override;
598  virtual bool setRefDutyCyclesRaw(const double *v) override;
599  virtual bool getRefDutyCycleRaw(int j, double *v) override;
600  virtual bool getRefDutyCyclesRaw(double *v) override;
601  virtual bool getDutyCycleRaw(int j, double *v) override;
602  virtual bool getDutyCyclesRaw(double *v) override;
603 
604  // CurrentControl
605  // virtual bool getAxes(int *ax) override;
606  //virtual bool getCurrentRaw(int j, double *t) override;
607  //virtual bool getCurrentsRaw(double *t) override;
608  virtual bool getCurrentRangeRaw(int j, double *min, double *max) override;
609  virtual bool getCurrentRangesRaw(double *min, double *max) override;
610  virtual bool setRefCurrentsRaw(const double *t) override;
611  virtual bool setRefCurrentRaw(int j, double t) override;
612  virtual bool setRefCurrentsRaw(const int n_joint, const int *joints, const double *t) override;
613  virtual bool getRefCurrentsRaw(double *t) override;
614  virtual bool getRefCurrentRaw(int j, double *t) override;
615 
616  // Used in joint faults interface
617  // Teturns true if it was successful and writes the fault code in the fault parameter
618  // with the associated string in message. If no fault is detected the fault parameters is set to -1.
619  // Returns false and fault is set to -2 if retrieval was unsuccessful.
620  virtual bool getLastJointFaultRaw(int j, int& fault, std::string& message) override;
621 
622 };
623 
624 #endif // include guard
embObjMotionControl : driver for iCub motor control boards EMS on a ETH bus.
_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
Definition: IethResource.h:61
const FSC max
Definition: strain.h:48
const FSC min
Definition: strain.h:49
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
vector< vector< int > > set2joint