YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FakeMotionControl.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_DEVICE_FAKE_MOTIONCONTROL
7#define YARP_DEVICE_FAKE_MOTIONCONTROL
8
9#include <yarp/os/Time.h>
10#include <yarp/os/Bottle.h>
11#include <yarp/sig/Vector.h>
22
23#include <mutex>
25
27{
28 double min_stiff;
29 double max_stiff;
30 double min_damp;
31 double max_damp;
32 double param_a;
33 double param_b;
34 double param_c;
35
36public:
38 {
39 min_stiff=0;
40 max_stiff=0;
41 min_damp=0;
42 max_damp=0;
43 param_a=0;
44 param_b=0;
45 param_c=0;
46 }
47
49 {
50 return min_stiff;
51 }
53 {
54 return max_stiff;
55 }
56 double get_min_damp()
57 {
58 return min_damp;
59 }
60 double get_max_damp()
61 {
62 return max_damp;
63 }
64};
65
73
133{
134private:
135 enum VerboseLevel
136 {
137 MUTE = 0, // only errors that prevent device from working
138 QUIET = 1, // adds errors that can cause malfunctioning
139 DEFAULT = 2, // adds warnings // DEFAULT // show noisy messages about back-compatible changes
140 CHATTY = 3, // adds info messages
141 VERBOSE = 4, // adds debug messages
142 VERY_VERBOSE = 5, // adds trace of events (shows thread running and catch if they get stuck)
143 VERY_VERY_VERBOSE = 6 // adds messages printed every cycle, so too much verbose for usage, only for deep debugging
144 };
145
146 std::recursive_mutex _mutex;
147 double _cycleTimestamp;
148 int _njoints;
149 int *_axisMap= nullptr;
150 double* _angleToEncoder = nullptr;
151 double* _encodersStamp = nullptr;
152 double* _ampsToSensor = nullptr;
153 double* _dutycycleToPWM = nullptr;
154 float* _DEPRECATED_encoderconversionfactor = nullptr;
155 float* _DEPRECATED_encoderconversionoffset = nullptr;
156// uint8_t *_jointEncoderType; /** joint encoder type*/
157 int* _jointEncoderRes = nullptr;
158 int* _rotorEncoderRes = nullptr;
159 // uint8_t *_rotorEncoderType= nullptr; /** rotor encoder type*/
160 double* _gearbox = nullptr;
161 bool* _hasHallSensor = nullptr;
162 bool* _hasTempSensor = nullptr;
163 bool* _hasRotorEncoder = nullptr;
164 bool* _hasRotorEncoderIndex = nullptr;
165 int* _rotorIndexOffset = nullptr;
166 int* _motorPoles = nullptr;
167 double* _rotorlimits_max = nullptr;
168 double* _rotorlimits_min = nullptr;
169 yarp::dev::Pid *_ppids= nullptr;
170 yarp::dev::Pid *_tpids= nullptr;
171 yarp::dev::Pid *_cpids= nullptr;
172 yarp::dev::Pid *_vpids= nullptr;
173 bool *_ppids_ena= nullptr;
174 bool *_tpids_ena= nullptr;
175 bool *_cpids_ena= nullptr;
176 bool *_vpids_ena= nullptr;
177 double *_ppids_lim= nullptr;
178 double *_tpids_lim= nullptr;
179 double *_cpids_lim= nullptr;
180 double *_vpids_lim= nullptr;
181 double *_ppids_ref= nullptr;
182 double *_tpids_ref= nullptr;
183 double *_cpids_ref= nullptr;
184 double *_vpids_ref= nullptr;
185
186 std::string* _axisName = nullptr;
187 yarp::dev::JointTypeEnum* _jointType = nullptr;
188// ImpedanceLimits *_impedance_limits= nullptr; /** impedance limits */
189 double* _limitsMin = nullptr;
190 double* _limitsMax = nullptr;
191 double* _kinematic_mj = nullptr;
192 //double *_currentLimits= nullptr; /** current limits */
193// MotorCurrentLimits *_currentLimits= nullptr;
194 double* _maxJntCmdVelocity = nullptr;
195 double* _maxMotorVelocity = nullptr;
196 int* _velocityShifts = nullptr;
197 int* _velocityTimeout = nullptr;
198 double* _kbemf = nullptr;
199 double* _ktau = nullptr;
200 int* _kbemf_scale = nullptr;
201 int* _ktau_scale = nullptr;
202 double* _viscousPos = nullptr;
203 double* _viscousNeg = nullptr;
204 double* _coulombPos = nullptr;
205 double* _coulombNeg = nullptr;
206 double* _velocityThres = nullptr;
207 int* _filterType = nullptr;
208 int* _torqueSensorId = nullptr;
209 int* _torqueSensorChan = nullptr;
210 double* _maxTorque = nullptr;
211 double* _newtonsToSensor = nullptr;
212 bool* checking_motiondone = nullptr; /* flag telling if I'm already waiting for motion done */
213 double* _last_position_move_time = nullptr;
214 double* _motorPwmLimits = nullptr;
215 double* _torques = nullptr;
216 bool* _braked= nullptr;
217 bool* _autobraked= nullptr;
218
219// ImpedanceParameters *_impedance_params; /** impedance parameters */
220
221 bool verbosewhenok;
222 bool useRawEncoderData;
223 bool _pwmIsLimited;
224 bool _torqueControlEnabled;
226 enum torqueControlUnitsType {T_MACHINE_UNITS=0, T_METRIC_UNITS=1};
227 torqueControlUnitsType _torqueControlUnits;
228
229 enum positionControlUnitsType {P_MACHINE_UNITS=0, P_METRIC_UNITS=1};
230 positionControlUnitsType _positionControlUnits;
231
232 // internal stuff
233 bool velocity_watchdog_enabled = false; //false for testing purposes. On the real robot is true.
234 bool openloop_watchdog_enabled = false; //false for testing purposes. On the real robot is true.
235 int *_controlModes = nullptr;
236 int *_hwfault_code = nullptr;
237 std::string *_hwfault_message = nullptr;
238 int *_interactMode = nullptr;
239 bool *_enabledAmp = nullptr; // 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.
240 bool *_enabledPid = nullptr; // 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.
241 bool *_calibrated = nullptr; // Flag to know if the calibrate function has been called for the joint
242 double *_posCtrl_references = nullptr; // used for position control.
243 double *_posDir_references = nullptr; // used for position Direct control.
244 double *_ref_speeds = nullptr; // used for position control.
245 double *_command_speeds = nullptr; // used for velocity control.
246 double *_dir_vel_commands = nullptr; // used for direct velocity control.
247 double *_ref_accs = nullptr; // for velocity control, in position min jerk eq is used.
248 double *_ref_torques = nullptr; // for torque control.
249 double *_ref_currents = nullptr;
250
251 double *_stiffness = nullptr;
252 double *_damping = nullptr;
253 double *_force_offset = nullptr;
254
255 yarp::sig::Vector current, nominalCurrent, maxCurrent, peakCurrent;
256 yarp::sig::Vector pwm, pwmLimit, refpwm, supplyVoltage,last_velocity_command, last_pwm_command;
257 yarp::sig::Vector pos, dpos, vel, speed, acc, loc, amp;
258 double prev_time;
259 bool opened;
260
261 // debugging
262 VerboseLevel verbose;
263public:
264
267
268 // Device Driver
269 bool open(yarp::os::Searchable &par) override;
270 bool close() override;
271 bool fromConfig(yarp::os::Searchable &config);
272
273 virtual bool initialised();
274
278 bool alloc(int njoints);
279
283 void resizeBuffers();
284
285 bool threadInit() override;
286 void threadRelease() override;
287
289 bool setPidRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, const yarp::dev::Pid &pid) override;
290 bool setPidsRaw(const yarp::dev::PidControlTypeEnum& pidtype,const yarp::dev::Pid *pids) override;
291 bool setPidReferenceRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double ref) override;
292 bool setPidReferencesRaw(const yarp::dev::PidControlTypeEnum& pidtype,const double *refs) override;
293 bool setPidErrorLimitRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double limit) override;
294 bool setPidErrorLimitsRaw(const yarp::dev::PidControlTypeEnum& pidtype,const double *limits) override;
295 bool getPidErrorRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double *err) override;
296 bool getPidErrorsRaw(const yarp::dev::PidControlTypeEnum& pidtype, double *errs) override;
297 bool getPidOutputRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double *out) override;
298 bool getPidOutputsRaw(const yarp::dev::PidControlTypeEnum& pidtype,double *outs) override;
299 bool getPidRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, yarp::dev::Pid *pid) override;
300 bool getPidsRaw(const yarp::dev::PidControlTypeEnum& pidtype, yarp::dev::Pid *pids) override;
301 bool getPidReferenceRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double *ref) override;
302 bool getPidReferencesRaw(const yarp::dev::PidControlTypeEnum& pidtype,double *refs) override;
303 bool getPidErrorLimitRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double *limit) override;
304 bool getPidErrorLimitsRaw(const yarp::dev::PidControlTypeEnum& pidtype,double *limits) override;
305 bool resetPidRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j) override;
306 bool disablePidRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j) override;
307 bool enablePidRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j) override;
308 bool setPidOffsetRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double v) override;
309 bool isPidEnabledRaw(const yarp::dev::PidControlTypeEnum& pidtype, int j, bool* enabled) override;
310
311 // POSITION CONTROL INTERFACE RAW
312 bool getAxes(int *ax) override;
313 bool positionMoveRaw(int j, double ref) override;
314 bool positionMoveRaw(const double *refs) override;
315 bool relativeMoveRaw(int j, double delta) override;
316 bool relativeMoveRaw(const double *deltas) override;
317 bool checkMotionDoneRaw(bool *flag) override;
318 bool checkMotionDoneRaw(int j, bool *flag) override;
319 bool setRefSpeedRaw(int j, double sp) override;
320 bool setRefSpeedsRaw(const double *spds) override;
321 bool setRefAccelerationRaw(int j, double acc) override;
322 bool setRefAccelerationsRaw(const double *accs) override;
323 bool getRefSpeedRaw(int j, double *ref) override;
324 bool getRefSpeedsRaw(double *spds) override;
325 bool getRefAccelerationRaw(int j, double *acc) override;
326 bool getRefAccelerationsRaw(double *accs) override;
327 bool stopRaw(int j) override;
328 bool stopRaw() override;
329
330 // Position Control2 Interface
331 bool positionMoveRaw(const int n_joint, const int *joints, const double *refs) override;
332 bool relativeMoveRaw(const int n_joint, const int *joints, const double *deltas) override;
333 bool checkMotionDoneRaw(const int n_joint, const int *joints, bool *flags) override;
334 bool setRefSpeedsRaw(const int n_joint, const int *joints, const double *spds) override;
335 bool setRefAccelerationsRaw(const int n_joint, const int *joints, const double *accs) override;
336 bool getRefSpeedsRaw(const int n_joint, const int *joints, double *spds) override;
337 bool getRefAccelerationsRaw(const int n_joint, const int *joints, double *accs) override;
338 bool stopRaw(const int n_joint, const int *joints) override;
339 bool getTargetPositionRaw(const int joint, double *ref) override;
340 bool getTargetPositionsRaw(double *refs) override;
341 bool getTargetPositionsRaw(const int n_joint, const int *joints, double *refs) override;
342
343 // Velocity control interface raw
344 bool velocityMoveRaw(int j, double sp) override;
345 bool velocityMoveRaw(const double *sp) override;
346
347 // IJointFault
348 bool getLastJointFaultRaw(int j, int& fault, std::string& message) override;
349
350 // calibration2raw
351 bool setCalibrationParametersRaw(int axis, const yarp::dev::CalibrationParameters& params) override;
352 bool calibrateAxisWithParamsRaw(int axis, unsigned int type, double p1, double p2, double p3) override;
353 bool calibrationDoneRaw(int j) override;
354
355
357
358 // ControlMode
359 bool getControlModeRaw(int j, int *v) override;
360 bool getControlModesRaw(int *v) override;
361
362 // ControlMode 2
363 bool getControlModesRaw(const int n_joint, const int *joints, int *modes) override;
364 bool setControlModeRaw(const int j, const int mode) override;
365 bool setControlModesRaw(const int n_joint, const int *joints, int *modes) override;
366 bool setControlModesRaw(int *modes) override;
367
369 bool resetEncoderRaw(int j) override;
370 bool resetEncodersRaw() override;
371 bool setEncoderRaw(int j, double val) override;
372 bool setEncodersRaw(const double *vals) override;
373 bool getEncoderRaw(int j, double *v) override;
374 bool getEncodersRaw(double *encs) override;
375 bool getEncoderSpeedRaw(int j, double *sp) override;
376 bool getEncoderSpeedsRaw(double *spds) override;
377 bool getEncoderAccelerationRaw(int j, double *spds) override;
378 bool getEncoderAccelerationsRaw(double *accs) override;
380
381 bool getEncodersTimedRaw(double *encs, double *stamps) override;
382 bool getEncoderTimedRaw(int j, double *encs, double *stamp) override;
383
385 bool getNumberOfMotorEncodersRaw(int * num) override;
386 bool resetMotorEncoderRaw(int m) override;
387 bool resetMotorEncodersRaw() override;
388 bool setMotorEncoderRaw(int m, const double val) override;
389 bool setMotorEncodersRaw(const double *vals) override;
390 bool getMotorEncoderRaw(int m, double *v) override;
391 bool getMotorEncodersRaw(double *encs) override;
392 bool getMotorEncoderSpeedRaw(int m, double *sp) override;
393 bool getMotorEncoderSpeedsRaw(double *spds) override;
394 bool getMotorEncoderAccelerationRaw(int m, double *spds) override;
395 bool getMotorEncoderAccelerationsRaw(double *accs) override;
396 bool getMotorEncodersTimedRaw(double *encs, double *stamps) override;
397 bool getMotorEncoderTimedRaw(int m, double *encs, double *stamp) override;
398 bool getMotorEncoderCountsPerRevolutionRaw(int m, double *v) override;
399 bool setMotorEncoderCountsPerRevolutionRaw(int m, const double cpr) override;
401
403 bool getAxisNameRaw(int axis, std::string& name) override;
404 bool getJointTypeRaw(int axis, yarp::dev::JointTypeEnum& type) override;
406
407 //Internal use, not exposed by YARP (yet)
408 virtual bool getRotorEncoderResolutionRaw(int m, double &rotres);
409 virtual bool getJointEncoderResolutionRaw(int m, double &jntres);
410 virtual bool getJointEncoderTypeRaw(int j, int &type);
411 virtual bool getRotorEncoderTypeRaw(int j, int &type);
412 virtual bool getKinematicMJRaw(int j, double &rotres);
413 virtual bool getHasTempSensorsRaw(int j, int& ret);
414 virtual bool getHasHallSensorRaw(int j, int& ret);
415 virtual bool getHasRotorEncoderRaw(int j, int& ret);
416 virtual bool getHasRotorEncoderIndexRaw(int j, int& ret);
417 virtual bool getMotorPolesRaw(int j, int& poles);
418 virtual bool getRotorIndexOffsetRaw(int j, double& rotorOffset);
419 virtual bool getTorqueControlFilterType(int j, int& type);
420
422 bool enableAmpRaw(int j) override;
423 bool disableAmpRaw(int j) override;
424 bool getCurrentsRaw(double *vals) override;
425 bool getCurrentRaw(int j, double *val) override;
426 bool getNominalCurrentRaw(int m, double *val) override;
427 bool setNominalCurrentRaw(int m, const double val) override;
428 bool setMaxCurrentRaw(int j, double val) override;
429 bool getMaxCurrentRaw(int j, double *val) override;
430 bool getPeakCurrentRaw(int m, double *val) override;
431 bool setPeakCurrentRaw(int m, const double val) override;
432 bool getAmpStatusRaw(int *st) override;
433 bool getAmpStatusRaw(int j, int *st) override;
434 bool getPWMRaw(int j, double* val) override;
435 bool getPWMLimitRaw(int j, double* val) override;
436 bool setPWMLimitRaw(int j, const double val) override;
437 bool getPowerSupplyVoltageRaw(int j, double* val) override;
439
440 // Limits
441 bool setLimitsRaw(int axis, double min, double max) override;
442 bool getLimitsRaw(int axis, double *min, double *max) override;
443 // Limits 2
444 bool setVelLimitsRaw(int axis, double min, double max) override;
445 bool getVelLimitsRaw(int axis, double *min, double *max) override;
446
447 // Torque control
448 bool getTorqueRaw(int j, double *t) override;
449 bool getTorquesRaw(double *t) override;
450 bool getTorqueRangeRaw(int j, double *min, double *max) override;
451 bool getTorqueRangesRaw(double *min, double *max) override;
452 bool setRefTorquesRaw(const double *t) override;
453 bool setRefTorqueRaw(int j, double t) override;
454 bool setRefTorquesRaw(const int n_joint, const int *joints, const double *t) override;
455 bool getRefTorquesRaw(double *t) override;
456 bool getRefTorqueRaw(int j, double *t) override;
457 bool getMotorTorqueParamsRaw(int j, yarp::dev::MotorTorqueParameters *params) override;
458 bool setMotorTorqueParamsRaw(int j, const yarp::dev::MotorTorqueParameters params) override;
459// int32_t getRefSpeedInTbl(uint8_t boardNum, int j, eOmeas_position_t pos) override;
460
461 // IVelocityControl interface
462 bool velocityMoveRaw(const int n_joint, const int *joints, const double *spds) override;
463 bool getRefVelocityRaw(const int joint, double *ref) override;
464 bool getRefVelocitiesRaw(double *refs) override;
465 bool getRefVelocitiesRaw(const int n_joint, const int *joints, double *refs) override;
466
467 // Impedance interface
468 bool getImpedanceRaw(int j, double *stiffness, double *damping) override;
469 bool setImpedanceRaw(int j, double stiffness, double damping) override;
470 bool setImpedanceOffsetRaw(int j, double offset) override;
471 bool getImpedanceOffsetRaw(int j, double *offset) override;
472 bool getCurrentImpedanceLimitRaw(int j, double *min_stiff, double *max_stiff, double *min_damp, double *max_damp) override;
473
474 // PositionDirect Interface
475 bool setPositionRaw(int j, double ref) override;
476 bool setPositionsRaw(const int n_joint, const int *joints, const double *refs) override;
477 bool setPositionsRaw(const double *refs) override;
478 bool getRefPositionRaw(const int joint, double *ref) override;
479 bool getRefPositionsRaw(double *refs) override;
480 bool getRefPositionsRaw(const int n_joint, const int *joints, double *refs) override;
481
482 // InteractionMode interface
483 bool getInteractionModeRaw(int j, yarp::dev::InteractionModeEnum* _mode) override;
484 bool getInteractionModesRaw(int n_joints, int *joints, yarp::dev::InteractionModeEnum* modes) override;
486 bool setInteractionModeRaw(int j, yarp::dev::InteractionModeEnum _mode) override;
487 bool setInteractionModesRaw(int n_joints, int *joints, yarp::dev::InteractionModeEnum* modes) override;
489
490 // IMotor interface
491 bool getNumberOfMotorsRaw(int * num) override;
492 bool getTemperatureRaw(int m, double* val) override;
493 bool getTemperaturesRaw(double *vals) override;
494 bool getTemperatureLimitRaw(int m, double *temp) override;
495 bool setTemperatureLimitRaw(int m, const double temp) override;
496 bool getGearboxRatioRaw(int m, double* gearbox) override;
497 bool setGearboxRatioRaw(int m, const double val) override;
498
499 // PWM interface
500 bool setRefDutyCycleRaw(int j, double v) override;
501 bool setRefDutyCyclesRaw(const double *v) override;
502 bool getRefDutyCycleRaw(int j, double *v) override;
503 bool getRefDutyCyclesRaw(double *v) override;
504 bool getDutyCycleRaw(int j, double *v) override;
505 bool getDutyCyclesRaw(double *v) override;
506
507 //IJointBrake
508 yarp::dev::ReturnValue isJointBrakedRaw(int j, bool& braked) const override;
509 yarp::dev::ReturnValue setManualBrakeActiveRaw(int j, bool active) override;
510 yarp::dev::ReturnValue setAutoBrakeEnabledRaw(int j, bool enabled) override;
511 yarp::dev::ReturnValue getAutoBrakeEnabledRaw(int j, bool& enabled) const override;
512
513 // IVelocityDirect
514 yarp::dev::ReturnValue getAxes(size_t& axes) override;
515 yarp::dev::ReturnValue setDesiredVelocityRaw(int jnt, double vel) override;
516 yarp::dev::ReturnValue setDesiredVelocityRaw(const std::vector<double>& vels) override;
517 yarp::dev::ReturnValue setDesiredVelocityRaw(const std::vector<int>& jnts, const std::vector<double>& vels) override;
518 yarp::dev::ReturnValue getDesiredVelocityRaw(const int jnt, double& vel) override;
519 yarp::dev::ReturnValue getDesiredVelocityRaw(std::vector<double>& vels) override;
520 yarp::dev::ReturnValue getDesiredVelocityRaw(const std::vector<int>& jnts, std::vector<double>& vels) override;
521
522 // Current interface
523 //bool getAxes(int *ax) override;
524 //bool getCurrentRaw(int j, double *t) override;
525 //bool getCurrentsRaw(double *t) override;
526 bool getCurrentRangeRaw(int j, double *min, double *max) override;
527 bool getCurrentRangesRaw(double *min, double *max) override;
528 bool setRefCurrentsRaw(const double *t) override;
529 bool setRefCurrentRaw(int j, double t) override;
530 bool setRefCurrentsRaw(const int n_joint, const int *joints, const double *t) override;
531 bool getRefCurrentsRaw(double *t) override;
532 bool getRefCurrentRaw(int j, double *t) override;
533
537 bool updateVirtualAnalogSensorMeasureRaw(int ch, double &measure) override;
538
539 void run() override;
540private:
541 void cleanup();
542 bool dealloc();
543
544 //bool parsePositionPidsGroup(yarp::os::Bottle& pidsGroup, yarp::dev::Pid myPid[]);
545 //bool parseTorquePidsGroup(yarp::os::Bottle& pidsGroup, yarp::dev::Pid myPid[], double kbemf[], double ktau[], int filterType[], double viscousPos[], double viscousNeg[], double coulombPos[], double coulombNeg[], double velocityThres[]);
546 //bool parseImpedanceGroup_NewFormat(yarp::os::Bottle& pidsGroup, ImpedanceParameters vals[]);
547 //bool extractGroup(yarp::os::Bottle &input, yarp::os::Bottle &out, const std::string &key1, const std::string &txt, int size);
548};
549
550#endif // YARP_DEVICE_FAKE_MOTIONCONTROL
define control board standard interfaces
FeatureMode mode
virtual analog sensor interface
bool ret
contains the definition of a Vector type
This class is the parameters parser for class FakeMotionControl.
fakeMotionControl: The aim of this device is to mimic the expected behavior of a real motion control ...
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.
yarp::dev::ReturnValue setAutoBrakeEnabledRaw(int j, bool enabled) override
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
Get the number of available motors.
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 setGearboxRatioRaw(int m, const double val) override
Set the gearbox ratio for a specific motor.
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.
yarp::dev::ReturnValue getDesiredVelocityRaw(const int jnt, double &vel) override
Get the last reference velocity set by setDesiredVelocity() for a single joint.
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)
yarp::dev::ReturnValue setManualBrakeActiveRaw(int j, bool active) override
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.
yarp::dev::ReturnValue isJointBrakedRaw(int j, bool &braked) const override
void threadRelease() override
Release method.
bool getAmpStatusRaw(int *st) override
bool getLastJointFaultRaw(int j, int &fault, std::string &message) 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
yarp::dev::ReturnValue setDesiredVelocityRaw(int jnt, double vel) override
Set the velocity of single joint.
yarp::dev::ReturnValue getAutoBrakeEnabledRaw(int j, bool &enabled) const override
bool getAxisNameRaw(int axis, std::string &name) override
bool setCalibrationParametersRaw(int axis, const yarp::dev::CalibrationParameters &params) 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)
Interface implemented by all device drivers.
Interface for control devices, amplifier commands.
Interface for getting information about specific axes, if available.
Definition IAxisInfo.h:72
Interface for control devices, calibration commands.
Interface for control devices.
Interface for setting control mode in control board.
Interface for control boards implementing current control.
Control board, extend encoder raw interface adding timestamps.
Interface for control boards implementing impedance control.
Interface settings the way the robot interacts with the environment: basic interaction types are Stif...
Interface for controlling a joint equipped with brakes (hardware or simulated).
Definition IJointBrake.h:70
Interface for getting info about the fault which may occur on a robot.
Definition IJointFault.h:35
Control board, encoder interface.
Control board, encoder interface.
Definition IMotor.h:24
Interface for controlling an axis, by sending directly a PWM reference signal to a motor.
Definition IPWMControl.h:84
Interface for a generic control board device implementing a PID controller.
Definition IPidControl.h:27
Interface for a generic control board device implementing position control in encoder coordinates.
Interface for a generic control board device implementing position control in encoder coordinates.
Interface for control boards implementing torque control.
Interface for control boards implementig velocity control in encoder coordinates.
Interface for control boards implementing direct velocity control.
A generic interface to a virtual sensors.
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.
An abstraction for a periodic thread.
A base class for nested structures that can be searched.
Definition Searchable.h:31
PidControlTypeEnum
Definition PidEnums.h:15
ImpedanceLimits limits