4#ifndef ISAACSIM_MAS_SENSORS_NWC_ROS2_H
5#define ISAACSIM_MAS_SENSORS_NWC_ROS2_H
12#include <xhand_control.hpp>
20#include <unordered_map>
26 class xHandControlBoard;
63 bool close()
override;
109 bool getAxes(
int* ax)
override;
115 bool positionMove(
const int n_joints,
const int* joints,
const double* refs)
override;
127 bool relativeMove(
const int n_joints,
const int* joints,
const double* deltas)
override;
133 bool checkMotionDone(
const int n_joints,
const int* joints,
bool* flags)
override;
139 bool setRefSpeeds(
const int n_joints,
const int* joints,
const double* spds)
override;
145 bool setRefAccelerations(
const int n_joints,
const int* joints,
const double* accs)
override;
151 bool getRefSpeeds(
const int n_joints,
const int* joints,
double* spds)
override;
159 bool stop(
int j)
override;
161 bool stop()
override;
163 bool stop(
const int n_joints,
const int* joints)
override;
251 bool getPWM(
int m,
double* val)
override;
255 bool setPWMLimit(
int m,
const double val)
override;
260 bool setLimits(
int j,
double min,
double max)
override;
262 bool getLimits(
int j,
double* min,
double* max)
override;
264 bool setVelLimits(
int j,
double min,
double max)
override;
266 bool getVelLimits(
int j,
double* min,
double* max)
override;
326 bool getAxisName(
int j, std::string& name)
override;
338 bool setRefTorques(
const int n_joint,
const int* joints,
const double* t)
override;
344 bool setImpedance(
int j,
double stiff,
double damp)
override;
348 bool getTorque(
int j,
double* t)
override;
356 bool getImpedance(
int j,
double* stiff,
double* damp)
override;
360 bool getCurrentImpedanceLimit(
int j,
double* min_stiff,
double* max_stiff,
double* min_damp,
double* max_damp)
override;
367 bool getControlModes(
const int n_joint,
const int* joints,
int* modes)
override;
371 bool setControlModes(
const int n_joints,
const int* joints,
int* modes)
override;
377 bool setPositions(
const int n_joints,
const int* joints,
const double* dpos)
override;
385 bool getRefPositions(
const int n_joint,
const int* joints,
double* refs)
override;
390 bool velocityMove(
const int n_joints,
const int* joints,
const double* spds)
override;
396 bool getRefVelocities(
const int n_joint,
const int* joints,
double* vels)
override;
424 bool getCurrent(
int m,
double* curr)
override;
436 bool setRefCurrents(
const int n_motor,
const int* motors,
const double* currs)
override;
449 xhand_control::XHandControl m_XHCtrl{};
452 int* m_controlModes{};
454 double timestamp{0.0};
458 HandCommand_t m_handCommand;
460 std::unordered_map<int, int> yarpToXhandControlModes = {
467 void printErrorStruct(
const xhand_control::ErrorStruct& err);
468 bool sendCommandToHand(
const uint8_t hand_id,
const HandCommand_t& command);
define control board standard interfaces
This class is the parameters parser for class xHandControlBoard.
Interface implemented by all device drivers.
Interface for control devices, amplifier commands.
Interface for getting information about specific axes, if available.
Interface for control devices, calibration commands.
Interface for control devices, commands to get/set position and velocity limits.
Interface for setting control mode in control board.
Interface for control boards implementing current control.
Control board, extend encoder interface with 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 getting info about the fault which may occur on a robot.
Control board, encoder interface.
Control board, encoder interface.
Interface for controlling an axis, by sending directly a PWM reference signal to a motor.
Interface for a generic control board device implementing a PID controller, with scaled arguments.
Interface for a generic control board device implementing position control.
Interface for a generic control board device implementing position control.
IRemoteCalibrator interface is meant to remotize the access of the calibration device in order to all...
IRemoteVariables interface.
Interface for control boards implementing torque control.
Interface for control boards implementing velocity control.
Contains the parameters for a PID.
bool setLimits(int j, double min, double max) override
bool getMotorTorqueParams(int j, yarp::dev::MotorTorqueParameters *params) override
Get a subset of motor parameters (bemf, ktau etc) useful for torque control.
bool setMotorEncoders(const double *vals) override
Set the value of all motor encoders.
bool getPid(const yarp::dev::PidControlTypeEnum &pidtype, int j, yarp::dev::Pid *p) override
Get current PID value for a specific joint.
bool setMotorTorqueParams(int j, const yarp::dev::MotorTorqueParameters params) override
Set a subset of motor parameters (bemf, ktau etc) useful for torque control.
bool getRemoteVariable(std::string key, yarp::os::Bottle &val) override
bool setPeakCurrent(int m, const double val) override
bool setRefCurrent(int m, double curr) override
Set the reference value of the current for a single motor.
bool resetEncoders() override
Reset encoders.
bool resetMotorEncoder(int m) override
Reset motor encoder, single motor.
bool homingWholePart() override
homingWholePart: call the homing procedure for a the whole part/device
bool disableAmp(int j) override
Disable the amplifier on a specific joint.
bool getRefDutyCycle(int m, double *ref) override
Gets the last reference sent using the setRefDutyCycle function.
bool getRefAcceleration(int j, double *acc) override
bool resetMotorEncoders() override
Reset motor encoders.
bool getRefAccelerations(double *accs) override
bool setControlMode(const int j, const int mode) override
bool setPidErrorLimits(const yarp::dev::PidControlTypeEnum &pidtype, const double *limits) override
Get the error limit for the controller on all joints.
bool getEncodersTimed(double *encs, double *t) override
Read the instantaneous acceleration of all axes.
bool getEncoderAccelerations(double *accs) override
Read the instantaneous acceleration of all axes.
bool velocityMove(int j, double v) override
Start motion at a given speed, single joint.
bool getPidErrorLimits(const yarp::dev::PidControlTypeEnum &pidtype, double *limits) override
Get the error limit for all controllers.
bool disablePid(const yarp::dev::PidControlTypeEnum &pidtype, int j) override
Disable the PID computation for a joint.
bool getMotorEncoderAcceleration(int m, double *acc) override
Read the instantaneous acceleration of a motor encoder.
bool setPWMLimit(int m, const double val) override
bool getNominalCurrent(int m, double *val) override
bool getPeakCurrent(int m, double *val) override
bool getPidReferences(const yarp::dev::PidControlTypeEnum &pidtype, double *refs) override
Get the current reference of all PID controllers.
bool getCurrentRange(int m, double *min, double *max) override
Get the full scale of the current measurement for a given motor (e.g.
bool getMotorEncoder(int m, double *v) override
Read the value of a motor encoder.
bool checkMotionDone(int j, bool *flag) override
bool setControlModes(const int n_joints, const int *joints, int *modes) override
bool getImpedanceOffset(int j, double *offset) override
Get current force Offset for a specific joint.
bool setMotorEncoder(int m, const double val) override
Set the value of the motor encoder for a given motor.
bool getTorqueRanges(double *min, double *max) override
Get the full scale of the torque sensors of all joints.
bool positionMove(int j, double ref) override
Set new reference point for a single axis.
bool getNumberOfMotorEncoders(int *num) override
Get the number of available motor encoders.
bool getTorques(double *t) override
Get the value of the torque for all joints (this is the feedback if you have torque sensors).
bool getTargetPositions(double *refs) override
Get the last position reference for all axes.
bool getDutyCycle(int m, double *val) override
Gets the current dutycycle of the output of the amplifier (i.e.
bool getRefVelocity(const int joint, double *vel) override
bool enableAmp(int j) override
Enable the amplifier on a specific joint.
bool getLastJointFault(int j, int &fault, std::string &message) override
bool setRefTorque(int j, double t) override
Set the reference value of the torque for a given joint.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool getEncoderAcceleration(int j, double *acc) override
Read the instantaneous acceleration of an axis.
bool setPid(const yarp::dev::PidControlTypeEnum &pidtype, int j, const yarp::dev::Pid &p) override
Set new PID value for a joint axis.
yarp::os::Stamp getLastInputStamp() override
Return the time stamp relative to the last acquisition.
bool getMotorEncoderCountsPerRevolution(int m, double *cpr) override
Gets number of counts per revolution for motor encoder m.
bool parkSingleJoint(int j, bool _wait=true) override
parkSingleJoint(): start the parking procedure for the single joint
bool getPWMLimit(int m, double *val) override
bool homingSingleJoint(int j) override
homingSingleJoint: call the homing procedure for a single joint
bool getMotorEncodersTimed(double *encs, double *t) override
Read the instantaneous position of all motor encoders.
bool getTemperatureLimit(int m, double *val) override
Retrieves the current temperature limit for a specific motor.
bool setPidReferences(const yarp::dev::PidControlTypeEnum &pidtype, const double *refs) override
Set the controller reference, multiple axes.
bool getCurrentImpedanceLimit(int j, double *min_stiff, double *max_stiff, double *min_damp, double *max_damp) override
Get the current impedance limits for a specific joint.
bool getRefCurrents(double *currs) override
Get the reference value of the currents for all motors.
bool setRefAccelerations(const double *accs) override
bool getPidErrorLimit(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *limit) override
Get the error limit for the controller on a specific joint.
bool getMotorEncoderSpeed(int m, double *sp) override
Read the instantaneous speed of a motor encoder.
bool getTorque(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 getMotorEncoders(double *encs) override
Read the position of all motor encoders.
bool setInteractionMode(int j, yarp::dev::InteractionModeEnum mode) override
Set the interaction mode of the robot, values can be stiff or compliant.
bool getTargetPosition(const int joint, double *ref) override
Get the last position reference for the specified axis.
bool getMotorEncoderAccelerations(double *accs) override
Read the instantaneous acceleration of all motor encoders.
bool setImpedanceOffset(int j, double offset) override
Set current force Offset for a specific joint.
bool getRefVelocities(double *vels) override
bool setPidErrorLimit(const yarp::dev::PidControlTypeEnum &pidtype, int j, double limit) override
Set the error limit for the controller on a specific joint.
bool setCalibrationParameters(int j, const yarp::dev::CalibrationParameters ¶ms) override
Start calibration, this method is very often platform specific.
bool setRefDutyCycle(int m, double ref) override
Sets the reference dutycycle to a single motor.
bool setGearboxRatio(int m, const double val) override
Set the gearbox ratio for a specific motor.
bool stop() override
Stop motion, multiple joints.
bool getRefDutyCycles(double *refs) override
Gets the last reference sent using the setRefDutyCycles function.
bool calibrateWholePart() override
calibrateWholePart: call the procedure for calibrating the whole device
bool enablePid(const yarp::dev::PidControlTypeEnum &pidtype, int j) override
Enable the PID computation for a joint.
bool setPids(const yarp::dev::PidControlTypeEnum &pidtype, const yarp::dev::Pid *ps) override
Set new PID value on multiple axes.
bool isPidEnabled(const yarp::dev::PidControlTypeEnum &pidtype, int j, bool *enabled) override
bool setRefAcceleration(int j, double acc) override
bool setMotorEncoderCountsPerRevolution(int m, const double cpr) override
Sets number of counts per revolution for motor encoder m.
bool getAmpStatus(int *st) override
bool getEncoderSpeeds(double *spds) override
Read the instantaneous speed of all axes.
bool abortCalibration() override
bool getControlMode(int j, int *mode) override
bool setImpedance(int j, double stiff, double damp) override
Set current impedance gains (stiffness,damping) for a specific joint.
bool getMotorEncoderTimed(int m, double *v, double *t) override
Read the instantaneous position of a motor encoder.
void threadRelease() override
Release method.
bool getRefPosition(const int joint, double *ref) override
Get the last position reference for the specified axis.
bool setRefCurrents(const double *currs) override
Set the reference value of the currents for all motors.
bool getCurrent(int m, double *curr) override
Get the instantaneous current measurement for a single motor.
bool relativeMove(int j, double delta) override
Set relative position.
bool getAxisName(int j, std::string &name) override
bool getNumberOfMotors(int *num) override
Retrieves the number of controlled motors from the current physical interface.
bool setRefDutyCycles(const double *refs) override
Sets the reference dutycycle for all the motors.
bool getCurrentRanges(double *min, double *max) override
Get the full scale of the current measurements for all motors motor (e.g.
bool calibrateSingleJoint(int j) override
calibrateSingleJoint: call the calibration procedure for the single joint
bool getPidErrors(const yarp::dev::PidControlTypeEnum &pidtype, double *errs) override
Get the error of all joints.
bool getEncoders(double *encs) override
Read the position of all axes.
bool getPidError(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *err) override
Get the current error for a joint.
bool getMotorEncoderSpeeds(double *spds) override
Read the instantaneous speed of all motor encoders.
bool calibrateAxisWithParams(int j, unsigned int ui, double v1, double v2, double v3) override
Start calibration, this method is very often platform specific.
void run() override
Loop function.
bool getRefTorques(double *refs) override
Get the reference value of the torque for all joints.
~xHandControlBoard() override
bool setVelLimits(int j, double min, double max) override
Set the software speed limits for a particular axis, the behavior of the control card when these limi...
bool getJointType(int j, yarp::dev::JointTypeEnum &type) override
yarp::dev::IRemoteCalibrator * getCalibratorDevice() override
getCalibratorDevice: return the pointer stored with the setCalibratorDevice
bool getEncoderSpeed(int j, double *sp) override
Read the istantaneous speed of an axis.
bool getImpedance(int j, double *stiff, double *damp) override
Get current impedance gains (stiffness,damping,offset) for a specific joint.
bool getPidOutput(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *out) override
Get the output of the controller (e.g.
bool setPidOffset(const yarp::dev::PidControlTypeEnum &pidtype, int j, double v) override
Set an offset value for a given controller.
bool setInteractionModes(int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
bool getTemperature(int m, double *val) override
Get temperature of a motor.
bool threadInit() override
Initialization method.
bool getRemoteVariablesList(yarp::os::Bottle *listOfKeys) override
bool quitCalibrate() override
quitCalibrate: interrupt the calibration procedure
bool getInteractionModes(int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
bool resetPid(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 getPids(const yarp::dev::PidControlTypeEnum &pidtype, yarp::dev::Pid *pids) override
Get current PID value for a specific joint.
bool setPosition(int j, double ref) override
Set new position for a single axis.
bool getPWM(int m, double *val) override
bool getRefSpeeds(double *spds) override
bool getPidReference(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *ref) override
Get the current reference of the PID controller for a specific joint.
bool calibrationDone(int j) override
Check if the calibration is terminated, on a particular joint.
bool getPidOutputs(const yarp::dev::PidControlTypeEnum &pidtype, double *outs) override
Get the output of the controllers (e.g.
bool resetEncoder(int j) override
Reset encoder, single joint.
bool getRefPositions(double *refs) override
Get the last position reference for all axes.
bool getVelLimits(int j, double *min, double *max) override
Get the software speed limits for a particular axis.
bool setRefTorques(const double *t) override
Set the reference value of the torque for all joints.
bool getRefCurrent(int m, double *curr) override
Get the reference value of the current for a single motor.
bool abortPark() override
bool getCurrents(double *currs) override
Get the instantaneous current measurement for all motors.
bool getAxes(int *ax) override
bool setNominalCurrent(int m, const double val) override
bool setPositions(const int n_joints, const int *joints, const double *dpos) override
Set new reference point for all axes.
bool getEncoderTimed(int j, double *v, double *t) override
Read the instantaneous acceleration of all axes.
bool getTemperatures(double *vals) override
Get temperature of all the motors.
bool getEncoder(int j, double *v) override
Read the value of an encoder.
bool getPowerSupplyVoltage(int m, double *val) override
bool getInteractionMode(int j, yarp::dev::InteractionModeEnum *mode) override
bool quitPark() override
quitPark: interrupt the park procedure
bool getTorqueRange(int j, double *min, double *max) override
Get the full scale of the torque sensor of a given joint.
bool setRefSpeed(int j, double sp) override
bool setMaxCurrent(int j, double v) override
bool setPidReference(const yarp::dev::PidControlTypeEnum &pidtype, int j, double ref) override
Set the controller reference for a given axis.
bool getRefTorque(int j, double *t) override
Get the reference value of the torque for a given joint.
bool getRefSpeed(int j, double *ref) override
bool setTemperatureLimit(int m, const double val) override
Set the temperature limit for a specific motor.
bool getGearboxRatio(int m, double *val) override
Get the gearbox ratio for a specific motor.
bool setEncoders(const double *vals) override
Set the value of all encoders.
bool getMaxCurrent(int j, double *v) override
Returns the maximum electric current allowed for a given motor.
bool getDutyCycles(double *vals) override
Gets the current dutycycle of the output of the amplifier (i.e.
bool setRefSpeeds(const double *spds) override
bool close() override
Close the DeviceDriver.
bool isCalibratorDevicePresent(bool *isCalib) override
isCalibratorDevicePresent: check if a calibrator device has been set
bool setEncoder(int j, double val) override
Set the value of the encoder for a given joint.
bool getControlModes(int *modes) override
bool parkWholePart() override
parkWholePart: start the parking procedure for the whole part
bool getLimits(int j, double *min, double *max) override
bool setRemoteVariable(std::string key, const yarp::os::Bottle &val) override
A simple collection of objects that can be described and transmitted in a portable way.
An abstraction for a periodic thread.
A base class for nested structures that can be searched.
An abstraction for a time stamp and/or sequence number.
For streams capable of holding different kinds of content, check what they actually have.
@ VOCAB_CM_POSITION_DIRECT