|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
9 #ifndef YARP_DEVICE_FAKE_MOTIONCONTROL
10 #define YARP_DEVICE_FAKE_MOTIONCONTROL
136 VERY_VERY_VERBOSE = 6
142 double *_angleToEncoder;
143 double *_encodersStamp;
144 double *_ampsToSensor;
145 double *_dutycycleToPWM;
146 float *_DEPRECATED_encoderconversionfactor;
147 float *_DEPRECATED_encoderconversionoffset;
149 int *_jointEncoderRes;
150 int *_rotorEncoderRes;
153 bool *_hasHallSensor;
154 bool *_hasTempSensor;
155 bool *_hasRotorEncoder;
156 bool *_hasRotorEncoderIndex;
157 int *_rotorIndexOffset;
159 double *_rotorlimits_max;
160 double *_rotorlimits_min;
178 std::string *_axisName;
183 double *_kinematic_mj;
186 double *_maxJntCmdVelocity;
187 double *_maxMotorVelocity;
188 int *_velocityShifts;
189 int *_velocityTimeout;
195 int *_torqueSensorId;
196 int *_torqueSensorChan;
198 double *_newtonsToSensor;
199 bool *checking_motiondone;
200 double *_last_position_move_time;
201 double *_motorPwmLimits;
207 bool useRawEncoderData;
209 bool _torqueControlEnabled;
211 enum torqueControlUnitsType {T_MACHINE_UNITS=0, T_METRIC_UNITS=1};
212 torqueControlUnitsType _torqueControlUnits;
214 enum positionControlUnitsType {P_MACHINE_UNITS=0, P_METRIC_UNITS=1};
215 positionControlUnitsType _positionControlUnits;
223 double *_posCtrl_references;
224 double *_posDir_references;
226 double *_command_speeds;
228 double *_ref_torques;
229 double *_ref_currents;
231 yarp::sig::Vector pwm, pwmLimit, refpwm, supplyVoltage,last_velocity_command, last_pwm_command;
237 VerboseLevel verbose;
245 bool close()
override;
253 bool alloc(
int njoints);
287 bool getAxes(
int *ax)
override;
306 bool positionMoveRaw(
const int n_joint,
const int *joints,
const double *refs)
override;
307 bool relativeMoveRaw(
const int n_joint,
const int *joints,
const double *deltas)
override;
309 bool setRefSpeedsRaw(
const int n_joint,
const int *joints,
const double *spds)
override;
311 bool getRefSpeedsRaw(
const int n_joint,
const int *joints,
double *spds)
override;
313 bool stopRaw(
const int n_joint,
const int *joints)
override;
408 bool getPWMRaw(
int j,
double* val)
override;
415 bool setLimitsRaw(
int axis,
double min,
double max)
override;
416 bool getLimitsRaw(
int axis,
double *min,
double *max)
override;
428 bool setRefTorquesRaw(
const int n_joint,
const int *joints,
const double *
t)
override;
436 bool velocityMoveRaw(
const int n_joint,
const int *joints,
const double *spds)
override;
442 bool getImpedanceRaw(
int j,
double *stiffness,
double *damping)
override;
443 bool setImpedanceRaw(
int j,
double stiffness,
double damping)
override;
450 bool setPositionsRaw(
const int n_joint,
const int *joints,
const double *refs)
override;
487 bool setRefCurrentsRaw(
const int n_joint,
const int *joints,
const double *
t)
override;
507 #endif // YARP_DEVICE_FAKE_MOTIONCONTROL
Control board, encoder interface.
virtual bool getHasHallSensorRaw(int j, int &ret)
bool getTorqueRangesRaw(double *min, double *max) override
Get the full scale of the torque sensors of all joints.
bool getPidRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, yarp::dev::Pid *pid) override
Get current pid value for a specific joint.
A simple collection of objects that can be described and transmitted in a portable way.
bool setPositionRaw(int j, double ref) override
Set new position for a single axis.
bool setPidErrorLimitRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, double limit) override
Set the error limit for the controller on a specific joint.
bool checkMotionDoneRaw(bool *flag) override
Check if the current trajectory is terminated.
bool getNominalCurrentRaw(int m, double *val) override
bool getMotorEncoderTimedRaw(int m, double *encs, double *stamp) override
Read the instantaneous position of a motor encoder.
bool getEncoderAccelerationRaw(int j, double *spds) override
Read the instantaneous acceleration of an axis.
bool setEncodersRaw(const double *vals) override
Set the value of all encoders.
bool getPidErrorLimitsRaw(const yarp::dev::PidControlTypeEnum &pidtype, double *limits) override
Get the error limit for all controllers.
A base class for nested structures that can be searched.
bool getRefAccelerationRaw(int j, double *acc) override
Get reference acceleration for a joint.
bool getPidErrorRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *err) override
Get the current error for a joint.
Default implementation of the IPositionControl interface.
bool getRefDutyCycleRaw(int j, double *v) override
Gets the last reference sent using the setRefDutyCycleRaw function.
contains the definition of a Vector type
bool setMotorEncodersRaw(const double *vals) override
Set the value of all motor encoders.
bool setPidReferenceRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, double ref) override
Set the controller reference for a given axis.
bool resetMotorEncodersRaw() override
Reset motor encoders.
bool setRefCurrentRaw(int j, double t) override
Set the reference value of the current for a single motor.
void run() override
Loop function.
bool getAxes(int *ax) override
Get the number of controlled axes.
bool getInteractionModeRaw(int j, yarp::dev::InteractionModeEnum *_mode) override
Get the current interaction mode of the robot, values can be stiff or compliant.
Interface settings the way the robot interacts with the environment: basic interaction types are Stif...
bool setPidRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, const yarp::dev::Pid &pid) override
Set new pid value for a joint axis.
bool getAmpStatusRaw(int *st) override
virtual bool getHasRotorEncoderRaw(int j, int &ret)
bool setPWMLimitRaw(int j, const double val) override
bool velocityMoveRaw(int j, double sp) override
Start motion at a given speed, single joint.
bool setEncoderRaw(int j, double val) override
Set the value of the encoder for a given joint.
bool getPidErrorLimitRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *limit) override
Get the error limit for the controller on a specific joint.
bool stopRaw() override
Stop motion, multiple joints.
bool enablePidRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j) override
Enable the pid computation for a joint.
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 ...
Interface for controlling an axis, by sending directly a PWM reference signal to a motor.
bool getCurrentRangeRaw(int j, double *min, double *max) override
Get the full scale of the current measurement for a given motor (e.g.
bool getEncoderAccelerationsRaw(double *accs) override
Read the instantaneous acceleration of all axes.
bool relativeMoveRaw(int j, double delta) override
Set relative position.
Interface implemented by all device drivers.
bool threadInit() override
Initialization method.
bool getCurrentRaw(int j, double *val) override
Interface for control boards implementing torque control.
bool getPeakCurrentRaw(int m, double *val) override
bool getPidsRaw(const yarp::dev::PidControlTypeEnum &pidtype, yarp::dev::Pid *pids) override
Get current pid value for a specific joint.
bool getControlModesRaw(int *v) override
bool setPidErrorLimitsRaw(const yarp::dev::PidControlTypeEnum &pidtype, const double *limits) override
Get the error limit for the controller on all joints.
bool resetEncodersRaw() override
Reset encoders.
bool setRefDutyCycleRaw(int j, double v) override
Sets the reference dutycycle of a single motor.
Control board, encoder interface.
Interface for control devices, calibration commands.
bool setControlModesRaw(const int n_joint, const int *joints, int *modes) override
bool getMotorEncodersRaw(double *encs) override
Read the position of all motor encoders.
A generic interface to a virtual sensors.
int getVirtualAnalogSensorChannelsRaw() override
Get the number of channels of the virtual sensor.
define control board standard interfaces
virtual bool getMotorPolesRaw(int j, int &poles)
bool calibrateAxisWithParamsRaw(int axis, unsigned int type, double p1, double p2, double p3) override
Start calibration, this method is very often platform specific.
bool getTemperaturesRaw(double *vals) override
Get temperature of all the motors.
virtual bool getRotorEncoderTypeRaw(int j, int &type)
bool disableAmpRaw(int j) override
Disable the amplifier on a specific joint.
bool setImpedanceRaw(int j, double stiffness, double damping) override
Set current impedance parameters (stiffness,damping) for a specific joint.
bool getNumberOfMotorEncodersRaw(int *num) override
Get the number of available motor encoders.
bool getEncoderRaw(int j, double *v) override
Read the value of an encoder.
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...
virtual bool initialised()
virtual bool getRotorEncoderResolutionRaw(int m, double &rotres)
bool setMotorEncoderCountsPerRevolutionRaw(int m, const double cpr) override
Sets number of counts per revolution for motor encoder m.
bool getTemperatureLimitRaw(int m, double *temp) override
Retreives the current temperature limit for a specific motor.
bool getNumberOfMotorsRaw(int *num) override
Retrieves the number of controlled motors from the current physical interface.
Interface for control boards implementing impedance control.
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.
virtual bool getHasTempSensorsRaw(int j, int &ret)
bool getPidErrorsRaw(const yarp::dev::PidControlTypeEnum &pidtype, double *errs) override
Get the error of all joints.
Interface for control boards implementing current control.
virtual bool getHasRotorEncoderIndexRaw(int j, int &ret)
Interface settings the way the robot interacts with the environment: basic interaction types are Stif...
Interface for setting control mode in control board.
bool getRefTorqueRaw(int j, double *t) override
Set the reference value of the torque for a given joint.
bool getImpedanceRaw(int j, double *stiffness, double *damping) override
Get current impedance parameters (stiffness,damping,offset) for a specific joint.
bool getJointTypeRaw(int axis, yarp::dev::JointTypeEnum &type) override
bool getDutyCycleRaw(int j, double *v) override
Gets the current dutycycle of the output of the amplifier (i.e.
bool getRefAccelerationsRaw(double *accs) override
Get reference acceleration of all joints.
bool setInteractionModeRaw(int j, yarp::dev::InteractionModeEnum _mode) override
Set the interaction mode of the robot, values can be stiff or compliant.
bool setPeakCurrentRaw(int m, const double val) 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.
bool updateVirtualAnalogSensorMeasureRaw(yarp::sig::Vector &measure) override
Set a vector of torque values for virtual sensor.
bool resetMotorEncoderRaw(int m) override
Reset motor encoder, single motor.
bool getTemperatureRaw(int m, double *val) override
Get temperature of a motor.
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 getEncoderTimedRaw(int j, double *encs, double *stamp) override
Read the instantaneous acceleration of all axes.
bool fromConfig(yarp::os::Searchable &config)
bool close() override
Close the DeviceDriver.
bool setRefAccelerationRaw(int j, double acc) override
Set reference acceleration for a joint.
bool getMotorEncoderAccelerationRaw(int m, double *spds) override
Read the instantaneous acceleration of a motor encoder.
Interface for a generic control board device implementing position control in encoder coordinates.
bool getTargetPositionsRaw(double *refs) override
Get the last position reference for all axes.
bool isPidEnabledRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, bool *enabled) override
Get the current status (enabled/disabled) of the pid controller.
bool positionMoveRaw(int j, double ref) override
Set new reference point for a single axis.
bool setPidOffsetRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j, double v) override
Set an offset value on the ourput of pid controller.
bool setPidReferencesRaw(const yarp::dev::PidControlTypeEnum &pidtype, const double *refs) override
Set the controller reference, multiple axes.
bool getGearboxRatioRaw(int m, double *gearbox) override
Get the gearbox ratio for a specific motor.
bool setCalibrationParametersRaw(int axis, const yarp::dev::CalibrationParameters ¶ms) override
Start calibration, this method is very often platform specific.
bool setPidsRaw(const yarp::dev::PidControlTypeEnum &pidtype, const yarp::dev::Pid *pids) override
Set new pid value on multiple axes.
bool getPidReferencesRaw(const yarp::dev::PidControlTypeEnum &pidtype, double *refs) override
Get the current reference of all pid controllers.
bool getRefCurrentsRaw(double *t) override
Get the reference value of the currents for all motors.
bool getAxisNameRaw(int axis, std::string &name) override
bool getRefDutyCyclesRaw(double *v) override
Gets the last reference sent using the setRefDutyCyclesRaw function.
bool getEncodersTimedRaw(double *encs, double *stamps) override
Read the instantaneous acceleration of all axes.
bool setMotorTorqueParamsRaw(int j, const yarp::dev::MotorTorqueParameters params) override
Set the motor parameters.
bool getImpedanceOffsetRaw(int j, double *offset) override
Get current force Offset for a specific joint.
Interface for a generic control board device implementing a PID controller.
virtual bool getJointEncoderResolutionRaw(int m, double &jntres)
bool getMotorEncoderSpeedsRaw(double *spds) override
Read the instantaneous speed of all motor encoders.
bool getRefVelocitiesRaw(double *refs) override
Get the last reference speed set by velocityMove for all joints.
An abstraction for a periodic thread.
Interface for control devices.
bool alloc(int njoints)
Allocated buffers.
bool getMotorEncoderRaw(int m, double *v) override
Read the value of a motor encoder.
bool setRefDutyCyclesRaw(const double *v) override
Sets the reference dutycycle for all motors.
bool setRefTorqueRaw(int j, double t) override
Set the reference value of the torque for a given joint.
bool getMotorEncoderSpeedRaw(int m, double *sp) override
Read the istantaneous speed of a motor encoder.
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 getRefPositionsRaw(double *refs) override
Get the last position reference for all axes.
bool getTargetPositionRaw(const int joint, double *ref) override
Get the last position reference for the specified axis.
bool getMaxCurrentRaw(int j, double *val) override
Returns the maximum electric current allowed for a given motor.
bool getLimitsRaw(int axis, double *min, double *max) override
Get the software limits for a particular axis.
bool resetEncoderRaw(int j) override
Reset encoder, single joint.
Control board, extend encoder raw interface adding timestamps.
virtual bool getRotorIndexOffsetRaw(int j, double &rotorOffset)
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 getEncoderSpeedsRaw(double *spds) override
Read the instantaneous acceleration of an axis.
bool getPWMRaw(int j, double *val) override
bool getVelLimitsRaw(int axis, double *min, double *max) override
Get the software speed limits for a particular axis.
bool setRefCurrentsRaw(const double *t) override
Set the reference value of the currents for all motors.
bool enableAmpRaw(int j) override
Enable the amplifier on a specific joint.
virtual bool getKinematicMJRaw(int j, double &rotres)
bool setMaxCurrentRaw(int j, double val) override
Interface for getting information about specific axes, if available.
virtual bool getJointEncoderTypeRaw(int j, int &type)
Interface for a generic control board device implementing position control in encoder coordinates.
bool getRefVelocityRaw(const int joint, double *ref) override
Get the last reference speed set by velocityMove for single joint.
class ImplementControlLimits; class StubImplControlLimitsRaw;
bool getEncodersRaw(double *encs) override
Read the position of all axes.
fakeMotionControl: Documentation to be added
bool calibrationDoneRaw(int j) override
Check if the calibration is terminated, on a particular joint.
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 getRefSpeedsRaw(double *spds) override
Get reference speed of all joints.
bool setRefSpeedsRaw(const double *spds) override
Set reference speed on all joints.
bool setTemperatureLimitRaw(int m, const double temp) override
Set the temperature limit for a specific motor.
bool setRefTorquesRaw(const double *t) override
Set the reference value of the torque for all joints.
Contains the parameters for a PID.
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 getRefTorquesRaw(double *t) override
Get the reference value of the torque for all joints.
bool getDutyCyclesRaw(double *v) override
Gets the current dutycycle of the output of the amplifier (i.e.
virtual bool getTorqueControlFilterType(int j, int &type)
bool getControlModeRaw(int j, int *v) override
bool getMotorEncoderCountsPerRevolutionRaw(int m, double *v) override
Gets number of counts per revolution for motor encoder m.
bool getCurrentRangesRaw(double *min, double *max) override
Get the full scale of the current measurements for all motors motor (e.g.
bool getMotorEncoderAccelerationsRaw(double *accs) override
Read the instantaneous acceleration of all motor encoders.
Interface for control boards implementig velocity control in encoder coordinates.
yarp::dev::VAS_status getVirtualAnalogSensorStatusRaw(int ch) override
Check the status of a given channel.
bool getEncoderSpeedRaw(int j, double *sp) override
Read the instantaneous speed of an axis.
bool getTorqueRangeRaw(int j, double *min, double *max) override
Get the full scale of the torque sensor of a given joint.
Interface for control devices, amplifier commands.
bool open(yarp::os::Searchable &par) override
Open the DeviceDriver.
virtual analog sensor interface
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 getTorquesRaw(double *t) override
Get the value of the torque for all joints (this is the feedback if you have torque sensors).
bool getRefCurrentRaw(int j, double *t) override
Get the reference value of the current for a single motor.
bool getRefPositionRaw(const int joint, double *ref) override
Get the last position reference for the specified axis.
bool getPowerSupplyVoltageRaw(int j, double *val) override
bool setPositionsRaw(const int n_joint, const int *joints, const double *refs) override
Set new reference point for all axes.
bool setRefAccelerationsRaw(const double *accs) override
Set reference acceleration on all joints.
bool setImpedanceOffsetRaw(int j, double offset) override
Set current force Offset for a specific joint.
bool getMotorEncodersTimedRaw(double *encs, double *stamps) override
Read the instantaneous position of all motor encoders.
bool disablePidRaw(const yarp::dev::PidControlTypeEnum &pidtype, int j) override
Disable the pid computation for a joint.
void threadRelease() override
Release method.
bool getPidOutputsRaw(const yarp::dev::PidControlTypeEnum &pidtype, double *outs) override
Get the output of the controllers (e.g.
Default implementation of the IPositionDirect interface.
bool setNominalCurrentRaw(int m, const double val) override
bool getCurrentsRaw(double *vals) override
void resizeBuffers()
Resize previously allocated buffers.
bool getRefSpeedRaw(int j, double *ref) override
Get reference speed for a joint.
bool getMotorTorqueParamsRaw(int j, yarp::dev::MotorTorqueParameters *params) override
Get the motor parameters.
bool getPWMLimitRaw(int j, double *val) override
bool setMotorEncoderRaw(int m, const double val) override
Set the value of the motor encoder for a given motor.