yarp-devices
Loading...
Searching...
No Matches
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 Types

using return_t = bool

Public Member Functions

 TechnosoftIposBase (const TechnosoftIpos_ParamsParser &_params)
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.
return_t getAxisNameRaw (int axis, std::string &name) override
return_t getJointTypeRaw (int axis, yarp::dev::JointTypeEnum &type) override
return_t setLimitsRaw (int axis, double min, double max) override
return_t getLimitsRaw (int axis, double *min, double *max) override
return_t setVelLimitsRaw (int axis, double min, double max) override
return_t getVelLimitsRaw (int axis, double *min, double *max) override
return_t getControlModesRaw (int *modes) override
return_t getControlModesRaw (int n_joint, const int *joints, int *modes) override
return_t setControlModesRaw (int *modes) override
return_t setControlModesRaw (int n_joint, const int *joints, int *modes) override
return_t getCurrentRaw (int m, double *curr) override
return_t getCurrentsRaw (double *currs) override
return_t getCurrentRangeRaw (int m, double *min, double *max) override
return_t getCurrentRangesRaw (double *min, double *max) override
return_t setRefCurrentRaw (int m, double curr) override
return_t setRefCurrentsRaw (const double *currs) override
return_t setRefCurrentsRaw (int n_motor, const int *motors, const double *currs) override
return_t getRefCurrentRaw (int m, double *curr) override
return_t getRefCurrentsRaw (double *currs) override
return_t getAxes (int *ax) override
return_t resetEncoderRaw (int j) override
return_t resetEncodersRaw () override
return_t setEncoderRaw (int j, double val) override
return_t setEncodersRaw (const double *vals) override
return_t getEncoderRaw (int j, double *v) override
return_t getEncodersRaw (double *encs) override
return_t getEncoderSpeedRaw (int j, double *sp) override
return_t getEncoderSpeedsRaw (double *spds) override
return_t getEncoderAccelerationRaw (int j, double *spds) override
return_t getEncoderAccelerationsRaw (double *accs) override
return_t getEncoderTimedRaw (int j, double *encs, double *time) override
return_t getEncodersTimedRaw (double *encs, double *times) override
return_t getImpedanceRaw (int j, double *stiffness, double *damping) override
return_t setImpedanceRaw (int j, double stiffness, double damping) override
return_t setImpedanceOffsetRaw (int j, double offset) override
return_t getImpedanceOffsetRaw (int j, double *offset) override
return_t getCurrentImpedanceLimitRaw (int j, double *min_stiff, double *max_stiff, double *min_damp, double *max_damp) override
return_t getInteractionModeRaw (int axis, yarp::dev::InteractionModeEnum *mode) override
return_t getInteractionModesRaw (int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
return_t getInteractionModesRaw (yarp::dev::InteractionModeEnum *modes) override
return_t setInteractionModeRaw (int axis, yarp::dev::InteractionModeEnum mode) override
return_t setInteractionModesRaw (int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
return_t setInteractionModesRaw (yarp::dev::InteractionModeEnum *modes) override
return_t getLastJointFaultRaw (int j, int &fault, std::string &message) override
return_t getNumberOfMotorsRaw (int *num) override
return_t getTemperatureRaw (int m, double *val) override
return_t getTemperaturesRaw (double *vals) override
return_t getTemperatureLimitRaw (int m, double *temp) override
return_t setTemperatureLimitRaw (int m, double temp) override
return_t getGearboxRatioRaw (int m, double *val) override
return_t setGearboxRatioRaw (int m, double val) override
return_t getNumberOfMotorEncodersRaw (int *num) override
return_t resetMotorEncoderRaw (int m) override
return_t resetMotorEncodersRaw () override
return_t setMotorEncoderCountsPerRevolutionRaw (int m, double cpr) override
return_t getMotorEncoderCountsPerRevolutionRaw (int m, double *cpr) override
return_t setMotorEncoderRaw (int m, double val) override
return_t setMotorEncodersRaw (const double *vals) override
return_t getMotorEncoderRaw (int m, double *v) override
return_t getMotorEncodersRaw (double *encs) override
return_t getMotorEncoderTimedRaw (int m, double *encs, double *stamp) override
return_t getMotorEncodersTimedRaw (double *encs, double *stamps) override
return_t getMotorEncoderSpeedRaw (int m, double *sp) override
return_t getMotorEncoderSpeedsRaw (double *spds) override
return_t getMotorEncoderAccelerationRaw (int m, double *spds) override
return_t getMotorEncoderAccelerationsRaw (double *accs) override
return_t setPidRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, const yarp::dev::Pid &pid) override
return_t setPidsRaw (const yarp::dev::PidControlTypeEnum &pidtype, const yarp::dev::Pid *pids) override
return_t setPidReferenceRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double ref) override
return_t setPidReferencesRaw (const yarp::dev::PidControlTypeEnum &pidtype, const double *refs) override
return_t setPidErrorLimitRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double limit) override
return_t setPidErrorLimitsRaw (const yarp::dev::PidControlTypeEnum &pidtype, const double *limits) override
return_t getPidErrorRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double *err) override
return_t getPidErrorsRaw (const yarp::dev::PidControlTypeEnum &pidtype, double *errs) override
return_t getPidOutputRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double *out) override
return_t getPidOutputsRaw (const yarp::dev::PidControlTypeEnum &pidtype, double *outs) override
return_t getPidRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, yarp::dev::Pid *pid) override
return_t getPidsRaw (const yarp::dev::PidControlTypeEnum &pidtype, yarp::dev::Pid *pids) override
return_t getPidReferenceRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double *ref) override
return_t getPidReferencesRaw (const yarp::dev::PidControlTypeEnum &pidtype, double *refs) override
return_t getPidErrorLimitRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double *limit) override
return_t getPidErrorLimitsRaw (const yarp::dev::PidControlTypeEnum &pidtype, double *limits) override
return_t resetPidRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j) override
return_t disablePidRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j) override
return_t enablePidRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j) override
return_t setPidOffsetRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, double v) override
return_t isPidEnabledRaw (const yarp::dev::PidControlTypeEnum &pidtype, int j, bool *enabled) override
return_t positionMoveRaw (const double *refs) override
return_t positionMoveRaw (int n_joint, const int *joints, const double *refs) override
return_t relativeMoveRaw (const double *deltas) override
return_t relativeMoveRaw (int n_joint, const int *joints, const double *deltas) override
return_t checkMotionDoneRaw (bool *flag) override
return_t checkMotionDoneRaw (int n_joint, const int *joints, bool *flag) override
return_t setRefSpeedsRaw (const double *spds) override
return_t setRefSpeedsRaw (int n_joint, const int *joints, const double *spds) override
return_t setRefAccelerationsRaw (const double *accs) override
return_t setRefAccelerationsRaw (int n_joint, const int *joints, const double *accs) override
return_t getRefSpeedsRaw (double *spds) override
return_t getRefSpeedsRaw (int n_joint, const int *joints, double *spds) override
return_t getRefAccelerationsRaw (double *accs) override
return_t getRefAccelerationsRaw (int n_joint, const int *joints, double *accs) override
return_t stopRaw () override
return_t stopRaw (int n_joint, const int *joints) override
return_t getTargetPositionsRaw (double *refs) override
return_t getTargetPositionsRaw (int n_joint, const int *joints, double *refs) override
return_t setPositionsRaw (const double *refs) override
return_t setPositionsRaw (int n_joint, const int *joints, const double *refs) override
return_t getRefPositionsRaw (double *refs) override
return_t getRefPositionsRaw (int n_joint, const int *joints, double *refs) override
return_t getRefTorqueRaw (int j, double *t) override
return_t getRefTorquesRaw (double *t) override
return_t setRefTorqueRaw (int j, double t) override
return_t setRefTorquesRaw (int n_joint, const int *joints, const double *t) override
return_t setRefTorquesRaw (const double *t) override
return_t getTorqueRaw (int j, double *t) override
return_t getTorquesRaw (double *t) override
return_t getTorqueRangeRaw (int j, double *min, double *max) override
return_t getTorqueRangesRaw (double *min, double *max) override
return_t getMotorTorqueParamsRaw (int j, yarp::dev::MotorTorqueParameters *params) override
return_t setMotorTorqueParamsRaw (int j, const yarp::dev::MotorTorqueParameters params) override
return_t velocityMoveRaw (const double *sp) override
return_t velocityMoveRaw (int n_joint, const int *joints, const double *spds) override
return_t getRefVelocitiesRaw (double *vels) override
return_t 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.

Static Public Attributes

static constexpr auto ret_not_ok = false

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

CanOpenNode * can {nullptr}
CommandBuffer commandBuffer
std::unique_ptr< StateObserver > controlModeObserverPtr {new StateObserver(1.0)}
std::unique_ptr< EncoderRead > lastEncoderRead {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}
yarp::conf::vocab32_t jointType {0}
PdoConfiguration tpdo1Conf
PdoConfiguration tpdo2Conf
PdoConfiguration tpdo3Conf
const TechnosoftIpos_ParamsParser & params

Private Member Functions

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 setPosLimitRaw (double limit, bool isMin)
bool getPosLimitRaw (double *limit, bool isMin)

Static Private Member Functions

static bool validateInitialState (const TechnosoftIpos_ParamsParser &params, const std::string &id)
 Make sure stored variables actually make sense.

Private Attributes

yarp::dev::PolyDriver externalEncoderDevice
yarp::dev::IEncodersTimedRaw * iEncodersTimedRawExternal {nullptr}
roboticslab::ICanBusSharer * iExternalEncoderCanBusSharer {nullptr}
yarp::os::Timer * monitorThread {nullptr}
roboticslab::ICanSenderDelegate * sender {nullptr}

Member Function Documentation

◆ finalize()

bool TechnosoftIposBase::finalize ( )
overridevirtual

◆ getAdditionalIds()

std::vector< unsigned int > TechnosoftIposBase::getAdditionalIds ( )
overridevirtual

Reimplemented from roboticslab::ICanBusSharer.

◆ getId()

unsigned int TechnosoftIposBase::getId ( )
overridevirtual

◆ initialize()

bool TechnosoftIposBase::initialize ( )
overridevirtual

◆ notifyMessage()

bool TechnosoftIposBase::notifyMessage ( const can_message & msg)
overridevirtual

◆ registerSender()

bool TechnosoftIposBase::registerSender ( ICanSenderDelegate * sender)
overridevirtual

The documentation for this class was generated from the following files:
  • libraries/YarpPlugins/TechnosoftIpos/TechnosoftIposBase.hpp
  • libraries/YarpPlugins/TechnosoftIpos/DeviceDriverImpl.cpp
  • libraries/YarpPlugins/TechnosoftIpos/IAxisInfoRawImpl.cpp
  • libraries/YarpPlugins/TechnosoftIpos/ICanBusSharerImpl.cpp
  • libraries/YarpPlugins/TechnosoftIpos/IControlLimitsRawImpl.cpp
  • libraries/YarpPlugins/TechnosoftIpos/ICurrentControlRawImpl.cpp
  • libraries/YarpPlugins/TechnosoftIpos/IEncodersRawImpl.cpp
  • libraries/YarpPlugins/TechnosoftIpos/IJointFaultRawImpl.cpp
  • libraries/YarpPlugins/TechnosoftIpos/IMotorEncodersRawImpl.cpp
  • libraries/YarpPlugins/TechnosoftIpos/IMotorRawImpl.cpp
  • libraries/YarpPlugins/TechnosoftIpos/ITorqueControlRawImpl.cpp
  • libraries/YarpPlugins/TechnosoftIpos/TechnosoftIposBase.cpp