|
YARP CiA-402 EtherCAT Device 0.6.0
YARP device plugin for EtherCAT CiA-402 drives
|
Minimal CiA‑402 motion‑control driver based on SOEM. More...
#include <CiA402MotionControl.h>
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. | |
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.
|
explicit |
Constructor.
| period | The period of the thread in seconds. |
| useSystemClock | Whether to use the system clock for timing. |
Definition at line 1753 of file CiA402MotionControl.cpp.
| 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.
|
overridedefault |
Destructor.
Cleans up the resources used by the driver.
|
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.
| flag | Pointer to store the overall motion status (true if all motions complete). |
Definition at line 4432 of file CiA402MotionControl.cpp.
|
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.
| n_joint | Number of joints to check (must be > 0). |
| joints | Array of joint indices to check (each must be valid joint index). |
| flag | Pointer to store the motion status (true if all specified motions complete). |
Definition at line 4449 of file CiA402MotionControl.cpp.
|
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.
| j | Index of the joint to check (0-based). |
| flag | Pointer to store the motion status (true if motion complete, false if still moving). |
Definition at line 4413 of file CiA402MotionControl.cpp.
|
override |
Closes the device driver.
Definition at line 2766 of file CiA402MotionControl.cpp.
|
override |
Gets the number of axes (encoders).
| ax | Pointer to store the number of axes. |
Definition at line 3233 of file CiA402MotionControl.cpp.
|
override |
Gets the name of a specific axis.
| axis | Index of the axis. |
| name | Reference to a string to store the axis name. |
Definition at line 3377 of file CiA402MotionControl.cpp.
|
override |
Gets the control mode of a specific joint.
| j | Index of the joint. |
| mode | Pointer to store the control mode. |
Definition at line 3405 of file CiA402MotionControl.cpp.
|
override |
Gets the control modes of a subset of joints.
| n | Number of joints. |
| joints | Array of joint indices. |
| modes | Array to store the control modes. |
Definition at line 3440 of file CiA402MotionControl.cpp.
|
override |
Gets the control modes of all joints.
| modes | Array to store the control modes. |
Definition at line 3425 of file CiA402MotionControl.cpp.
|
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).
| m | Index of the motor (0-based). |
| curr | Pointer to store the measured current (Amperes). |
Definition at line 4867 of file CiA402MotionControl.cpp.
|
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.
| m | Index of the motor (0-based). |
| min | Pointer to store the minimum allowable current (A). |
| max | Pointer to store the maximum allowable current (A). |
Definition at line 4896 of file CiA402MotionControl.cpp.
|
override |
Gets the allowable current ranges for all motors.
| min | Array to store the minimum allowable currents (A). |
| max | Array to store the maximum allowable currents (A). Arrays must have size equal to the number of motors/axes. |
Definition at line 4914 of file CiA402MotionControl.cpp.
|
override |
Gets the measured currents of all motors.
| currs | Array to store the measured currents for all motors (A). Size must equal the number of motors/axes. |
Definition at line 4884 of file CiA402MotionControl.cpp.
|
override |
Gets the value of a specific encoder.
| j | Index of the encoder. |
| v | Pointer to store the encoder value. |
Definition at line 3268 of file CiA402MotionControl.cpp.
|
override |
Gets the acceleration of a specific encoder.
| j | Index of the encoder. |
| spds | Pointer to store the acceleration value. |
Definition at line 3338 of file CiA402MotionControl.cpp.
|
override |
Gets the accelerations of all encoders.
| accs | Array to store the acceleration values. |
Definition at line 3357 of file CiA402MotionControl.cpp.
|
override |
Gets the values of all encoders.
| encs | Array to store the encoder values. |
Definition at line 3287 of file CiA402MotionControl.cpp.
|
override |
Gets the speed of a specific encoder.
| j | Index of the encoder. |
| sp | Pointer to store the speed value. |
Definition at line 3303 of file CiA402MotionControl.cpp.
|
override |
Gets the speeds of all encoders.
| spds | Array to store the speed values. |
Definition at line 3322 of file CiA402MotionControl.cpp.
|
override |
Gets the values and timestamps of all encoders.
| encs | Array to store the encoder values. |
| time | Array to store the timestamps (in seconds). |
Definition at line 3196 of file CiA402MotionControl.cpp.
|
override |
Gets the value and timestamp of a specific encoder.
| j | Index of the encoder. |
| encs | Pointer to store the encoder value. |
| time | Pointer to store the timestamp (in seconds). |
Definition at line 3213 of file CiA402MotionControl.cpp.
|
override |
Gets the gearbox ratio of a specific motor.
This function retrieves the gearbox ratio of the specified motor.
| m | Index of the motor (0-based). |
| val | Pointer to store the gearbox ratio value. |
Definition at line 4844 of file CiA402MotionControl.cpp.
|
override |
Gets the interaction mode of a specific axis.
| axis | Index of the axis (0-based). |
| mode | Pointer to store the interaction mode. |
Definition at line 5161 of file CiA402MotionControl.cpp.
|
override |
Gets the interaction modes of a subset of joints.
| n_joints | Number of joints. |
| joints | Array of joint indices. |
| modes | Array to store the interaction modes. |
Definition at line 5173 of file CiA402MotionControl.cpp.
|
override |
Gets the interaction modes of all joints.
| modes | Array to store the interaction modes. |
Definition at line 5195 of file CiA402MotionControl.cpp.
|
override |
Gets the type of a specific axis.
| axis | Index of the axis. |
| type | Reference to a JointTypeEnum to store the axis type. |
Definition at line 3392 of file CiA402MotionControl.cpp.
|
override |
Gets the last joint fault for a specific joint.
| j | Index of the joint. |
| fault | Reference to an integer to store the fault code. |
| message | Reference to a string to store the fault message. |
Definition at line 4168 of file CiA402MotionControl.cpp.
|
override |
Gets the position limits for a specific axis.
This function retrieves the minimum and maximum position limits for the specified axis.
| axis | Index of the axis (0-based). |
| min | Pointer to store the minimum position limit (in joint units, e.g., degrees). |
| max | Pointer to store the maximum position limit (in joint units, e.g., degrees). |
Definition at line 5126 of file CiA402MotionControl.cpp.
|
override |
Gets the value of a specific motor encoder.
| m | Index of the motor encoder. |
| v | Pointer to store the encoder value. |
Definition at line 3054 of file CiA402MotionControl.cpp.
|
override |
Gets the acceleration of a specific motor encoder.
| m | Index of the motor encoder. |
| acc | Pointer to store the acceleration value. |
Definition at line 3158 of file CiA402MotionControl.cpp.
|
override |
Gets the accelerations of all motor encoders.
| accs | Array to store the acceleration values. |
Definition at line 3177 of file CiA402MotionControl.cpp.
|
override |
Gets the counts per revolution for a specific motor encoder.
| m | Index of the motor encoder. |
| cpr | Pointer to store the counts per revolution value. |
Definition at line 3027 of file CiA402MotionControl.cpp.
|
override |
Gets the values of all motor encoders.
| encs | Array to store the encoder values. |
Definition at line 3073 of file CiA402MotionControl.cpp.
|
override |
Gets the speed of a specific motor encoder.
| m | Index of the motor encoder. |
| sp | Pointer to store the speed value. |
Definition at line 3123 of file CiA402MotionControl.cpp.
|
override |
Gets the speeds of all motor encoders.
| spds | Array to store the speed values. |
Definition at line 3142 of file CiA402MotionControl.cpp.
|
override |
Gets the values and timestamps of all motor encoders.
| encs | Array to store the encoder values. |
| time | Array to store the timestamps. |
Definition at line 3088 of file CiA402MotionControl.cpp.
|
override |
Gets the value and timestamp of a specific motor encoder.
| m | Index of the motor encoder. |
| encs | Pointer to store the encoder value. |
| time | Pointer to store the timestamp. |
Definition at line 3103 of file CiA402MotionControl.cpp.
|
override |
Gets the number of motor encoders.
| num | Pointer to an integer where the number of encoders will be stored. |
Definition at line 2984 of file CiA402MotionControl.cpp.
|
override |
Gets the number of motors controlled by the device.
This function retrieves the number of motors that are currently controlled by the device.
| num | Pointer to store the number of motors. |
Definition at line 4786 of file CiA402MotionControl.cpp.
|
override |
(Unused in CSV mode) Gets the reference acceleration for a specific joint.
| j | Index of the joint. |
| acc | Pointer to store the reference acceleration (ignored). |
Definition at line 3945 of file CiA402MotionControl.cpp.
|
override |
Gets the reference accelerations for a subset of joints.
| n_joint | Number of joints. |
| joints | Array of joint indices. |
| accs | Array to store the reference accelerations (ignored). |
Definition at line 4127 of file CiA402MotionControl.cpp.
|
override |
(Unused in CSV mode) Gets the reference accelerations for all joints.
| accs | Array to store the reference accelerations (ignored). |
Definition at line 3976 of file CiA402MotionControl.cpp.
|
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.
| m | Index of the motor (0-based). |
| curr | Pointer to store the reference current (A). |
Definition at line 5054 of file CiA402MotionControl.cpp.
|
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.
| currs | Array to store the reference currents for all motors (A). Size must equal the number of motors/axes. |
Definition at line 5041 of file CiA402MotionControl.cpp.
|
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.
| joint | Index of the joint. |
| ref | Pointer to store the last position-direct reference. |
Definition at line 4721 of file CiA402MotionControl.cpp.
|
override |
Returns the position-direct references for a subset of joints.
Fills refs with the cached values previously streamed for the provided joint indices.
| n_joint | Number of joints to query. |
| joints | Array of joint indices (size = n_joint). |
| refs | Array to store the corresponding cached references. |
Definition at line 4754 of file CiA402MotionControl.cpp.
|
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.
| refs | Array to store the last position-direct references for all joints. |
Definition at line 4739 of file CiA402MotionControl.cpp.
|
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.
| j | Index of the joint (0-based). |
| ref | Pointer to store the current profile velocity value. |
Definition at line 4527 of file CiA402MotionControl.cpp.
|
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.
| n_joint | Number of joints to query (must be > 0). |
| joints | Array of joint indices to query (each must be valid joint index). |
| spds | Array to store the profile velocities corresponding to the specified joints. |
Definition at line 4551 of file CiA402MotionControl.cpp.
|
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.
| spds | Array to store the profile velocities for all joints (size must equal number of axes). |
Definition at line 4539 of file CiA402MotionControl.cpp.
|
override |
Gets the reference torque for a specific joint.
| j | Index of the joint. |
| t | Pointer to store the reference torque. |
Definition at line 3578 of file CiA402MotionControl.cpp.
|
override |
Gets the reference torques for all joints.
| t | Array to store the reference torques. |
Definition at line 3597 of file CiA402MotionControl.cpp.
|
override |
Gets the reference velocity for a subset of joints.
| n_joint | Number of joints. |
| joints | Array of joint indices. |
| vels | Array to store the reference velocities. |
Definition at line 3842 of file CiA402MotionControl.cpp.
|
override |
Gets the reference velocities for all joints.
| vels | Array to store the reference velocities. |
Definition at line 3826 of file CiA402MotionControl.cpp.
|
override |
Gets the reference velocity for a specific joint.
| joint | Index of the joint. |
| vel | Pointer to store the reference velocity. |
Definition at line 3807 of file CiA402MotionControl.cpp.
|
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.
| j | Index of the joint (0-based). |
| ref | Pointer to store the target position value. |
Definition at line 4566 of file CiA402MotionControl.cpp.
|
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.
| n_joint | Number of joints to query (must be > 0). |
| joints | Array of joint indices to query (each must be valid joint index). |
| refs | Array to store the target positions corresponding to the specified joints. |
Definition at line 4592 of file CiA402MotionControl.cpp.
|
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.
| refs | Array to store the target positions for all joints (size must equal number of axes). |
Definition at line 4579 of file CiA402MotionControl.cpp.
|
override |
Gets the temperature of a specific motor.
This function retrieves the current temperature of the specified motor.
| m | Index of the motor (0-based). |
| val | Pointer to store the temperature value. |
Definition at line 4797 of file CiA402MotionControl.cpp.
|
override |
Gets the temperature limit of a specific motor.
This function retrieves the temperature limit of the specified motor.
| m | Index of the motor (0-based). |
| temp | Pointer to store the temperature limit value. |
Definition at line 4826 of file CiA402MotionControl.cpp.
|
override |
Gets the temperatures of all motors.
This function retrieves the current temperatures of all motors.
| vals | Array to store the temperature values (size must equal number of motors). |
Definition at line 4814 of file CiA402MotionControl.cpp.
|
override |
Gets the measured torque for a specific joint.
| j | Index of the joint. |
| t | Pointer to store the measured torque. |
Definition at line 3544 of file CiA402MotionControl.cpp.
|
override |
Gets the torque range for a specific joint.
| j | Index of the joint. |
| min | Pointer to store the minimum torque. |
| max | Pointer to store the maximum torque. |
Definition at line 3711 of file CiA402MotionControl.cpp.
|
override |
Gets the torque ranges for all joints.
| min | Array to store the minimum torques. |
| max | Array to store the maximum torques. |
Definition at line 3731 of file CiA402MotionControl.cpp.
|
override |
Gets the measured torques for all joints.
| t | Array to store the measured torques. |
Definition at line 3563 of file CiA402MotionControl.cpp.
|
override |
Gets the velocity limits for a specific axis.
This function retrieves the minimum and maximum velocity limits for the specified axis.
| axis | Index of the axis (0-based). |
| min | Pointer to store the minimum velocity limit (in joint units per second, e.g., degrees/s). |
| max | Pointer to store the maximum velocity limit (in joint units per second, e.g., degrees/s). |
Definition at line 5153 of file CiA402MotionControl.cpp.
|
override |
Opens the device driver.
| config | The configuration parameters for the driver. |
| 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 |
Definition at line 1771 of file CiA402MotionControl.cpp.
|
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.
| refs | Array of target positions for all joints (size must equal number of axes). |
Definition at line 4273 of file CiA402MotionControl.cpp.
|
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.
| n_joint | Number of joints to move (must be > 0). |
| joints | Array of joint indices to move (each must be valid joint index). |
| refs | Array of target positions corresponding to the specified joints. |
Definition at line 4307 of file CiA402MotionControl.cpp.
|
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).
| j | Index of the joint to move (0-based). |
| ref | Target position in joint coordinates (degrees or radians, depending on configuration). |
Definition at line 4241 of file CiA402MotionControl.cpp.
|
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.
| deltas | Array of relative displacements for all joints (size must equal number of axes). |
Definition at line 4367 of file CiA402MotionControl.cpp.
|
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.
| n_joint | Number of joints to move (must be > 0). |
| joints | Array of joint indices to move (each must be valid joint index). |
| deltas | Array of relative displacements corresponding to the specified joints. |
Definition at line 4389 of file CiA402MotionControl.cpp.
|
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.
| j | Index of the joint to move (0-based). |
| delta | Relative displacement in joint coordinates (degrees or radians). |
Definition at line 4343 of file CiA402MotionControl.cpp.
|
override |
Resets the specified encoder to zero.
| j | Index of the encoder to reset. |
Definition at line 3244 of file CiA402MotionControl.cpp.
|
override |
Resets all encoders to zero.
Definition at line 3250 of file CiA402MotionControl.cpp.
|
override |
Resets the specified motor encoder to zero.
| m | Index of the motor encoder to reset. |
Definition at line 2995 of file CiA402MotionControl.cpp.
|
override |
Resets all motor encoders to zero.
Definition at line 3001 of file CiA402MotionControl.cpp.
|
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.
|
override |
Sets the control mode of a specific joint.
| j | Index of the joint. |
| mode | Control mode to set. |
Definition at line 3468 of file CiA402MotionControl.cpp.
|
override |
Sets the control modes of a subset of joints.
| n | Number of joints. |
| joints | Array of joint indices. |
| modes | Array of control modes to set. |
Definition at line 3491 of file CiA402MotionControl.cpp.
|
override |
Sets the control modes of all joints.
| modes | Array of control modes to set. |
Definition at line 3521 of file CiA402MotionControl.cpp.
|
override |
Sets the value of a specific encoder.
| j | Index of the encoder. |
| val | Value to set. |
Definition at line 3256 of file CiA402MotionControl.cpp.
|
override |
Sets the values of all encoders.
| vals | Array of values to set for each encoder. |
Definition at line 3262 of file CiA402MotionControl.cpp.
|
override |
Sets the gearbox ratio of a specific motor.
This function sets the gearbox ratio of the specified motor.
| m | Index of the motor (0-based). |
| val | Gearbox ratio value to set. |
Definition at line 4860 of file CiA402MotionControl.cpp.
|
override |
Sets the interaction mode of a specific axis.
| axis | Index of the axis (0-based). |
| mode | Interaction mode to set. |
Definition at line 5210 of file CiA402MotionControl.cpp.
|
override |
Sets the interaction modes of a subset of joints.
| n_joints | Number of joints. |
| joints | Array of joint indices. |
| modes | Array of interaction modes to set. |
Definition at line 5225 of file CiA402MotionControl.cpp.
|
override |
Sets the interaction modes of all joints.
| modes | Array of interaction modes to set. |
Definition at line 5251 of file CiA402MotionControl.cpp.
|
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.
| axis | Index of the axis (0-based). |
| min | Minimum position limit (in joint units, e.g., degrees). |
| max | Maximum position limit (in joint units, e.g., degrees). |
Definition at line 5072 of file CiA402MotionControl.cpp.
|
override |
Sets the value of a specific motor encoder.
| m | Index of the motor encoder. |
| val | Value to set. |
Definition at line 3015 of file CiA402MotionControl.cpp.
|
override |
Sets the counts per revolution for a specific motor encoder.
| m | Index of the motor encoder. |
| cpr | Counts per revolution value to set. |
Definition at line 3007 of file CiA402MotionControl.cpp.
|
override |
Sets the values of all motor encoders.
| vals | Array of values to set for each encoder. |
Definition at line 3021 of file CiA402MotionControl.cpp.
|
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.
| j | Index of the joint to command (0-based). |
| ref | Absolute position target in joint coordinates. |
Definition at line 4609 of file CiA402MotionControl.cpp.
|
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.
| refs | Array of absolute position targets for all joints. |
Definition at line 4636 of file CiA402MotionControl.cpp.
|
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.
| n_joint | Number of joints to update. |
| joints | Array of joint indices to command (size = n_joint). |
| refs | Array of absolute position targets (size = n_joint). |
Definition at line 4670 of file CiA402MotionControl.cpp.
|
override |
(Unused in CSV mode) Sets the reference acceleration for a specific joint.
| j | Index of the joint. |
| acc | Reference acceleration (ignored). |
Definition at line 3874 of file CiA402MotionControl.cpp.
|
override |
(Unused in CSV mode) Sets the reference accelerations for all joints.
| accs | Array of reference accelerations (ignored). |
Definition at line 3930 of file CiA402MotionControl.cpp.
|
override |
Sets the reference accelerations for a subset of joints.
| n_joint | Number of joints. |
| joints | Array of joint indices. |
| accs | Array of reference accelerations (ignored). |
Definition at line 4108 of file CiA402MotionControl.cpp.
|
override |
Sets the reference current for a specific motor.
| m | Index of the motor (0-based). |
| curr | Reference current to command (A). |
Definition at line 4961 of file CiA402MotionControl.cpp.
|
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.
| currs | Array of reference currents for all motors (A). Size must equal the number of motors/axes. |
Definition at line 4930 of file CiA402MotionControl.cpp.
|
override |
Sets the reference currents for a subset of motors.
Allows updating a selected set of motors while leaving others unchanged.
| n_motor | Number of motors to command (must be > 0). |
| motors | Array of motor indices to command (each must be valid index). |
| currs | Array of reference currents (A) corresponding to the specified motors. |
Definition at line 4989 of file CiA402MotionControl.cpp.
|
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.
| j | Index of the joint (0-based). |
| sp | Profile velocity in joint coordinates per second (deg/s or rad/s). |
Definition at line 4464 of file CiA402MotionControl.cpp.
|
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.
| spds | Array of profile velocities for all joints (size must equal number of axes). |
Definition at line 4498 of file CiA402MotionControl.cpp.
|
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.
| n_joint | Number of joints to configure (must be > 0). |
| joints | Array of joint indices to configure (each must be valid joint index). |
| spds | Array of profile velocities corresponding to the specified joints. |
Definition at line 4512 of file CiA402MotionControl.cpp.
|
override |
Sets the reference torque for a specific joint.
| j | Index of the joint. |
| t | Reference torque to set. |
Definition at line 3611 of file CiA402MotionControl.cpp.
|
override |
Sets the reference torques for all joints.
| t | Array of reference torques to set. |
Definition at line 3638 of file CiA402MotionControl.cpp.
|
override |
Sets the reference torques for a subset of joints.
| n_joint | Number of joints. |
| joints | Array of joint indices. |
| t | Array of reference torques to set. |
Definition at line 3668 of file CiA402MotionControl.cpp.
|
override |
Sets the temperature limit of a specific motor.
This function sets the temperature limit of the specified motor.
| m | Index of the motor (0-based). |
| temp | Temperature limit value to set. |
Definition at line 4835 of file CiA402MotionControl.cpp.
|
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.
| axis | Index of the axis (0-based). |
| min | Minimum velocity limit (in joint units per second, e.g., degrees/s). |
| max | Maximum velocity limit (in joint units per second, e.g., degrees/s). |
Definition at line 5145 of file CiA402MotionControl.cpp.
|
override |
Stops motion for all joints.
Definition at line 4039 of file CiA402MotionControl.cpp.
|
override |
Stops motion for a subset of joints.
| n_joint | Number of joints. |
| joints | Array of joint indices. |
Definition at line 4139 of file CiA402MotionControl.cpp.
|
override |
Stops motion for a specific joint.
| j | Index of the joint. |
Definition at line 4009 of file CiA402MotionControl.cpp.
|
override |
Commands velocity moves for all joints.
| sp | Array of desired velocity setpoints for each joint. |
Definition at line 3776 of file CiA402MotionControl.cpp.
|
override |
Commands velocity moves for a subset of joints.
| n_joint | Number of joints. |
| joints | Array of joint indices. |
| spds | Array of desired velocity setpoints for the specified joints. |
Definition at line 4063 of file CiA402MotionControl.cpp.
|
override |
Commands a velocity move for a specific joint.
| j | Index of the joint. |
| sp | Desired velocity setpoint (units: deg/s or rad/s, depending on configuration). |
Definition at line 3747 of file CiA402MotionControl.cpp.