YARP CiA-402 EtherCAT Device 0.6.0
YARP device plugin for EtherCAT CiA-402 drives
Loading...
Searching...
No Matches
yarp::dev::CiA402MotionControl Class Reference

Minimal CiA‑402 motion‑control driver based on SOEM. More...

#include <CiA402MotionControl.h>

Inheritance diagram for yarp::dev::CiA402MotionControl:
[legend]
Collaboration diagram for yarp::dev::CiA402MotionControl:
[legend]

Classes

struct  Impl
 

Public Member Functions

 CiA402MotionControl (double period, yarp::os::ShouldUseSystemClock useSystemClock=yarp::os::ShouldUseSystemClock::Yes)
 Constructor.
 
 CiA402MotionControl ()
 Default constructor.
 
 ~CiA402MotionControl () override
 Destructor.
 
bool open (yarp::os::Searchable &config) override
 Opens the device driver.
 
bool close () override
 Closes the device driver.
 
void run () override
 Runs the periodic thread.
 
bool getNumberOfMotorEncoders (int *num) override
 Gets the number of motor encoders.
 
bool resetMotorEncoder (int m) override
 Resets the specified motor encoder to zero.
 
bool resetMotorEncoders () override
 Resets all motor encoders to zero.
 
bool setMotorEncoderCountsPerRevolution (int m, const double cpr) override
 Sets the counts per revolution for a specific motor encoder.
 
bool getMotorEncoderCountsPerRevolution (int m, double *cpr) override
 Gets the counts per revolution for a specific motor encoder.
 
bool setMotorEncoder (int m, const double val) override
 Sets the value of a specific motor encoder.
 
bool setMotorEncoders (const double *vals) override
 Sets the values of all motor encoders.
 
bool getMotorEncoder (int m, double *v) override
 Gets the value of a specific motor encoder.
 
bool getMotorEncoders (double *encs) override
 Gets the values of all motor encoders.
 
bool getMotorEncodersTimed (double *encs, double *time) override
 Gets the values and timestamps of all motor encoders.
 
bool getMotorEncoderTimed (int m, double *encs, double *time) override
 Gets the value and timestamp of a specific motor encoder.
 
bool getMotorEncoderSpeed (int m, double *sp) override
 Gets the speed of a specific motor encoder.
 
bool getMotorEncoderSpeeds (double *spds) override
 Gets the speeds of all motor encoders.
 
bool getMotorEncoderAcceleration (int m, double *acc) override
 Gets the acceleration of a specific motor encoder.
 
bool getMotorEncoderAccelerations (double *accs) override
 Gets the accelerations of all motor encoders.
 
bool getEncodersTimed (double *encs, double *time) override
 Gets the values and timestamps of all encoders.
 
bool getEncoderTimed (int j, double *encs, double *time) override
 Gets the value and timestamp of a specific encoder.
 
bool getAxes (int *ax) override
 Gets the number of axes (encoders).
 
bool resetEncoder (int j) override
 Resets the specified encoder to zero.
 
bool resetEncoders () override
 Resets all encoders to zero.
 
bool setEncoder (int j, double val) override
 Sets the value of a specific encoder.
 
bool setEncoders (const double *vals) override
 Sets the values of all encoders.
 
bool getEncoder (int j, double *v) override
 Gets the value of a specific encoder.
 
bool getEncoders (double *encs) override
 Gets the values of all encoders.
 
bool getEncoderSpeed (int j, double *sp) override
 Gets the speed of a specific encoder.
 
bool getEncoderSpeeds (double *spds) override
 Gets the speeds of all encoders.
 
bool getEncoderAcceleration (int j, double *spds) override
 Gets the acceleration of a specific encoder.
 
bool getEncoderAccelerations (double *accs) override
 Gets the accelerations of all encoders.
 
bool getAxisName (int axis, std::string &name) override
 Gets the name of a specific axis.
 
bool getJointType (int axis, yarp::dev::JointTypeEnum &type) override
 Gets the type of a specific axis.
 
bool getControlMode (int j, int *mode) override
 Gets the control mode of a specific joint.
 
bool getControlModes (int *modes) override
 Gets the control modes of all joints.
 
bool getControlModes (const int n, const int *joints, int *modes) override
 Gets the control modes of a subset of joints.
 
bool setControlMode (const int j, const int mode) override
 Sets the control mode of a specific joint.
 
bool setControlModes (const int n, const int *joints, int *modes) override
 Sets the control modes of a subset of joints.
 
bool setControlModes (int *modes) override
 Sets the control modes of all joints.
 
bool getRefTorques (double *t) override
 Gets the reference torques for all joints.
 
bool getRefTorque (int j, double *t) override
 Gets the reference torque for a specific joint.
 
bool setRefTorques (const double *t) override
 Sets the reference torques for all joints.
 
bool setRefTorques (const int n_joint, const int *joints, const double *t) override
 Sets the reference torques for a subset of joints.
 
bool setRefTorque (int j, double t) override
 Sets the reference torque for a specific joint.
 
bool getTorque (int j, double *t) override
 Gets the measured torque for a specific joint.
 
bool getTorques (double *t) override
 Gets the measured torques for all joints.
 
bool getTorqueRange (int j, double *min, double *max) override
 Gets the torque range for a specific joint.
 
bool getTorqueRanges (double *min, double *max) override
 Gets the torque ranges for all joints.
 
bool velocityMove (int j, double sp) override
 Commands a velocity move for a specific joint.
 
bool velocityMove (const double *sp) override
 Commands velocity moves for all joints.
 
bool getRefVelocity (const int joint, double *vel) override
 Gets the reference velocity for a specific joint.
 
bool getRefVelocities (double *vels) override
 Gets the reference velocities for all joints.
 
bool getRefVelocities (const int n_joint, const int *joints, double *vels) override
 Gets the reference velocity for a subset of joints.
 
bool setRefAcceleration (int j, double acc) override
 (Unused in CSV mode) Sets the reference acceleration for a specific joint.
 
bool setRefAccelerations (const double *accs) override
 (Unused in CSV mode) Sets the reference accelerations for all joints.
 
bool getRefAcceleration (int j, double *acc) override
 (Unused in CSV mode) Gets the reference acceleration for a specific joint.
 
bool getRefAccelerations (double *accs) override
 (Unused in CSV mode) Gets the reference accelerations for all joints.
 
bool stop (int j) override
 Stops motion for a specific joint.
 
bool stop () override
 Stops motion for all joints.
 
bool velocityMove (const int n_joint, const int *joints, const double *spds) override
 Commands velocity moves for a subset of joints.
 
bool setRefAccelerations (const int n_joint, const int *joints, const double *accs) override
 Sets the reference accelerations for a subset of joints.
 
bool getRefAccelerations (const int n_joint, const int *joints, double *accs) override
 Gets the reference accelerations for a subset of joints.
 
bool stop (const int n_joint, const int *joints) override
 Stops motion for a subset of joints.
 
bool getLastJointFault (int j, int &fault, std::string &message) override
 Gets the last joint fault for a specific joint.
 
bool positionMove (int j, double ref) override
 Commands an absolute position move for a specific joint using Profile Position Mode (PP).
 
bool positionMove (const double *refs) override
 Commands absolute position moves for all joints simultaneously.
 
bool positionMove (const int n_joint, const int *joints, const double *refs) override
 Commands absolute position moves for a subset of joints.
 
bool relativeMove (int j, double delta) override
 Commands a relative position move for a specific joint.
 
bool relativeMove (const double *deltas) override
 Commands relative position moves for all joints simultaneously.
 
bool relativeMove (const int n_joint, const int *joints, const double *deltas) override
 Commands relative position moves for a subset of joints.
 
bool checkMotionDone (int j, bool *flag) override
 Checks if a specific joint has completed its motion.
 
bool checkMotionDone (bool *flag) override
 Checks if all joints have completed their motions.
 
bool checkMotionDone (const int n_joint, const int *joints, bool *flag) override
 Checks if specific joints have completed their motions.
 
bool setRefSpeed (int j, double sp) override
 Sets the reference speed (profile velocity) for a specific joint.
 
bool setRefSpeeds (const double *spds) override
 Sets the reference speeds (profile velocities) for all joints.
 
bool setRefSpeeds (const int n_joint, const int *joints, const double *spds) override
 Sets the reference speeds (profile velocities) for specific joints.
 
bool getRefSpeed (int j, double *ref) override
 Gets the current reference speed (profile velocity) for a specific joint.
 
bool getRefSpeeds (double *spds) override
 Gets the current reference speeds (profile velocities) for all joints.
 
bool getRefSpeeds (const int n_joint, const int *joints, double *spds) override
 Gets the current reference speeds (profile velocities) for specific joints.
 
bool getTargetPosition (int j, double *ref) override
 Gets the target position for a specific joint.
 
bool getTargetPositions (double *refs) override
 Gets the target positions for all joints.
 
bool getTargetPositions (const int n_joint, const int *joints, double *refs) override
 Gets the target positions for specific joints.
 
bool setPosition (int j, double ref) override
 Streams a single joint reference in Cyclic Synchronous Position mode.
 
bool setPositions (const int n_joint, const int *joints, const double *refs) override
 Streams references for a subset of joints.
 
bool setPositions (const double *refs) override
 Streams references for every configured joint.
 
bool getRefPosition (const int joint, double *ref) override
 Returns the most recent position-direct command for a joint.
 
bool getRefPositions (double *refs) override
 Returns the position-direct references for all joints.
 
bool getRefPositions (const int n_joint, const int *joints, double *refs) override
 Returns the position-direct references for a subset of joints.
 
bool getCurrent (int m, double *curr) override
 Gets the measured current of a specific motor.
 
bool getCurrents (double *currs) override
 Gets the measured currents of all motors.
 
bool getCurrentRange (int m, double *min, double *max) override
 Gets the allowable current range for a specific motor.
 
bool getCurrentRanges (double *min, double *max) override
 Gets the allowable current ranges for all motors.
 
bool setRefCurrents (const double *currs) override
 Sets the reference currents for all motors.
 
bool setRefCurrent (int m, double curr) override
 Sets the reference current for a specific motor.
 
bool setRefCurrents (const int n_motor, const int *motors, const double *currs) override
 Sets the reference currents for a subset of motors.
 
bool getRefCurrents (double *currs) override
 Gets the last commanded reference currents for all motors.
 
bool getRefCurrent (int m, double *curr) override
 Gets the last commanded reference current for a specific motor.
 
bool getNumberOfMotors (int *num) override
 Gets the number of motors controlled by the device.
 
bool getTemperature (int m, double *val) override
 Gets the temperature of a specific motor.
 
bool getTemperatures (double *vals) override
 Gets the temperatures of all motors.
 
bool getTemperatureLimit (int m, double *temp) override
 Gets the temperature limit of a specific motor.
 
bool setTemperatureLimit (int m, const double temp) override
 Sets the temperature limit of a specific motor.
 
bool getGearboxRatio (int m, double *val) override
 Gets the gearbox ratio of a specific motor.
 
bool setGearboxRatio (int m, const double val) override
 Sets the gearbox ratio of a specific motor.
 
bool setLimits (int axis, double min, double max) override
 Sets the position limits for a specific axis.
 
bool getLimits (int axis, double *min, double *max) override
 Gets the position limits for a specific axis.
 
bool setVelLimits (int axis, double min, double max) override
 Sets the velocity limits for a specific axis.
 
bool getVelLimits (int axis, double *min, double *max) override
 Gets the velocity limits for a specific axis.
 
bool getInteractionMode (int axis, yarp::dev::InteractionModeEnum *mode) override
 Gets the interaction mode of a specific axis.
 
bool getInteractionModes (int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
 Gets the interaction modes of a subset of joints.
 
bool getInteractionModes (yarp::dev::InteractionModeEnum *modes) override
 Gets the interaction modes of all joints.
 
bool setInteractionMode (int axis, yarp::dev::InteractionModeEnum mode) override
 Sets the interaction mode of a specific axis.
 
bool setInteractionModes (int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
 Sets the interaction modes of a subset of joints.
 
bool setInteractionModes (yarp::dev::InteractionModeEnum *modes) override
 Sets the interaction modes of all joints.
 

Detailed Description

Minimal CiA‑402 motion‑control driver based on SOEM.

This class owns the EtherCAT master cycle via yarp::os::PeriodicThread.

Definition at line 36 of file CiA402MotionControl.h.

Constructor & Destructor Documentation

◆ CiA402MotionControl() [1/2]

yarp::dev::CiA402MotionControl::CiA402MotionControl ( double period,
yarp::os::ShouldUseSystemClock useSystemClock = yarp::os::ShouldUseSystemClock::Yes )
explicit

Constructor.

Parameters
periodThe period of the thread in seconds.
useSystemClockWhether to use the system clock for timing.

Definition at line 1753 of file CiA402MotionControl.cpp.

◆ CiA402MotionControl() [2/2]

yarp::dev::CiA402MotionControl::CiA402MotionControl ( )

Default constructor.

This constructor sets the period to 0.01 seconds and uses the system clock.

Definition at line 1759 of file CiA402MotionControl.cpp.

◆ ~CiA402MotionControl()

yarp::dev::CiA402MotionControl::~CiA402MotionControl ( )
overridedefault

Destructor.

Cleans up the resources used by the driver.

Member Function Documentation

◆ checkMotionDone() [1/3]

bool yarp::dev::CiA402MotionControl::checkMotionDone ( bool * flag)
override

Checks if all joints have completed their motions.

This function checks the motion completion status for all configured joints and returns true only when all joints have reached their targets.

Parameters
flagPointer to store the overall motion status (true if all motions complete).
Returns
true if the status check was successful, false on error.
Note
Returns true in flag only when ALL joints report "Target Reached".
Useful for coordinated motion sequences where all axes must complete.
Individual joint errors will cause this function to return false.

Definition at line 4432 of file CiA402MotionControl.cpp.

◆ checkMotionDone() [2/3]

bool yarp::dev::CiA402MotionControl::checkMotionDone ( const int n_joint,
const int * joints,
bool * flag )
override

Checks if specific joints have completed their motions.

This function checks motion completion status for a subset of joints, returning true only when all specified joints have reached their targets.

Parameters
n_jointNumber of joints to check (must be > 0).
jointsArray of joint indices to check (each must be valid joint index).
flagPointer to store the motion status (true if all specified motions complete).
Returns
true if the status check was successful, false on error.
Note
Returns true in flag only when ALL specified joints report "Target Reached".
Non-specified joints are ignored in the completion check.
Joint indices must be valid (0 to num_axes-1).

Definition at line 4449 of file CiA402MotionControl.cpp.

◆ checkMotionDone() [3/3]

bool yarp::dev::CiA402MotionControl::checkMotionDone ( int j,
bool * flag )
override

Checks if a specific joint has completed its motion.

This function queries the CiA-402 Status Word (0x6041) to determine if the joint has reached its target position. The check includes both position tolerance and velocity settling criteria.

Parameters
jIndex of the joint to check (0-based).
flagPointer to store the motion status (true if motion complete, false if still moving).
Returns
true if the status was successfully retrieved, false on error.
Note
Motion is considered complete when the drive reports "Target Reached" status.
This includes both position accuracy and velocity settling requirements.
The function checks the drive's internal motion status, not just position error.

Definition at line 4413 of file CiA402MotionControl.cpp.

◆ close()

bool yarp::dev::CiA402MotionControl::close ( )
override

Closes the device driver.

Returns
true if the driver was closed successfully, false otherwise.

Definition at line 2766 of file CiA402MotionControl.cpp.

◆ getAxes()

bool yarp::dev::CiA402MotionControl::getAxes ( int * ax)
override

Gets the number of axes (encoders).

Parameters
axPointer to store the number of axes.
Returns
true if successful, false otherwise.

Definition at line 3233 of file CiA402MotionControl.cpp.

◆ getAxisName()

bool yarp::dev::CiA402MotionControl::getAxisName ( int j,
std::string & name )
override

Gets the name of a specific axis.

Parameters
axisIndex of the axis.
nameReference to a string to store the axis name.
Returns
true if successful, false otherwise.

--------------— IAxisInfo ---------------—

Definition at line 3377 of file CiA402MotionControl.cpp.

◆ getControlMode()

bool yarp::dev::CiA402MotionControl::getControlMode ( int j,
int * mode )
override

Gets the control mode of a specific joint.

Parameters
jIndex of the joint.
modePointer to store the control mode.
Returns
true if successful, false otherwise.

Definition at line 3405 of file CiA402MotionControl.cpp.

◆ getControlModes() [1/2]

bool yarp::dev::CiA402MotionControl::getControlModes ( const int n,
const int * joints,
int * modes )
override

Gets the control modes of a subset of joints.

Parameters
nNumber of joints.
jointsArray of joint indices.
modesArray to store the control modes.
Returns
true if successful, false otherwise.

Definition at line 3440 of file CiA402MotionControl.cpp.

◆ getControlModes() [2/2]

bool yarp::dev::CiA402MotionControl::getControlModes ( int * modes)
override

Gets the control modes of all joints.

Parameters
modesArray to store the control modes.
Returns
true if successful, false otherwise.

Definition at line 3425 of file CiA402MotionControl.cpp.

◆ getCurrent()

bool yarp::dev::CiA402MotionControl::getCurrent ( int m,
double * curr )
override

Gets the measured current of a specific motor.

Retrieves the instantaneous motor current as reported by the drive (typically q‑axis current or equivalent depending on vendor).

Parameters
mIndex of the motor (0-based).
currPointer to store the measured current (Amperes).
Returns
true if the value was successfully read, false otherwise.
Note
Units are Amperes (A). Sign follows the drive convention.
Value is measured, not the commanded reference.

Definition at line 4867 of file CiA402MotionControl.cpp.

◆ getCurrentRange()

bool yarp::dev::CiA402MotionControl::getCurrentRange ( int m,
double * min,
double * max )
override

Gets the allowable current range for a specific motor.

Returns the minimum and maximum current the drive will accept or report for this motor.

Parameters
mIndex of the motor (0-based).
minPointer to store the minimum allowable current (A).
maxPointer to store the maximum allowable current (A).
Returns
true if the range was successfully read, false otherwise.
Note
Ranges may reflect rated/peak limits configured on the drive.

Definition at line 4896 of file CiA402MotionControl.cpp.

◆ getCurrentRanges()

bool yarp::dev::CiA402MotionControl::getCurrentRanges ( double * min,
double * max )
override

Gets the allowable current ranges for all motors.

Parameters
minArray to store the minimum allowable currents (A).
maxArray to store the maximum allowable currents (A). Arrays must have size equal to the number of motors/axes.
Returns
true if all ranges were successfully read, false otherwise.

Definition at line 4914 of file CiA402MotionControl.cpp.

◆ getCurrents()

bool yarp::dev::CiA402MotionControl::getCurrents ( double * currs)
override

Gets the measured currents of all motors.

Parameters
currsArray to store the measured currents for all motors (A). Size must equal the number of motors/axes.
Returns
true if all values were successfully read, false otherwise.

Definition at line 4884 of file CiA402MotionControl.cpp.

◆ getEncoder()

bool yarp::dev::CiA402MotionControl::getEncoder ( int j,
double * v )
override

Gets the value of a specific encoder.

Parameters
jIndex of the encoder.
vPointer to store the encoder value.
Returns
true if successful, false otherwise.

Definition at line 3268 of file CiA402MotionControl.cpp.

◆ getEncoderAcceleration()

bool yarp::dev::CiA402MotionControl::getEncoderAcceleration ( int j,
double * spds )
override

Gets the acceleration of a specific encoder.

Parameters
jIndex of the encoder.
spdsPointer to store the acceleration value.
Returns
true if successful, false otherwise.

Definition at line 3338 of file CiA402MotionControl.cpp.

◆ getEncoderAccelerations()

bool yarp::dev::CiA402MotionControl::getEncoderAccelerations ( double * accs)
override

Gets the accelerations of all encoders.

Parameters
accsArray to store the acceleration values.
Returns
true if successful, false otherwise.

Definition at line 3357 of file CiA402MotionControl.cpp.

◆ getEncoders()

bool yarp::dev::CiA402MotionControl::getEncoders ( double * encs)
override

Gets the values of all encoders.

Parameters
encsArray to store the encoder values.
Returns
true if successful, false otherwise.

Definition at line 3287 of file CiA402MotionControl.cpp.

◆ getEncoderSpeed()

bool yarp::dev::CiA402MotionControl::getEncoderSpeed ( int j,
double * sp )
override

Gets the speed of a specific encoder.

Parameters
jIndex of the encoder.
spPointer to store the speed value.
Returns
true if successful, false otherwise.

Definition at line 3303 of file CiA402MotionControl.cpp.

◆ getEncoderSpeeds()

bool yarp::dev::CiA402MotionControl::getEncoderSpeeds ( double * spds)
override

Gets the speeds of all encoders.

Parameters
spdsArray to store the speed values.
Returns
true if successful, false otherwise.

Definition at line 3322 of file CiA402MotionControl.cpp.

◆ getEncodersTimed()

bool yarp::dev::CiA402MotionControl::getEncodersTimed ( double * encs,
double * time )
override

Gets the values and timestamps of all encoders.

Parameters
encsArray to store the encoder values.
timeArray to store the timestamps (in seconds).
Returns
true if successful, false otherwise.

Definition at line 3196 of file CiA402MotionControl.cpp.

◆ getEncoderTimed()

bool yarp::dev::CiA402MotionControl::getEncoderTimed ( int j,
double * encs,
double * time )
override

Gets the value and timestamp of a specific encoder.

Parameters
jIndex of the encoder.
encsPointer to store the encoder value.
timePointer to store the timestamp (in seconds).
Returns
true if successful, false otherwise.

Definition at line 3213 of file CiA402MotionControl.cpp.

◆ getGearboxRatio()

bool yarp::dev::CiA402MotionControl::getGearboxRatio ( int m,
double * val )
override

Gets the gearbox ratio of a specific motor.

This function retrieves the gearbox ratio of the specified motor.

Parameters
mIndex of the motor (0-based).
valPointer to store the gearbox ratio value.
Returns
true if the parameter was successfully read, false otherwise.

Definition at line 4844 of file CiA402MotionControl.cpp.

◆ getInteractionMode()

bool yarp::dev::CiA402MotionControl::getInteractionMode ( int axis,
yarp::dev::InteractionModeEnum * mode )
override

Gets the interaction mode of a specific axis.

Parameters
axisIndex of the axis (0-based).
modePointer to store the interaction mode.
Returns
true if the mode was successfully retrieved, false otherwise.
Note
The interaction mode is not implemented in this driver, it always returns stiff.

Definition at line 5161 of file CiA402MotionControl.cpp.

◆ getInteractionModes() [1/2]

bool yarp::dev::CiA402MotionControl::getInteractionModes ( int n_joints,
int * joints,
yarp::dev::InteractionModeEnum * modes )
override

Gets the interaction modes of a subset of joints.

Parameters
n_jointsNumber of joints.
jointsArray of joint indices.
modesArray to store the interaction modes.
Returns
true if the modes were successfully retrieved, false otherwise.

Definition at line 5173 of file CiA402MotionControl.cpp.

◆ getInteractionModes() [2/2]

bool yarp::dev::CiA402MotionControl::getInteractionModes ( yarp::dev::InteractionModeEnum * modes)
override

Gets the interaction modes of all joints.

Parameters
modesArray to store the interaction modes.
Returns
true if the modes were successfully retrieved, false otherwise.

Definition at line 5195 of file CiA402MotionControl.cpp.

◆ getJointType()

bool yarp::dev::CiA402MotionControl::getJointType ( int axis,
yarp::dev::JointTypeEnum & type )
override

Gets the type of a specific axis.

Parameters
axisIndex of the axis.
typeReference to a JointTypeEnum to store the axis type.
Returns
true if successful, false otherwise.
Note
For the time being, this function always returns JointTypeEnum::VOCAB_JOINTTYPE_REVOLUTE.

Definition at line 3392 of file CiA402MotionControl.cpp.

◆ getLastJointFault()

bool yarp::dev::CiA402MotionControl::getLastJointFault ( int j,
int & fault,
std::string & message )
override

Gets the last joint fault for a specific joint.

Parameters
jIndex of the joint.
faultReference to an integer to store the fault code.
messageReference to a string to store the fault message.
Returns
true if successful, false otherwise.

Definition at line 4168 of file CiA402MotionControl.cpp.

◆ getLimits()

bool yarp::dev::CiA402MotionControl::getLimits ( int axis,
double * min,
double * max )
override

Gets the position limits for a specific axis.

This function retrieves the minimum and maximum position limits for the specified axis.

Parameters
axisIndex of the axis (0-based).
minPointer to store the minimum position limit (in joint units, e.g., degrees).
maxPointer to store the maximum position limit (in joint units, e.g., degrees).
Returns
true if the limits were successfully retrieved, false otherwise.

Definition at line 5126 of file CiA402MotionControl.cpp.

◆ getMotorEncoder()

bool yarp::dev::CiA402MotionControl::getMotorEncoder ( int m,
double * v )
override

Gets the value of a specific motor encoder.

Parameters
mIndex of the motor encoder.
vPointer to store the encoder value.
Returns
true if successful, false otherwise.

Definition at line 3054 of file CiA402MotionControl.cpp.

◆ getMotorEncoderAcceleration()

bool yarp::dev::CiA402MotionControl::getMotorEncoderAcceleration ( int m,
double * acc )
override

Gets the acceleration of a specific motor encoder.

Parameters
mIndex of the motor encoder.
accPointer to store the acceleration value.
Returns
true if successful, false otherwise.

Definition at line 3158 of file CiA402MotionControl.cpp.

◆ getMotorEncoderAccelerations()

bool yarp::dev::CiA402MotionControl::getMotorEncoderAccelerations ( double * accs)
override

Gets the accelerations of all motor encoders.

Parameters
accsArray to store the acceleration values.
Returns
true if successful, false otherwise.

Definition at line 3177 of file CiA402MotionControl.cpp.

◆ getMotorEncoderCountsPerRevolution()

bool yarp::dev::CiA402MotionControl::getMotorEncoderCountsPerRevolution ( int m,
double * cpr )
override

Gets the counts per revolution for a specific motor encoder.

Parameters
mIndex of the motor encoder.
cprPointer to store the counts per revolution value.
Returns
true if successful, false otherwise.

Definition at line 3027 of file CiA402MotionControl.cpp.

◆ getMotorEncoders()

bool yarp::dev::CiA402MotionControl::getMotorEncoders ( double * encs)
override

Gets the values of all motor encoders.

Parameters
encsArray to store the encoder values.
Returns
true if successful, false otherwise.

Definition at line 3073 of file CiA402MotionControl.cpp.

◆ getMotorEncoderSpeed()

bool yarp::dev::CiA402MotionControl::getMotorEncoderSpeed ( int m,
double * sp )
override

Gets the speed of a specific motor encoder.

Parameters
mIndex of the motor encoder.
spPointer to store the speed value.
Returns
true if successful, false otherwise.

Definition at line 3123 of file CiA402MotionControl.cpp.

◆ getMotorEncoderSpeeds()

bool yarp::dev::CiA402MotionControl::getMotorEncoderSpeeds ( double * spds)
override

Gets the speeds of all motor encoders.

Parameters
spdsArray to store the speed values.
Returns
true if successful, false otherwise.

Definition at line 3142 of file CiA402MotionControl.cpp.

◆ getMotorEncodersTimed()

bool yarp::dev::CiA402MotionControl::getMotorEncodersTimed ( double * encs,
double * time )
override

Gets the values and timestamps of all motor encoders.

Parameters
encsArray to store the encoder values.
timeArray to store the timestamps.
Returns
true if successful, false otherwise.

Definition at line 3088 of file CiA402MotionControl.cpp.

◆ getMotorEncoderTimed()

bool yarp::dev::CiA402MotionControl::getMotorEncoderTimed ( int m,
double * encs,
double * time )
override

Gets the value and timestamp of a specific motor encoder.

Parameters
mIndex of the motor encoder.
encsPointer to store the encoder value.
timePointer to store the timestamp.
Returns
true if successful, false otherwise.

Definition at line 3103 of file CiA402MotionControl.cpp.

◆ getNumberOfMotorEncoders()

bool yarp::dev::CiA402MotionControl::getNumberOfMotorEncoders ( int * num)
override

Gets the number of motor encoders.

Parameters
numPointer to an integer where the number of encoders will be stored.
Returns
true if successful, false otherwise.

Definition at line 2984 of file CiA402MotionControl.cpp.

◆ getNumberOfMotors()

bool yarp::dev::CiA402MotionControl::getNumberOfMotors ( int * num)
override

Gets the number of motors controlled by the device.

This function retrieves the number of motors that are currently controlled by the device.

Parameters
numPointer to store the number of motors.
Returns
true if the parameter was successfully read, false otherwise.

Definition at line 4786 of file CiA402MotionControl.cpp.

◆ getRefAcceleration()

bool yarp::dev::CiA402MotionControl::getRefAcceleration ( int j,
double * acc )
override

(Unused in CSV mode) Gets the reference acceleration for a specific joint.

Parameters
jIndex of the joint.
accPointer to store the reference acceleration (ignored).
Returns
Always returns false. Not used in Cyclic Synchronous Velocity Mode.

Definition at line 3945 of file CiA402MotionControl.cpp.

◆ getRefAccelerations() [1/2]

bool yarp::dev::CiA402MotionControl::getRefAccelerations ( const int n_joint,
const int * joints,
double * accs )
override

Gets the reference accelerations for a subset of joints.

Parameters
n_jointNumber of joints.
jointsArray of joint indices.
accsArray to store the reference accelerations (ignored).
Note
This function is not used in Cyclic Synchronous Velocity Mode (CSV).
If the driver is switched to Profile Position Mode (PP), this function call a SDO read and get the reference acceleration (0x6083).
Returns
True in case of success, false otherwise.

Definition at line 4127 of file CiA402MotionControl.cpp.

◆ getRefAccelerations() [2/2]

bool yarp::dev::CiA402MotionControl::getRefAccelerations ( double * accs)
override

(Unused in CSV mode) Gets the reference accelerations for all joints.

Parameters
accsArray to store the reference accelerations (ignored).
Returns
Always returns false. Not used in Cyclic Synchronous Velocity Mode.

Definition at line 3976 of file CiA402MotionControl.cpp.

◆ getRefCurrent()

bool yarp::dev::CiA402MotionControl::getRefCurrent ( int m,
double * curr )
override

Gets the last commanded reference current for a specific motor.

Returns the reference previously set with setRefCurrent(s) for the given motor. This is the commanded value, not the measured current.

Parameters
mIndex of the motor (0-based).
currPointer to store the reference current (A).
Returns
true if the value was retrieved, false otherwise.

Definition at line 5054 of file CiA402MotionControl.cpp.

◆ getRefCurrents()

bool yarp::dev::CiA402MotionControl::getRefCurrents ( double * currs)
override

Gets the last commanded reference currents for all motors.

Returns the references previously set with setRefCurrent(s). These are the commanded values, not the measured currents.

Parameters
currsArray to store the reference currents for all motors (A). Size must equal the number of motors/axes.
Returns
true if all values were retrieved, false otherwise.

Definition at line 5041 of file CiA402MotionControl.cpp.

◆ getRefPosition()

bool yarp::dev::CiA402MotionControl::getRefPosition ( const int joint,
double * ref )
override

Returns the most recent position-direct command for a joint.

Mirrors the last value pushed via setPosition* APIs, ignoring commands sent through IPositionControl or other interfaces.

Parameters
jointIndex of the joint.
refPointer to store the last position-direct reference.
Returns
true if a cached value is available, false otherwise.

Definition at line 4721 of file CiA402MotionControl.cpp.

◆ getRefPositions() [1/2]

bool yarp::dev::CiA402MotionControl::getRefPositions ( const int n_joint,
const int * joints,
double * refs )
override

Returns the position-direct references for a subset of joints.

Fills refs with the cached values previously streamed for the provided joint indices.

Parameters
n_jointNumber of joints to query.
jointsArray of joint indices (size = n_joint).
refsArray to store the corresponding cached references.
Returns
true if all requested values were available, false otherwise.

Definition at line 4754 of file CiA402MotionControl.cpp.

◆ getRefPositions() [2/2]

bool yarp::dev::CiA402MotionControl::getRefPositions ( double * refs)
override

Returns the position-direct references for all joints.

Copies the cached values last sent with setPositions(const double*). Values produced by other motion interfaces are intentionally ignored.

Parameters
refsArray to store the last position-direct references for all joints.
Returns
true if all cached values were retrieved, false otherwise.

Definition at line 4739 of file CiA402MotionControl.cpp.

◆ getRefSpeed()

bool yarp::dev::CiA402MotionControl::getRefSpeed ( int j,
double * ref )
override

Gets the current reference speed (profile velocity) for a specific joint.

This function reads the currently configured profile velocity from CiA-402 object 0x6081 via SDO communication.

Parameters
jIndex of the joint (0-based).
refPointer to store the current profile velocity value.
Returns
true if the parameter was successfully read, false otherwise.
Note
This reads the configured maximum velocity for position profiles.
SDO communication may introduce latency for real-time applications.
The returned value reflects the drive's internal configuration.

Definition at line 4527 of file CiA402MotionControl.cpp.

◆ getRefSpeeds() [1/2]

bool yarp::dev::CiA402MotionControl::getRefSpeeds ( const int n_joint,
const int * joints,
double * spds )
override

Gets the current reference speeds (profile velocities) for specific joints.

This function reads the profile velocity configuration for a subset of joints, allowing selective monitoring of profile parameters.

Parameters
n_jointNumber of joints to query (must be > 0).
jointsArray of joint indices to query (each must be valid joint index).
spdsArray to store the profile velocities corresponding to the specified joints.
Returns
true if all parameters were successfully read, false otherwise.
Note
joints and spds arrays must have the same size (n_joint elements).
SDO reads are performed only for specified joints.
Joint indices must be valid (0 to num_axes-1).
Values reflect the drives' current profile velocity settings.

Definition at line 4551 of file CiA402MotionControl.cpp.

◆ getRefSpeeds() [2/2]

bool yarp::dev::CiA402MotionControl::getRefSpeeds ( double * spds)
override

Gets the current reference speeds (profile velocities) for all joints.

This function reads the configured profile velocities from all joints by querying each joint's 0x6081 object via SDO communication.

Parameters
spdsArray to store the profile velocities for all joints (size must equal number of axes).
Returns
true if all parameters were successfully read, false otherwise.
Note
Array size must match the number of configured axes.
All SDO reads are performed sequentially, which may take time.
If any single joint read fails, the entire operation may fail.
Values reflect the drives' current internal configuration.

Definition at line 4539 of file CiA402MotionControl.cpp.

◆ getRefTorque()

bool yarp::dev::CiA402MotionControl::getRefTorque ( int j,
double * t )
override

Gets the reference torque for a specific joint.

Parameters
jIndex of the joint.
tPointer to store the reference torque.
Returns
true if successful, false otherwise.

Definition at line 3578 of file CiA402MotionControl.cpp.

◆ getRefTorques()

bool yarp::dev::CiA402MotionControl::getRefTorques ( double * t)
override

Gets the reference torques for all joints.

Parameters
tArray to store the reference torques.
Returns
true if successful, false otherwise.

Definition at line 3597 of file CiA402MotionControl.cpp.

◆ getRefVelocities() [1/2]

bool yarp::dev::CiA402MotionControl::getRefVelocities ( const int n_joint,
const int * joints,
double * vels )
override

Gets the reference velocity for a subset of joints.

Parameters
n_jointNumber of joints.
jointsArray of joint indices.
velsArray to store the reference velocities.
Returns
true if successful, false otherwise.

Definition at line 3842 of file CiA402MotionControl.cpp.

◆ getRefVelocities() [2/2]

bool yarp::dev::CiA402MotionControl::getRefVelocities ( double * vels)
override

Gets the reference velocities for all joints.

Parameters
velsArray to store the reference velocities.
Returns
true if successful, false otherwise.

Definition at line 3826 of file CiA402MotionControl.cpp.

◆ getRefVelocity()

bool yarp::dev::CiA402MotionControl::getRefVelocity ( const int joint,
double * vel )
override

Gets the reference velocity for a specific joint.

Parameters
jointIndex of the joint.
velPointer to store the reference velocity.
Returns
true if successful, false otherwise.

Definition at line 3807 of file CiA402MotionControl.cpp.

◆ getTargetPosition()

bool yarp::dev::CiA402MotionControl::getTargetPosition ( int j,
double * ref )
override

Gets the target position for a specific joint.

This function reads the target position that was last commanded to the specified joint. The value reflects the last positionMove() or relativeMove() command issued.

Parameters
jIndex of the joint (0-based).
refPointer to store the target position value.
Returns
true if the parameter was successfully read, false otherwise.
Note
The target position is in joint coordinates (degrees or radians).
If no position command has been issued, the value may be undefined.
This function does not read the actual current position.

Definition at line 4566 of file CiA402MotionControl.cpp.

◆ getTargetPositions() [1/2]

bool yarp::dev::CiA402MotionControl::getTargetPositions ( const int n_joint,
const int * joints,
double * refs )
override

Gets the target positions for specific joints.

This function reads the target positions that were last commanded to a subset of joints. The values reflect the last positionMove() or relativeMove() commands issued for those joints.

Parameters
n_jointNumber of joints to query (must be > 0).
jointsArray of joint indices to query (each must be valid joint index).
refsArray to store the target positions corresponding to the specified joints.
Returns
true if all parameters were successfully read, false otherwise.
Note
joints and refs arrays must have the same size (n_joint elements).
Target positions are in joint coordinates (degrees or radians).
If no position commands have been issued for a joint, its value may be undefined.
This function does not read the actual current positions.

Definition at line 4592 of file CiA402MotionControl.cpp.

◆ getTargetPositions() [2/2]

bool yarp::dev::CiA402MotionControl::getTargetPositions ( double * refs)
override

Gets the target positions for all joints.

This function reads the target positions that were last commanded to all joints. The values reflect the last positionMove() or relativeMove() commands issued.

Parameters
refsArray to store the target positions for all joints (size must equal number of axes).
Returns
true if all parameters were successfully read, false otherwise.
Note
Target positions are in joint coordinates (degrees or radians).
If no position commands have been issued, values may be undefined.
This function does not read the actual current positions.

Definition at line 4579 of file CiA402MotionControl.cpp.

◆ getTemperature()

bool yarp::dev::CiA402MotionControl::getTemperature ( int m,
double * val )
override

Gets the temperature of a specific motor.

This function retrieves the current temperature of the specified motor.

Parameters
mIndex of the motor (0-based).
valPointer to store the temperature value.
Returns
true if the parameter was successfully read, false otherwise.

Definition at line 4797 of file CiA402MotionControl.cpp.

◆ getTemperatureLimit()

bool yarp::dev::CiA402MotionControl::getTemperatureLimit ( int m,
double * temp )
override

Gets the temperature limit of a specific motor.

This function retrieves the temperature limit of the specified motor.

Parameters
mIndex of the motor (0-based).
tempPointer to store the temperature limit value.
Returns
true if the parameter was successfully read, false otherwise.
Note
This function is not implemented so it always returns false.

Definition at line 4826 of file CiA402MotionControl.cpp.

◆ getTemperatures()

bool yarp::dev::CiA402MotionControl::getTemperatures ( double * vals)
override

Gets the temperatures of all motors.

This function retrieves the current temperatures of all motors.

Parameters
valsArray to store the temperature values (size must equal number of motors).
Returns
true if all parameters were successfully read, false otherwise.

Definition at line 4814 of file CiA402MotionControl.cpp.

◆ getTorque()

bool yarp::dev::CiA402MotionControl::getTorque ( int j,
double * t )
override

Gets the measured torque for a specific joint.

Parameters
jIndex of the joint.
tPointer to store the measured torque.
Returns
true if successful, false otherwise.

Definition at line 3544 of file CiA402MotionControl.cpp.

◆ getTorqueRange()

bool yarp::dev::CiA402MotionControl::getTorqueRange ( int j,
double * min,
double * max )
override

Gets the torque range for a specific joint.

Parameters
jIndex of the joint.
minPointer to store the minimum torque.
maxPointer to store the maximum torque.
Returns
true if successful, false otherwise.

Definition at line 3711 of file CiA402MotionControl.cpp.

◆ getTorqueRanges()

bool yarp::dev::CiA402MotionControl::getTorqueRanges ( double * min,
double * max )
override

Gets the torque ranges for all joints.

Parameters
minArray to store the minimum torques.
maxArray to store the maximum torques.
Returns
true if successful, false otherwise.

Definition at line 3731 of file CiA402MotionControl.cpp.

◆ getTorques()

bool yarp::dev::CiA402MotionControl::getTorques ( double * t)
override

Gets the measured torques for all joints.

Parameters
tArray to store the measured torques.
Returns
true if successful, false otherwise.

Definition at line 3563 of file CiA402MotionControl.cpp.

◆ getVelLimits()

bool yarp::dev::CiA402MotionControl::getVelLimits ( int axis,
double * min,
double * max )
override

Gets the velocity limits for a specific axis.

This function retrieves the minimum and maximum velocity limits for the specified axis.

Parameters
axisIndex of the axis (0-based).
minPointer to store the minimum velocity limit (in joint units per second, e.g., degrees/s).
maxPointer to store the maximum velocity limit (in joint units per second, e.g., degrees/s).
Returns
true if the limits were successfully retrieved, false otherwise.
Note
The velocity limits is not implemented in this driver, so it always returns false.

Definition at line 5153 of file CiA402MotionControl.cpp.

◆ open()

bool yarp::dev::CiA402MotionControl::open ( yarp::os::Searchable & config)
override

Opens the device driver.

Parameters
configThe configuration parameters for the driver.
Note
The configuration parameters should include:
Parameter Name Type Description Is Mandatory?
ifname string Name of the network interface to use Yes
num_axes int Number of axes to control Yes
first_slave int Index of the slave to start from (default: 1) No
expected_slave_name string Expected name of the slave No
Returns
true if the driver was opened successfully, false otherwise.

Definition at line 1771 of file CiA402MotionControl.cpp.

◆ positionMove() [1/3]

bool yarp::dev::CiA402MotionControl::positionMove ( const double * refs)
override

Commands absolute position moves for all joints simultaneously.

This function initiates coordinated trapezoidal position trajectories for all joints. Each joint moves from its current position to the corresponding target position in the refs array using individual profile parameters.

Parameters
refsArray of target positions for all joints (size must equal number of axes).
Returns
true if all commands were successfully sent, false otherwise.
Note
Joints move simultaneously but independently - no trajectory synchronization.
Array size must match the number of configured axes.
Use checkMotionDone() to verify when all motions are complete.

Definition at line 4273 of file CiA402MotionControl.cpp.

◆ positionMove() [2/3]

bool yarp::dev::CiA402MotionControl::positionMove ( const int n_joint,
const int * joints,
const double * refs )
override

Commands absolute position moves for a subset of joints.

This function allows selective position control of specific joints while leaving others unaffected. Each specified joint moves to its target position using Profile Position Mode.

Parameters
n_jointNumber of joints to move (must be > 0).
jointsArray of joint indices to move (each must be valid joint index).
refsArray of target positions corresponding to the specified joints.
Returns
true if all commands were successfully sent, false otherwise.
Note
joints and refs arrays must have the same size (n_joint elements).
Non-specified joints remain in their current control state.
Joint indices must be valid (0 to num_axes-1).

Definition at line 4307 of file CiA402MotionControl.cpp.

◆ positionMove() [3/3]

bool yarp::dev::CiA402MotionControl::positionMove ( int j,
double ref )
override

Commands an absolute position move for a specific joint using Profile Position Mode (PP).

This function initiates a trapezoidal position trajectory from the current position to the specified target position. The motion profile is governed by the configured profile velocity (0x6081) and profile acceleration (0x6083).

Parameters
jIndex of the joint to move (0-based).
refTarget position in joint coordinates (degrees or radians, depending on configuration).
Returns
true if the command was successfully sent, false otherwise.
Note
This function uses CiA-402 Profile Position Mode. The actual motion execution depends on the drive's state machine being in "Operation Enabled" state.
The motion is non-blocking. Use checkMotionDone() to verify completion.
Position units depend on the encoder configuration and gear ratios.

Definition at line 4241 of file CiA402MotionControl.cpp.

◆ relativeMove() [1/3]

bool yarp::dev::CiA402MotionControl::relativeMove ( const double * deltas)
override

Commands relative position moves for all joints simultaneously.

This function moves all joints by their respective delta amounts from their current positions. Each joint's target is calculated as current_position + delta.

Parameters
deltasArray of relative displacements for all joints (size must equal number of axes).
Returns
true if all commands were successfully sent, false otherwise.
Note
Current positions are sampled at command time for target calculation.
All joints move simultaneously but independently.
Zero delta values result in no motion for those joints.

Definition at line 4367 of file CiA402MotionControl.cpp.

◆ relativeMove() [2/3]

bool yarp::dev::CiA402MotionControl::relativeMove ( const int n_joint,
const int * joints,
const double * deltas )
override

Commands relative position moves for a subset of joints.

This function moves specific joints by their respective delta amounts while leaving other joints unaffected. Targets are calculated from current positions.

Parameters
n_jointNumber of joints to move (must be > 0).
jointsArray of joint indices to move (each must be valid joint index).
deltasArray of relative displacements corresponding to the specified joints.
Returns
true if all commands were successfully sent, false otherwise.
Note
joints and deltas arrays must have the same size (n_joint elements).
Current positions are read for target calculation at command time.
Non-specified joints are not affected by this command.

Definition at line 4389 of file CiA402MotionControl.cpp.

◆ relativeMove() [3/3]

bool yarp::dev::CiA402MotionControl::relativeMove ( int j,
double delta )
override

Commands a relative position move for a specific joint.

This function moves the joint by the specified delta amount from its current position. The motion uses Profile Position Mode with a calculated target position = current_position + delta.

Parameters
jIndex of the joint to move (0-based).
deltaRelative displacement in joint coordinates (degrees or radians).
Returns
true if the command was successfully sent, false otherwise.
Note
The current position is read at command time to calculate the absolute target.
Positive delta values move in the positive joint direction.
Motion profile follows the same trapezoidal trajectory as absolute moves.

Definition at line 4343 of file CiA402MotionControl.cpp.

◆ resetEncoder()

bool yarp::dev::CiA402MotionControl::resetEncoder ( int j)
override

Resets the specified encoder to zero.

Parameters
jIndex of the encoder to reset.
Returns
true if successful, false otherwise.

Definition at line 3244 of file CiA402MotionControl.cpp.

◆ resetEncoders()

bool yarp::dev::CiA402MotionControl::resetEncoders ( )
override

Resets all encoders to zero.

Returns
true if successful, false otherwise.

Definition at line 3250 of file CiA402MotionControl.cpp.

◆ resetMotorEncoder()

bool yarp::dev::CiA402MotionControl::resetMotorEncoder ( int m)
override

Resets the specified motor encoder to zero.

Parameters
mIndex of the motor encoder to reset.
Returns
true if successful, false otherwise.

Definition at line 2995 of file CiA402MotionControl.cpp.

◆ resetMotorEncoders()

bool yarp::dev::CiA402MotionControl::resetMotorEncoders ( )
override

Resets all motor encoders to zero.

Returns
true if successful, false otherwise.

Definition at line 3001 of file CiA402MotionControl.cpp.

◆ run()

void yarp::dev::CiA402MotionControl::run ( )
override

Runs the periodic thread.

This function is called periodically at the specified interval.

Control loop phases: 1) Apply user‑requested control modes (CiA‑402 power state machine) 2) Push user setpoints to PDOs (units and shaft conversions handled) 3) Cyclic exchange over EtherCAT (outputs sent / inputs read) 4) Read back feedback (encoders, torque, safety, timestamp) 5) Diagnostics and bookkeeping (active mode tracking, latching, inhibit)

Definition at line 2784 of file CiA402MotionControl.cpp.

◆ setControlMode()

bool yarp::dev::CiA402MotionControl::setControlMode ( const int j,
const int mode )
override

Sets the control mode of a specific joint.

Parameters
jIndex of the joint.
modeControl mode to set.
Returns
true if successful, false otherwise.

Definition at line 3468 of file CiA402MotionControl.cpp.

◆ setControlModes() [1/2]

bool yarp::dev::CiA402MotionControl::setControlModes ( const int n,
const int * joints,
int * modes )
override

Sets the control modes of a subset of joints.

Parameters
nNumber of joints.
jointsArray of joint indices.
modesArray of control modes to set.
Returns
true if successful, false otherwise.

Definition at line 3491 of file CiA402MotionControl.cpp.

◆ setControlModes() [2/2]

bool yarp::dev::CiA402MotionControl::setControlModes ( int * modes)
override

Sets the control modes of all joints.

Parameters
modesArray of control modes to set.
Returns
true if successful, false otherwise.

Definition at line 3521 of file CiA402MotionControl.cpp.

◆ setEncoder()

bool yarp::dev::CiA402MotionControl::setEncoder ( int j,
double val )
override

Sets the value of a specific encoder.

Parameters
jIndex of the encoder.
valValue to set.
Returns
true if successful, false otherwise.

Definition at line 3256 of file CiA402MotionControl.cpp.

◆ setEncoders()

bool yarp::dev::CiA402MotionControl::setEncoders ( const double * vals)
override

Sets the values of all encoders.

Parameters
valsArray of values to set for each encoder.
Returns
true if successful, false otherwise.

Definition at line 3262 of file CiA402MotionControl.cpp.

◆ setGearboxRatio()

bool yarp::dev::CiA402MotionControl::setGearboxRatio ( int m,
const double val )
override

Sets the gearbox ratio of a specific motor.

This function sets the gearbox ratio of the specified motor.

Parameters
mIndex of the motor (0-based).
valGearbox ratio value to set.
Returns
true if the parameter was successfully set, false otherwise.
Note
This function is not implemented so it always returns false.

Definition at line 4860 of file CiA402MotionControl.cpp.

◆ setInteractionMode()

bool yarp::dev::CiA402MotionControl::setInteractionMode ( int axis,
yarp::dev::InteractionModeEnum mode )
override

Sets the interaction mode of a specific axis.

Parameters
axisIndex of the axis (0-based).
modeInteraction mode to set.
Returns
true if the mode was successfully set, false otherwise.
Note
The interaction mode is not implemented in this driver, so it always returns false.

Definition at line 5210 of file CiA402MotionControl.cpp.

◆ setInteractionModes() [1/2]

bool yarp::dev::CiA402MotionControl::setInteractionModes ( int n_joints,
int * joints,
yarp::dev::InteractionModeEnum * modes )
override

Sets the interaction modes of a subset of joints.

Parameters
n_jointsNumber of joints.
jointsArray of joint indices.
modesArray of interaction modes to set.
Returns
true if the modes were successfully set, false otherwise.
Note
The interaction mode is not implemented in this driver, so it always returns false.

Definition at line 5225 of file CiA402MotionControl.cpp.

◆ setInteractionModes() [2/2]

bool yarp::dev::CiA402MotionControl::setInteractionModes ( yarp::dev::InteractionModeEnum * modes)
override

Sets the interaction modes of all joints.

Parameters
modesArray of interaction modes to set.
Returns
true if the modes were successfully set, false otherwise.
Note
The interaction mode is not implemented in this driver, so it always returns false.

Definition at line 5251 of file CiA402MotionControl.cpp.

◆ setLimits()

bool yarp::dev::CiA402MotionControl::setLimits ( int axis,
double min,
double max )
override

Sets the position limits for a specific axis.

This function sets the minimum and maximum position limits for the specified axis. The limits are enforced by the device to prevent motion beyond the defined range.

Parameters
axisIndex of the axis (0-based).
minMinimum position limit (in joint units, e.g., degrees).
maxMaximum position limit (in joint units, e.g., degrees).
Returns
true if the limits were successfully set, false otherwise.

Definition at line 5072 of file CiA402MotionControl.cpp.

◆ setMotorEncoder()

bool yarp::dev::CiA402MotionControl::setMotorEncoder ( int m,
const double val )
override

Sets the value of a specific motor encoder.

Parameters
mIndex of the motor encoder.
valValue to set.
Returns
true if successful, false otherwise.

Definition at line 3015 of file CiA402MotionControl.cpp.

◆ setMotorEncoderCountsPerRevolution()

bool yarp::dev::CiA402MotionControl::setMotorEncoderCountsPerRevolution ( int m,
const double cpr )
override

Sets the counts per revolution for a specific motor encoder.

Parameters
mIndex of the motor encoder.
cprCounts per revolution value to set.
Returns
true if successful, false otherwise.

Definition at line 3007 of file CiA402MotionControl.cpp.

◆ setMotorEncoders()

bool yarp::dev::CiA402MotionControl::setMotorEncoders ( const double * vals)
override

Sets the values of all motor encoders.

Parameters
valsArray of values to set for each encoder.
Returns
true if successful, false otherwise.

Definition at line 3021 of file CiA402MotionControl.cpp.

◆ setPosition()

bool yarp::dev::CiA402MotionControl::setPosition ( int j,
double ref )
override

Streams a single joint reference in Cyclic Synchronous Position mode.

Sends an immediate target position for the selected joint using the IPositionDirect interface. The reference is expressed in joint units and is consumed on the next PDO cycle while the joint is in VOCAB_CM_POSITION_DIRECT.

Parameters
jIndex of the joint to command (0-based).
refAbsolute position target in joint coordinates.
Returns
true if the reference was accepted, false otherwise.

Definition at line 4609 of file CiA402MotionControl.cpp.

◆ setPositions() [1/2]

bool yarp::dev::CiA402MotionControl::setPositions ( const double * refs)
override

Streams references for every configured joint.

Writes a full vector of position targets that will be consumed in the next PDO exchange. All joints must already be in position-direct control mode.

Parameters
refsArray of absolute position targets for all joints.
Returns
true if the reference vector was queued, false otherwise.

Definition at line 4636 of file CiA402MotionControl.cpp.

◆ setPositions() [2/2]

bool yarp::dev::CiA402MotionControl::setPositions ( const int n_joint,
const int * joints,
const double * refs )
override

Streams references for a subset of joints.

Allows updating multiple joints at once while leaving others untouched. Each joint listed in joints receives the corresponding value in refs during the next EtherCAT cycle.

Parameters
n_jointNumber of joints to update.
jointsArray of joint indices to command (size = n_joint).
refsArray of absolute position targets (size = n_joint).
Returns
true if all references were queued, false otherwise.

Definition at line 4670 of file CiA402MotionControl.cpp.

◆ setRefAcceleration()

bool yarp::dev::CiA402MotionControl::setRefAcceleration ( int j,
double acc )
override

(Unused in CSV mode) Sets the reference acceleration for a specific joint.

Parameters
jIndex of the joint.
accReference acceleration (ignored).
Returns
Always returns false. Not used in Cyclic Synchronous Velocity Mode.

Definition at line 3874 of file CiA402MotionControl.cpp.

◆ setRefAccelerations() [1/2]

bool yarp::dev::CiA402MotionControl::setRefAccelerations ( const double * accs)
override

(Unused in CSV mode) Sets the reference accelerations for all joints.

Parameters
accsArray of reference accelerations (ignored).
Returns
Always returns false. Not used in Cyclic Synchronous Velocity Mode.

Definition at line 3930 of file CiA402MotionControl.cpp.

◆ setRefAccelerations() [2/2]

bool yarp::dev::CiA402MotionControl::setRefAccelerations ( const int n_joint,
const int * joints,
const double * accs )
override

Sets the reference accelerations for a subset of joints.

Parameters
n_jointNumber of joints.
jointsArray of joint indices.
accsArray of reference accelerations (ignored).
Note
This function is not used in Cyclic Synchronous Velocity Mode (CSV).
If the driver is switched to Profile Position Mode (PP), this function call a SDO write and set the reference acceleration (0x6083).
Returns
True in case of success, false otherwise.

Definition at line 4108 of file CiA402MotionControl.cpp.

◆ setRefCurrent()

bool yarp::dev::CiA402MotionControl::setRefCurrent ( int m,
double curr )
override

Sets the reference current for a specific motor.

Parameters
mIndex of the motor (0-based).
currReference current to command (A).
Returns
true if the reference was successfully applied, false otherwise.
Note
The command may be clamped to the motor's allowable current range.
Effective only when the configured mode accepts current commands.

Definition at line 4961 of file CiA402MotionControl.cpp.

◆ setRefCurrents() [1/2]

bool yarp::dev::CiA402MotionControl::setRefCurrents ( const double * currs)
override

Sets the reference currents for all motors.

Commands current references for all motors in one call. Values outside the allowable range may be saturated by the driver or rejected by the drive.

Parameters
currsArray of reference currents for all motors (A). Size must equal the number of motors/axes.
Returns
true if all references were successfully applied, false otherwise.
Note
Effective only when the underlying operation mode accepts current commands (e.g., current/torque-related modes as configured).

Definition at line 4930 of file CiA402MotionControl.cpp.

◆ setRefCurrents() [2/2]

bool yarp::dev::CiA402MotionControl::setRefCurrents ( const int n_motor,
const int * motors,
const double * currs )
override

Sets the reference currents for a subset of motors.

Allows updating a selected set of motors while leaving others unchanged.

Parameters
n_motorNumber of motors to command (must be > 0).
motorsArray of motor indices to command (each must be valid index).
currsArray of reference currents (A) corresponding to the specified motors.
Returns
true if all references were successfully applied, false otherwise.
Note
motors and currs must have n_motor elements.
Values may be clamped to each motor's allowable range.

Definition at line 4989 of file CiA402MotionControl.cpp.

◆ setRefSpeed()

bool yarp::dev::CiA402MotionControl::setRefSpeed ( int j,
double sp )
override

Sets the reference speed (profile velocity) for a specific joint.

This function configures the maximum velocity used during position moves by writing to CiA-402 object 0x6081 (Profile Velocity) via SDO communication. This speed affects all subsequent position moves for the joint.

Parameters
jIndex of the joint (0-based).
spProfile velocity in joint coordinates per second (deg/s or rad/s).
Returns
true if the parameter was successfully written, false otherwise.
Note
This sets the maximum velocity for trapezoidal motion profiles.
The actual motion speed may be lower due to acceleration limits.
Changes take effect for subsequent position commands, not current motions.
SDO communication may introduce latency compared to PDO-based commands.

Definition at line 4464 of file CiA402MotionControl.cpp.

◆ setRefSpeeds() [1/2]

bool yarp::dev::CiA402MotionControl::setRefSpeeds ( const double * spds)
override

Sets the reference speeds (profile velocities) for all joints.

This function configures the profile velocities for all joints simultaneously by writing to each joint's 0x6081 object via SDO communication.

Parameters
spdsArray of profile velocities for all joints (size must equal number of axes).
Returns
true if all parameters were successfully written, false otherwise.
Note
Array size must match the number of configured axes.
All SDO writes are performed sequentially, which may take time.
Settings apply to subsequent position moves, not current motions.
If any single joint fails, the entire operation may be marked as failed.

Definition at line 4498 of file CiA402MotionControl.cpp.

◆ setRefSpeeds() [2/2]

bool yarp::dev::CiA402MotionControl::setRefSpeeds ( const int n_joint,
const int * joints,
const double * spds )
override

Sets the reference speeds (profile velocities) for specific joints.

This function allows selective configuration of profile velocities for a subset of joints while leaving others unchanged.

Parameters
n_jointNumber of joints to configure (must be > 0).
jointsArray of joint indices to configure (each must be valid joint index).
spdsArray of profile velocities corresponding to the specified joints.
Returns
true if all parameters were successfully written, false otherwise.
Note
joints and spds arrays must have the same size (n_joint elements).
SDO writes are performed only for specified joints.
Non-specified joints retain their current profile velocity settings.
Joint indices must be valid (0 to num_axes-1).

Definition at line 4512 of file CiA402MotionControl.cpp.

◆ setRefTorque()

bool yarp::dev::CiA402MotionControl::setRefTorque ( int j,
double t )
override

Sets the reference torque for a specific joint.

Parameters
jIndex of the joint.
tReference torque to set.
Returns
true if successful, false otherwise.

Definition at line 3611 of file CiA402MotionControl.cpp.

◆ setRefTorques() [1/2]

bool yarp::dev::CiA402MotionControl::setRefTorques ( const double * t)
override

Sets the reference torques for all joints.

Parameters
tArray of reference torques to set.
Returns
true if successful, false otherwise.

Definition at line 3638 of file CiA402MotionControl.cpp.

◆ setRefTorques() [2/2]

bool yarp::dev::CiA402MotionControl::setRefTorques ( const int n_joint,
const int * joints,
const double * t )
override

Sets the reference torques for a subset of joints.

Parameters
n_jointNumber of joints.
jointsArray of joint indices.
tArray of reference torques to set.
Returns
true if successful, false otherwise.

Definition at line 3668 of file CiA402MotionControl.cpp.

◆ setTemperatureLimit()

bool yarp::dev::CiA402MotionControl::setTemperatureLimit ( int m,
const double temp )
override

Sets the temperature limit of a specific motor.

This function sets the temperature limit of the specified motor.

Parameters
mIndex of the motor (0-based).
tempTemperature limit value to set.
Returns
true if the parameter was successfully set, false otherwise.
Note
This function is not implemented so it always returns false.

Definition at line 4835 of file CiA402MotionControl.cpp.

◆ setVelLimits()

bool yarp::dev::CiA402MotionControl::setVelLimits ( int axis,
double min,
double max )
override

Sets the velocity limits for a specific axis.

This function sets the minimum and maximum velocity limits for the specified axis. The limits are enforced by the device to prevent motion beyond the defined range.

Parameters
axisIndex of the axis (0-based).
minMinimum velocity limit (in joint units per second, e.g., degrees/s).
maxMaximum velocity limit (in joint units per second, e.g., degrees/s).
Returns
true if the limits were successfully set, false otherwise.
Note
The velocity limits is not implemented in this driver, so it always returns false.

Definition at line 5145 of file CiA402MotionControl.cpp.

◆ stop() [1/3]

bool yarp::dev::CiA402MotionControl::stop ( )
override

Stops motion for all joints.

Returns
true if successful, false otherwise.
Note
In CSV mode, this typically sets all velocity setpoints to zero.

Definition at line 4039 of file CiA402MotionControl.cpp.

◆ stop() [2/3]

bool yarp::dev::CiA402MotionControl::stop ( const int n_joint,
const int * joints )
override

Stops motion for a subset of joints.

Parameters
n_jointNumber of joints.
jointsArray of joint indices.
Returns
true if successful, false otherwise.
Note
In CSV mode, this typically sets the velocity setpoints to zero for the specified joints.
If the driver is switched to Profile Position Mode (PP), this function call a SDO write and set the "Halt Position" command (0x6040, 0x0006) for each specified joint.

Definition at line 4139 of file CiA402MotionControl.cpp.

◆ stop() [3/3]

bool yarp::dev::CiA402MotionControl::stop ( int j)
override

Stops motion for a specific joint.

Parameters
jIndex of the joint.
Returns
true if successful, false otherwise.
Note
In CSV mode, this typically sets the velocity setpoint to zero for the specified joint.

Definition at line 4009 of file CiA402MotionControl.cpp.

◆ velocityMove() [1/3]

bool yarp::dev::CiA402MotionControl::velocityMove ( const double * sp)
override

Commands velocity moves for all joints.

Parameters
spArray of desired velocity setpoints for each joint.
Returns
true if successful, false otherwise.
Note
This interface implements Cyclic Synchronous Velocity Mode (CSV), so the command is sent cyclically.

Definition at line 3776 of file CiA402MotionControl.cpp.

◆ velocityMove() [2/3]

bool yarp::dev::CiA402MotionControl::velocityMove ( const int n_joint,
const int * joints,
const double * spds )
override

Commands velocity moves for a subset of joints.

Parameters
n_jointNumber of joints.
jointsArray of joint indices.
spdsArray of desired velocity setpoints for the specified joints.
Returns
true if successful, false otherwise.
Note
This interface implements Cyclic Synchronous Velocity Mode (CSV), so the command is sent cyclically.

Definition at line 4063 of file CiA402MotionControl.cpp.

◆ velocityMove() [3/3]

bool yarp::dev::CiA402MotionControl::velocityMove ( int j,
double sp )
override

Commands a velocity move for a specific joint.

Parameters
jIndex of the joint.
spDesired velocity setpoint (units: deg/s or rad/s, depending on configuration).
Returns
true if successful, false otherwise.
Note
This interface implements Cyclic Synchronous Velocity Mode (CSV), so the command is sent cyclically.

Definition at line 3747 of file CiA402MotionControl.cpp.


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