yarp-devices
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
roboticslab::TechnosoftIposBase Class Referenceabstract

Base class for all proxied TechnosoftIpos implementations.

#include <TechnosoftIposBase.hpp>

Inheritance diagram for roboticslab::TechnosoftIposBase:
roboticslab::ICanBusSharer roboticslab::TechnosoftIposEmbedded roboticslab::TechnosoftIposExternal

Classes

struct  report_storage
 

Public Member Functions

bool open (yarp::os::Searchable &config) override
 
bool close () override
 
unsigned int getId () override
 Retrieve CAN node ID.
 
std::vector< unsigned int > getAdditionalIds () override
 Retrieve more associated CAN node IDs, if any.
 
bool notifyMessage (const can_message &message) override
 Notify observers that a new CAN message has arrived.
 
bool initialize () override
 Perform CAN node initialization.
 
bool finalize () override
 Finalize CAN node communications.
 
bool registerSender (ICanSenderDelegate *sender) override
 Pass a handle to a CAN sender delegate instance.
 
bool getAxisNameRaw (int axis, std::string &name) override
 
bool getJointTypeRaw (int axis, yarp::dev::JointTypeEnum &type) override
 
bool setLimitsRaw (int axis, double min, double max) override
 
bool getLimitsRaw (int axis, double *min, double *max) override
 
bool setVelLimitsRaw (int axis, double min, double max) override
 
bool getVelLimitsRaw (int axis, double *min, double *max) override
 
bool getControlModesRaw (int *modes) override
 
bool getControlModesRaw (int n_joint, const int *joints, int *modes) override
 
bool setControlModesRaw (int *modes) override
 
bool setControlModesRaw (int n_joint, const int *joints, int *modes) override
 
bool getCurrentRaw (int m, double *curr) override
 
bool getCurrentsRaw (double *currs) override
 
bool getCurrentRangeRaw (int m, double *min, double *max) override
 
bool getCurrentRangesRaw (double *min, double *max) override
 
bool setRefCurrentRaw (int m, double curr) override
 
bool setRefCurrentsRaw (const double *currs) override
 
bool setRefCurrentsRaw (int n_motor, const int *motors, const double *currs) override
 
bool getRefCurrentRaw (int m, double *curr) override
 
bool getRefCurrentsRaw (double *currs) override
 
bool getAxes (int *ax) override
 
bool resetEncoderRaw (int j) override
 
bool resetEncodersRaw () override
 
bool setEncoderRaw (int j, double val) override
 
bool setEncodersRaw (const double *vals) override
 
bool getEncoderRaw (int j, double *v) override
 
bool getEncodersRaw (double *encs) override
 
bool getEncoderSpeedRaw (int j, double *sp) override
 
bool getEncoderSpeedsRaw (double *spds) override
 
bool getEncoderAccelerationRaw (int j, double *spds) override
 
bool getEncoderAccelerationsRaw (double *accs) override
 
bool getEncoderTimedRaw (int j, double *encs, double *time) override
 
bool getEncodersTimedRaw (double *encs, double *times) override
 
bool getImpedanceRaw (int j, double *stiffness, double *damping) override
 
bool setImpedanceRaw (int j, double stiffness, double damping) override
 
bool setImpedanceOffsetRaw (int j, double offset) override
 
bool getImpedanceOffsetRaw (int j, double *offset) override
 
bool getCurrentImpedanceLimitRaw (int j, double *min_stiff, double *max_stiff, double *min_damp, double *max_damp) override
 
bool getInteractionModeRaw (int axis, yarp::dev::InteractionModeEnum *mode) override
 
bool getInteractionModesRaw (int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
 
bool getInteractionModesRaw (yarp::dev::InteractionModeEnum *modes) override
 
bool setInteractionModeRaw (int axis, yarp::dev::InteractionModeEnum mode) override
 
bool setInteractionModesRaw (int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
 
bool setInteractionModesRaw (yarp::dev::InteractionModeEnum *modes) override
 
bool getLastJointFaultRaw (int j, int &fault, std::string &message) override
 
bool getNumberOfMotorsRaw (int *num) override
 
bool getTemperatureRaw (int m, double *val) override
 
bool getTemperaturesRaw (double *vals) override
 
bool getTemperatureLimitRaw (int m, double *temp) override
 
bool setTemperatureLimitRaw (int m, double temp) override
 
bool getGearboxRatioRaw (int m, double *val) override
 
bool setGearboxRatioRaw (int m, double val) override
 
bool getNumberOfMotorEncodersRaw (int *num) override
 
bool resetMotorEncoderRaw (int m) override
 
bool resetMotorEncodersRaw () override
 
bool setMotorEncoderCountsPerRevolutionRaw (int m, double cpr) override
 
bool getMotorEncoderCountsPerRevolutionRaw (int m, double *cpr) override
 
bool setMotorEncoderRaw (int m, double val) override
 
bool setMotorEncodersRaw (const double *vals) override
 
bool getMotorEncoderRaw (int m, double *v) override
 
bool getMotorEncodersRaw (double *encs) override
 
bool getMotorEncoderTimedRaw (int m, double *encs, double *stamp) override
 
bool getMotorEncodersTimedRaw (double *encs, double *stamps) override
 
bool getMotorEncoderSpeedRaw (int m, double *sp) override
 
bool getMotorEncoderSpeedsRaw (double *spds) override
 
bool getMotorEncoderAccelerationRaw (int m, double *spds) override
 
bool getMotorEncoderAccelerationsRaw (double *accs) override
 
bool setPidRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, const yarp::dev::Pid &pid) override
 
bool setPidsRaw (const yarp::dev::PidControlTypeEnum &pidtype, const yarp::dev::Pid *pids) override
 
bool setPidReferenceRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double ref) override
 
bool setPidReferencesRaw (const yarp::dev::PidControlTypeEnum &pidtype, const double *refs) override
 
bool setPidErrorLimitRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double limit) override
 
bool setPidErrorLimitsRaw (const yarp::dev::PidControlTypeEnum &pidtype, const double *limits) override
 
bool getPidErrorRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double *err) override
 
bool getPidErrorsRaw (const yarp::dev::PidControlTypeEnum &pidtype, double *errs) override
 
bool getPidOutputRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double *out) override
 
bool getPidOutputsRaw (const yarp::dev::PidControlTypeEnum &pidtype, double *outs) override
 
bool getPidRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, yarp::dev::Pid *pid) override
 
bool getPidsRaw (const yarp::dev::PidControlTypeEnum &pidtype, yarp::dev::Pid *pids) override
 
bool getPidReferenceRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double *ref) override
 
bool getPidReferencesRaw (const yarp::dev::PidControlTypeEnum &pidtype, double *refs) override
 
bool getPidErrorLimitRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double *limit) override
 
bool getPidErrorLimitsRaw (const yarp::dev::PidControlTypeEnum &pidtype, double *limits) override
 
bool resetPidRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j) override
 
bool disablePidRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j) override
 
bool enablePidRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j) override
 
bool setPidOffsetRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double v) override
 
bool isPidEnabledRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, bool *enabled) override
 
bool positionMoveRaw (const double *refs) override
 
bool positionMoveRaw (int n_joint, const int *joints, const double *refs) override
 
bool relativeMoveRaw (const double *deltas) override
 
bool relativeMoveRaw (int n_joint, const int *joints, const double *deltas) override
 
bool checkMotionDoneRaw (bool *flag) override
 
bool checkMotionDoneRaw (int n_joint, const int *joints, bool *flag) override
 
bool setRefSpeedsRaw (const double *spds) override
 
bool setRefSpeedsRaw (int n_joint, const int *joints, const double *spds) override
 
bool setRefAccelerationsRaw (const double *accs) override
 
bool setRefAccelerationsRaw (int n_joint, const int *joints, const double *accs) override
 
bool getRefSpeedsRaw (double *spds) override
 
bool getRefSpeedsRaw (int n_joint, const int *joints, double *spds) override
 
bool getRefAccelerationsRaw (double *accs) override
 
bool getRefAccelerationsRaw (int n_joint, const int *joints, double *accs) override
 
bool stopRaw () override
 
bool stopRaw (int n_joint, const int *joints) override
 
bool getTargetPositionsRaw (double *refs) override
 
bool getTargetPositionsRaw (int n_joint, const int *joints, double *refs) override
 
bool setPositionsRaw (const double *refs) override
 
bool setPositionsRaw (int n_joint, const int *joints, const double *refs) override
 
bool getRefPositionsRaw (double *refs) override
 
bool getRefPositionsRaw (int n_joint, const int *joints, double *refs) override
 
bool getRefTorqueRaw (int j, double *t) override
 
bool getRefTorquesRaw (double *t) override
 
bool setRefTorqueRaw (int j, double t) override
 
bool setRefTorquesRaw (int n_joint, const int *joints, const double *t) override
 
bool setRefTorquesRaw (const double *t) override
 
bool getTorqueRaw (int j, double *t) override
 
bool getTorquesRaw (double *t) override
 
bool getTorqueRangeRaw (int j, double *min, double *max) override
 
bool getTorqueRangesRaw (double *min, double *max) override
 
bool getMotorTorqueParamsRaw (int j, yarp::dev::MotorTorqueParameters *params) override
 
bool setMotorTorqueParamsRaw (int j, const yarp::dev::MotorTorqueParameters params) override
 
bool velocityMoveRaw (const double *sp) override
 
bool velocityMoveRaw (int n_joint, const int *joints, const double *spds) override
 
bool getRefVelocitiesRaw (double *vels) override
 
bool getRefVelocitiesRaw (int n_joint, const int *joints, double *vels) override
 
- Public Member Functions inherited from roboticslab::ICanBusSharer
virtual ~ICanBusSharer ()=default
 Destructor.
 
virtual bool synchronize (double timestamp)=0
 Perform synchronized action on CAN master's request.
 
- Public Member Functions inherited from roboticslab::ICanMessageNotifier
virtual ~ICanMessageNotifier ()=default
 Virtual destructor.
 

Protected Types

enum  report_level { NONE , INFO , WARN , FAULT }
 
enum  limit_switch { POSITIVE , NEGATIVE , INACTIVE }
 

Protected Member Functions

bool reportBitToggle (report_storage report, int level, std::size_t pos, const char *msgSet, const char *msgReset=nullptr)
 
virtual void interpretModesOfOperation (std::int8_t modesOfOperation)=0
 
virtual void interpretIpStatus (std::uint16_t ipStatus)
 
virtual void onPositionLimitTriggered ()=0
 
virtual void reset ()=0
 
bool awaitControlMode (yarp::conf::vocab32_t mode)
 Wait with timeout for requested control mode change.
 
double degreesToInternalUnits (double value, int derivativeOrder=0) const
 Convert position, speed or acceleration to internal units.
 
double internalUnitsToDegrees (double value, int derivativeOrder=0) const
 Convert position, speed or acceleration to degrees.
 
std::int16_t currentToInternalUnits (double value) const
 Convert current to internal units.
 
double internalUnitsToCurrent (std::int16_t value) const
 Convert current to amperes.
 
double internalUnitsToPeakCurrent (std::int16_t value) const
 Apply internal iPOS conversion to express drive peak current in amperes.
 
double currentToTorque (double current) const
 Convert current (amperes) to torque (Nm).
 
double torqueToCurrent (double torque) const
 Convert torque (Nm) to current (amperes).
 

Protected Attributes

CanOpenNodecan
 
CommandBuffer commandBuffer
 
std::unique_ptr< StateObservercontrolModeObserverPtr {new StateObserver(1.0)}
 
std::unique_ptr< EncoderReadlastEncoderRead {nullptr}
 
std::bitset< 16 > msr
 
std::bitset< 16 > mer
 
std::bitset< 16 > der
 
std::bitset< 16 > der2
 
std::bitset< 16 > cer
 
std::int8_t modesOfOperation {0}
 
DriveState driveState {DriveState::NOT_READY_TO_SWITCH_ON}
 
bool configuredOnce {false}
 
std::atomic< std::int16_t > lastCurrentRead {0}
 
std::atomic< yarp::conf::vocab32_t > actualControlMode {0}
 
std::atomic< yarp::conf::vocab32_t > requestedcontrolMode {0}
 
std::atomic< double > tr {0.0}
 
std::atomic< double > k {0.0}
 
std::atomic< int > encoderPulses {0}
 
std::atomic< double > maxVel {0.0}
 
std::atomic< double > min {0.0}
 
std::atomic< double > max {0.0}
 
std::atomic< double > refSpeed {0.0}
 
std::atomic< double > refAcceleration {0.0}
 
std::atomic< double > lastHeartbeat {0.0}
 
std::atomic< std::uint8_t > lastNmtState {0}
 
std::atomic< std::uint16_t > lastFaultCode {0}
 
std::atomic< const char * > lastFaultMessage
 
std::atomic< limit_switch > limitSwitchState {INACTIVE}
 
yarp::conf::vocab32_t initialControlMode {0}
 
double drivePeakCurrent {0.0}
 
double samplingPeriod {0.0}
 
std::string axisName
 
yarp::conf::vocab32_t jointType {0}
 
bool reverse {false}
 
PdoConfiguration tpdo1Conf
 
PdoConfiguration tpdo2Conf
 
PdoConfiguration tpdo3Conf
 
double heartbeatPeriod {0.0}
 
double syncPeriod {0.0}
 
unsigned int canId {0}
 

Private Member Functions

bool validateInitialState ()
 Make sure stored variables actually make sense.
 
void interpretMsr (std::uint16_t msr)
 
void interpretMer (std::uint16_t mer)
 
void interpretDer (std::uint16_t der)
 
void interpretDer2 (std::uint16_t der2)
 
void interpretCer (std::uint16_t cer)
 
void interpretStatusword (std::uint16_t statusword)
 
void handleTpdo1 (std::uint16_t statusword, std::uint16_t msr, std::int8_t modesOfOperation)
 
void handleTpdo2 (std::uint16_t mer, std::uint16_t der)
 
void handleTpdo3 (std::int32_t position, std::int16_t current)
 
void handleEmcy (EmcyConsumer::code_t code, std::uint8_t reg, const std::uint8_t *msef)
 
void handleNmt (NmtState state)
 
bool monitorWorker (const yarp::os::YarpTimerEvent &event)
 
bool setLimitRaw (double limit, bool isMin)
 
bool getLimitRaw (double *limit, bool isMin)
 

Private Attributes

yarp::dev::PolyDriver externalEncoderDevice
 
yarp::dev::IEncodersTimedRaw * iEncodersTimedRawExternal
 
roboticslab::ICanBusShareriExternalEncoderCanBusSharer
 
yarp::os::Timer * monitorThread
 
roboticslab::ICanSenderDelegatesender
 

The documentation for this class was generated from the following files: