![]() |
Hekateros
3.4.3
RoadNarrows Robotics Robot Arm Project
|
Hekateros powered joint dynamics and kinematics control class. More...
#include <hekKinJoint.h>
Public Types | |
| enum | MoveState { MoveStateIdle, MoveStateNewMove, MoveStateMoving, MoveStateStopping } |
| Kinedynamics joint position and velocity control states. More... | |
Public Member Functions | |
| HekKinJoint () | |
| Default constructor. | |
| HekKinJoint (HekRobotJoint *pJoint, DynaServo *pServo, const HekTunes &tunes) | |
| Initialization constructor. More... | |
| virtual | ~HekKinJoint () |
| Copy constructor. More... | |
| virtual void | coupleJoint (HekKinJoint *) |
| Couple joint. More... | |
| HekKinJoint & | operator= (const HekKinJoint &rhs) |
| Assignment operator. More... | |
| virtual void | reload (const HekTunes &tunes) |
| Reload configuration tuning parameters. More... | |
| MoveState | getMoveState () |
| Get move control state for this joint. More... | |
| bool | isMovingToGoal () |
| Test if actively moving joint to goal. More... | |
| bool | isStopping () |
| Test if actively stopping joint. More... | |
| bool | isMoving () |
| Test if actively moving joint. More... | |
| virtual bool | isStopped () |
| Test if joint is stopped (i.e. control is not active). More... | |
| bool | canStopNow () |
| Test if can stop now without slowing down. More... | |
| void | getPidKParams (double &fKp, double &fKi, double &fKd) const |
| Get the joint's position and velocity PID K parameters. More... | |
| void | setPidKParams (const double fKp, const double fKi, const double fKd) |
| Set the joint's position and velocity PID K parameters. More... | |
| double | getPidMaxDeltaVParam () const |
| Get joint PID maximum delta v (radians/second) parameter. More... | |
| void | setPidMaxDeltaVParam (const double fMaxDeltaV) |
| Set joint PID maximum delta v (radians/second) parameter. More... | |
| void | getToleranceParams (double &fTolPos, double &fTolVel) const |
| Get the position and velocity tolerance parameters. More... | |
| void | setToleranceParams (const double fTolPos, const double fTolVel) |
| Set the position and velocity tolerance parameters. More... | |
| void | getJointCurPosVel (double &fCurPos, double &fCurVel) const |
| Get the instantaneous current joint position and velocity. More... | |
| void | getFilteredJointCurPosVel (double &fCurPos, double &fCurVel) const |
| Get the smoothed (filtered) current joint position and velocity. More... | |
| void | getServoCurPosSpeed (int &nServoCurPos, int &nServoCurSpeed) const |
| Get the instantaneous current servo position and speed. More... | |
| void | getTgtVelSpeed (double &fTgtVel, int &nTgtSpeed) const |
| Get the PID output target joint velocity and the corresponding servo speed estemate. More... | |
| virtual bool | hasOverTorqueCondition () |
| Test if joint is in an over torque condition. More... | |
| virtual int | jointPosToServoPos (const double fPos) |
| Convert joint position to the equivalent servo position. More... | |
| virtual double | servoPosToJointPos (const int nOdPos) |
| Convert servo position to the equivalent joint position. More... | |
| virtual int | resetServoOdometer () |
| Reset servo odometer zero point to the current encoder position. More... | |
| int | specifyMove (const double fGoalPos, const double fGoalVel) |
| Specify a new joint goal position and velocity move. More... | |
| virtual int | senseDynamics (bool bIsControlling) |
| Sense (read) the current servo dynamics and transform to useful state. More... | |
| virtual int | react (bool bIsControlling, SyncMoveMsgs &msgs) |
| React to recently read sensor data. More... | |
| virtual MoveState | planMotion (bool bIsControlling, SyncMoveMsgs &msgs) |
| Plan motion. More... | |
| virtual int | act () |
| Act (write) to effect the servo dynamics for torque and motion control. More... | |
| virtual int | applyTorqueControl () |
| Apply torque limit control. More... | |
| virtual MoveState | move () |
| Move joint using joint PID controller. More... | |
| virtual int | stop () |
| Stop movement and move control of the joint. More... | |
Static Public Attributes | |
| static const size_t | POS_WIN_SIZE = 6 |
| Position sliding window size for low-pass band filtering of input positions. | |
| static const size_t | DT_WIN_SIZE = 10 |
| Delta t sliding window size for low-pass band filtering of input delta times. | |
| static const size_t | VEL_WIN_SIZE = 6 |
| Velocity sliding window size for low-pass band filtering of input Velocities. | |
| static const double | SLOW_DERATE_DELTA_V = 1.0 |
| Stop delta v as a fraction of max_delta_v tune parameter. | |
| static const size_t | TORQUE_WIN_SIZE = 4 |
| Torque sliding window size for low-pass band filtering of input torques. | |
| static const int | TORQUE_CTL_BACKOFF_SPEED = 100 |
| Torque control backoff speed (raw unitless) | |
| static const int | TORQUE_CTL_BACKOFF_POS = 5 |
| Torque control backoff positon (odometer ticks) | |
Protected Member Functions | |
| void | lock () |
| Lock the joint kinematics. More... | |
| void | unlock () |
| Unlock the joint kinematics. More... | |
| double | delta_t () |
| Calculate the delta time between calls to this. More... | |
| double | averageDt (double fDtAvg, double fDt) |
| Apply a running average for the delta times (seconds). More... | |
| int | dejitterServoPos (int nServoCurPos, int nServoPrevPos) |
| De-jitter servo odometer position. More... | |
| double | filterPositions (double fPosAvg, double fJointPos) |
| Apply a low-pass band filter on the joint positions (radians). More... | |
| double | filterVelocities (double fVelAvg, double fJointVel) |
| Apply a low-pass band filter on the joint velocities (radians/second). More... | |
| double | filterTorques (double fTorqueAvg, int nServoLoad) |
| Apply a low-pass band filter on the sensed torques (loads). More... | |
| int | getGoalDir () |
| Get the current goal rotation direction. More... | |
| int | getPlannedDir (int nServoTgtSpeed) |
| Get the planned target rotation direction. More... | |
| bool | canMoveInGoalDir () |
| Test if joint can move in direction of goal position. More... | |
| bool | canMoveInPlannedDir (int nServoTgtSpeed) |
| Test if joint can move in planned direction. More... | |
| virtual double | jointVelocity (double fPos1, double fPos0, double fDt) |
| Calculate the joint velocity from delta servo positions. More... | |
| virtual void | updateAssoc (double fJointVel, int nServoSpeed) |
| Update joint velocity - servo speed association. More... | |
| virtual int | estimateServoTgtSpeed (double fJointTgtVel) |
| Estimate of target servo speed from target joint velocity. More... | |
| virtual int | estimateServoTgtSpeedSimple (double fJointTgtVel) |
| Simple estimate of target servo speed from target joint velocity. More... | |
| void | moveServo (int nServoGoalSpeed, int nServoGoalPos) |
| Move servo. More... | |
| void | addServoMsgEntries (SyncMoveMsgs &msg, int nServoGoalSpeed, int nServoGoalPos) |
| Add servo to synchronous move message(s). More... | |
| virtual int | nlspecifyMove (const double fGoalPos, const double fGoalVel) |
| Specify a new joint goal position and velocity move (no lock version). More... | |
| virtual int | nlapplyTorqueControl () |
| Apply torque limit control (no lock version). More... | |
| virtual MoveState | nlmove () |
| Move joint using joint PID controller (no lock version). More... | |
| virtual int | nlstop () |
| Stop movement and move control of the joint (no lock version). More... | |
| virtual int | nlslowToStop (SyncMoveMsgs &msg) |
| Slow to stop (no lock version). More... | |
Protected Attributes | |
| MoveState | m_eState |
| joint control state | |
| pthread_mutex_t | m_mutexSync |
| synchonization mutex | |
| HekRobotJoint * | m_pJoint |
| joint description | |
| DynaServo * | m_pServo |
| joint master servo control | |
| double | m_fTolPos |
| joint position ± tolerance (rads) | |
| double | m_fTolVel |
| joint velocity ± tolerance (rads/s) | |
| double | m_fStopVelTh |
| joint velocity threshold to safely stop move | |
| HekPid | m_pid |
| joint position and velocity PID | |
| double | m_fJointRadPerTick |
| joint radians / odometer tick | |
| double | m_fJointGoalPos |
| joint goal position (radians) | |
| int | m_nServoGoalPos |
| servo goal position (odometer ticks) | |
| double | m_fJointCurPos |
| joint current position (radians) | |
| int | m_nServoCurPos |
| servo current position (odometer ticks) | |
| double | m_fJointPrevPos |
| joint current position (radians) | |
| int | m_nServoPrevPos |
| servo previous pos (odometer ticks) | |
| double | m_fJointPosOut |
| low-pass filtered joint cur position | |
| std::deque< double > | m_histPosIn |
| recent history of joint positions | |
| double | m_fDt |
| delta time between positions reads | |
| struct timespec | m_tsPrev |
| previous time mark | |
| double | m_fDtAvg |
| average delta t | |
| std::deque< double > | m_histDtIn |
| sliding window of delta t's | |
| double | m_fJointGoalVel |
| joint goal velocity (radians/second) | |
| double | m_fJointCurVel |
| joint current velocity (radians/second) | |
| int | m_nServoCurSpeed |
| current motor speed (raw unitless) | |
| double | m_fVelDerate |
| joint velocity derate (normalized) | |
| VelSpeedLookupTbl | m_tblVelSpeed |
| dynamic velocity/speed lookup table | |
| double | m_fJointVelOut |
| low-pass filtered joint cur velocity | |
| std::deque< double > | m_histVelIn |
| sliding window of current velocities | |
| double | m_fJointTgtVel |
| joint target velocity (radians/second) | |
| int | m_nServoTgtSpeed |
| target motor speed (raw unitless) | |
| bool | m_bOverTorqueCond |
| is [not] in torque overload condition | |
| double | m_fOverTorqueTh |
| set over torque condition threshold | |
| double | m_fClearTorqueTh |
| clear over torque condition threshold | |
| int | m_nServoCurLoad |
| servo current load (raw unitless) | |
| double | m_fTorqueOut |
| low-pass filtered torque | |
| std::deque< double > | m_histTorqueIn |
| recent history of joint torques | |
Hekateros powered joint dynamics and kinematics control class.
One or more motors can power a joint. Two or more joints may be coupled (e.g. wrist pitch and rotation). Motors can be actuators with built in controllers, DC motors, synthetic muscle, or any other physical entity that can provide usefull force and be controlled.
Currently, only Dynamixels actuators (servos) are supported.
Definition at line 387 of file hekKinJoint.h.
| enum hekateros::HekKinJoint::MoveState |
Kinedynamics joint position and velocity control states.
| Enumerator | |
|---|---|
| MoveStateIdle |
no active goal or stopping control |
| MoveStateNewMove |
start move to new goal |
| MoveStateMoving |
actively moving to goal |
| MoveStateStopping |
actively stopping joint |
Definition at line 435 of file hekKinJoint.h.
| HekKinJoint::HekKinJoint | ( | HekRobotJoint * | pJoint, |
| DynaServo * | pServo, | ||
| const HekTunes & | tunes | ||
| ) |
Initialization constructor.
| pJoint | Pointer to joint description. |
| pServo | Pointer to master servo controller. |
| tunes | Hekateros tuning parameters. |
Definition at line 441 of file hekKinJoint.cxx.
References hekateros::VelSpeedLookupTbl::create(), hekateros::degToRad(), hekateros::HekTunes::getPidKParams(), hekateros::HekTunes::getPidMaxDeltaV(), hekateros::HekTunes::getToleranceParams(), hekateros::HekTunes::getTorqueParams(), hekateros::HekTunes::getVelocityDerate(), m_bOverTorqueCond, m_eState, m_fClearTorqueTh, m_fDt, m_fDtAvg, m_fJointCurPos, m_fJointCurVel, m_fJointGoalPos, m_fJointGoalVel, m_fJointPosOut, m_fJointPrevPos, m_fJointRadPerTick, m_fJointTgtVel, m_fJointVelOut, hekateros::HekRobotJoint::m_fMaxJointRadsPerSec, m_fOverTorqueTh, m_fStopVelTh, hekateros::HekRobotJoint::m_fTicksPerJointRad, m_fTolPos, m_fTolVel, m_fTorqueOut, m_fVelDerate, m_mutexSync, m_nServoCurPos, m_nServoCurSpeed, m_nServoGoalPos, m_nServoPrevPos, m_nServoTgtSpeed, m_pJoint, hekateros::HekRobotJoint::m_strName, m_tblVelSpeed, m_tsPrev, MoveStateIdle, setPidKParams(), setPidMaxDeltaVParam(), and SLOW_DERATE_DELTA_V.
|
inlinevirtual |
Copy constructor.
| src | Source object. |
Destructor.
Definition at line 469 of file hekKinJoint.h.
|
virtual |
Act (write) to effect the servo dynamics for torque and motion control.
Reimplemented in hekateros::HekKinJointWristRot.
Definition at line 938 of file hekKinJoint.cxx.
References canMoveInGoalDir(), hekateros::HEK_OK, isMovingToGoal(), lock(), m_bOverTorqueCond, nlapplyTorqueControl(), nlmove(), and unlock().
Referenced by hekateros::HekKinematics::exec().
|
protected |
Add servo to synchronous move message(s).
| msgs | Synchronous move messages container object. |
| nServoGoalSpeed | Servo goal speed (raw unitless). |
| nServoGoalPos | Servo goal position (odometer ticks). |
Definition at line 1118 of file hekKinJoint.cxx.
References hekateros::SyncMoveMsgs::addOdPos(), hekateros::SyncMoveMsgs::addSpeed(), hekateros::cap(), hekateros::iabs(), m_eState, m_nServoTgtSpeed, m_pServo, MoveStateMoving, and MoveStateNewMove.
Referenced by nlslowToStop(), hekateros::HekKinJointWristRot::nlslowToStop(), planMotion(), and hekateros::HekKinJointWristRot::planMotion().
|
virtual |
Apply torque limit control.
Definition at line 964 of file hekKinJoint.cxx.
References hekateros::HEK_OK, lock(), m_pServo, nlapplyTorqueControl(), and unlock().
|
protected |
Apply a running average for the delta times (seconds).
A simple moving average (SMa) of delta times with a window size of DT_WIN_SIZE is used.
| fDtAvg | Current delta time average (seconds). |
| fDt | New delta time (seconds). |
Definition at line 1305 of file hekKinJoint.cxx.
References DT_WIN_SIZE, and m_histDtIn.
|
protected |
Test if joint can move in direction of goal position.
The joint must not be in an over torque condition or the move will ease the torque, not exacerbate the condition.
Definition at line 749 of file hekKinJoint.cxx.
References getGoalDir(), m_bOverTorqueCond, and m_nServoCurLoad.
Referenced by act(), and hekateros::HekKinJointWristRot::act().
|
protected |
Test if joint can move in planned direction.
The joint must not be in an over torque condition or the move will ease the torque, not worsen the condition.
| nServoTgtSpeed | Planned servo target speed (raw unitless). |
Definition at line 754 of file hekKinJoint.cxx.
References getPlannedDir(), m_bOverTorqueCond, and m_nServoCurLoad.
Referenced by planMotion(), and hekateros::HekKinJointWristRot::planMotion().
|
inline |
Test if can stop now without slowing down.
Definition at line 561 of file hekKinJoint.h.
References hekateros::HekOpStateCalibrated, and hekateros::HekTunePidDeltaVNoMax.
Referenced by nlstop(), react(), and hekateros::HekKinJointWristRot::react().
|
inlinevirtual |
Couple joint.
| pKinJointCoupled | Base class joint has no coupled joint. |
Reimplemented in hekateros::HekKinJointWristRot.
Definition at line 480 of file hekKinJoint.h.
|
protected |
De-jitter servo odometer position.
The servo can report encoder position of 1.
| nServoCurPos | Servo current odometer position. |
| nServoPrevPos | Servo previous odometer position. |
Definition at line 1318 of file hekKinJoint.cxx.
References hekateros::iabs().
Referenced by senseDynamics().
|
protected |
Calculate the delta time between calls to this.
Definition at line 1288 of file hekKinJoint.cxx.
References hekateros::dt(), and m_tsPrev.
Referenced by senseDynamics().
|
protectedvirtual |
Estimate of target servo speed from target joint velocity.
The Dynamixel speed value is a raw, unitless (and probably non-linear) value. The estimate is made using linear interpolation from a dynamically maintained velocity,speed lookup table.
| fJointTgtVel | Target joint velocity (radians/seconds). |
Definition at line 1264 of file hekKinJoint.cxx.
References hekateros::VelSpeedLookupTbl::estimate(), m_pServo, m_tblVelSpeed, and hekateros::signof().
Referenced by nlmove(), hekateros::HekKinJointWristRot::nlmove(), nlslowToStop(), hekateros::HekKinJointWristRot::nlslowToStop(), planMotion(), and hekateros::HekKinJointWristRot::planMotion().
|
protectedvirtual |
Simple estimate of target servo speed from target joint velocity.
The Dynamixel speed value is a raw, unitless (and probably non-linear) value. The estimate is made by interpolating the current speed between 0 and the maximum unloaded joint velocity.
| fJointTgtVel | Target joint velocity (radians/seconds). |
Definition at line 1276 of file hekKinJoint.cxx.
References hekateros::cap(), getGoalDir(), hekateros::HekRobotJoint::m_fMaxJointRadsPerSec, and m_pJoint.
|
protected |
Apply a low-pass band filter on the joint positions (radians).
A simple moving average (SMA) of positions with a window size of POS_WIN_SIZE is used as the filter.
| fPosAvg | Current joint position average (radians). |
| fJointPos | New joint position (radians). |
Definition at line 1339 of file hekKinJoint.cxx.
References m_histPosIn, and POS_WIN_SIZE.
Referenced by senseDynamics().
|
protected |
Apply a low-pass band filter on the sensed torques (loads).
The torques are interpreted from the read servo loads which are unitless values (and probably non-linear).
A simple moving average (SMA) of load values with a window size of TORQUE_WIN_SIZE is used as the filter.
| fTorqueAvg | Current torque (load) average value. |
| nServoLoad | New servo load value (raw unitless). |
Definition at line 1365 of file hekKinJoint.cxx.
References m_histTorqueIn, and TORQUE_WIN_SIZE.
Referenced by nlapplyTorqueControl(), and senseDynamics().
|
protected |
Apply a low-pass band filter on the joint velocities (radians/second).
A simple moving average (SMA) of velocities with a window size of VEL_WIN_SIZE is used as the filter.
| fVelAvg | Current joint velocitie average (radians/second). |
| fJointVel | New joint velocity (radians/second). |
Definition at line 1352 of file hekKinJoint.cxx.
References m_histVelIn, and VEL_WIN_SIZE.
Referenced by senseDynamics().
|
inline |
Get the smoothed (filtered) current joint position and velocity.
| [out] | fCurPos | Current joint position (radians). |
| [out] | fCurVel | Current joint velocity (radians/second). |
Definition at line 662 of file hekKinJoint.h.
|
protected |
Get the current goal rotation direction.
The direction is deterimed by the difference of current odometer value and the goal position.
Normally counter-clockwise is positive, clockwise is negative, but the sence can be reversed in the odometer configuration.
Definition at line 737 of file hekKinJoint.cxx.
References m_nServoGoalPos, and m_pServo.
Referenced by canMoveInGoalDir(), and estimateServoTgtSpeedSimple().
|
inline |
Get the instantaneous current joint position and velocity.
| [out] | fCurPos | Current joint position (radians). |
| [out] | fCurVel | Current joint velocity (radians/second). |
Definition at line 650 of file hekKinJoint.h.
|
inline |
Get move control state for this joint.
Definition at line 511 of file hekKinJoint.h.
Referenced by hekateros::HekKinJointWristRot::coupleJoint().
|
inline |
Get the joint's position and velocity PID K parameters.
| [out] | fKp | Proportional gain parameter. |
| [out] | fKi | Integral gain parameter. |
| [out] | fKd | Derivative gain parameter. |
Definition at line 575 of file hekKinJoint.h.
|
inline |
Get joint PID maximum delta v (radians/second) parameter.
Definition at line 599 of file hekKinJoint.h.
|
protected |
Get the planned target rotation direction.
The direction is deterimed sign of the servo speed.
Normally counter-clockwise is positive, clockwise is negative, but the sence can be reversed in the odometer configuration.
| nServoTgtSpeed | Planned servo target speed (raw unitless). Odometer configuration is already added! |
Definition at line 744 of file hekKinJoint.cxx.
Referenced by canMoveInPlannedDir().
|
inline |
Get the instantaneous current servo position and speed.
| [out] | nServoCurPos | Current servo position (odometer ticks). |
| [out] | nServoCurSpeed | Current servo velocity (raw unitless). |
Definition at line 674 of file hekKinJoint.h.
|
inline |
Get the PID output target joint velocity and the corresponding servo speed estemate.
| [out] | fTgtVel | Target joint velocity (radians/second). |
| [out] | nTgtSpeed | Target servo speed (raw unitless). |
Definition at line 687 of file hekKinJoint.h.
|
inline |
Get the position and velocity tolerance parameters.
The joint PID will try to control to the goal position ± position tolerance and to the goal velocity ± velocity tolerance.
| [out] | fTolPos | Joint position tolerance (radians). |
| [out] | fTolVel | Joint velocity tolerance (radians/second). |
Definition at line 623 of file hekKinJoint.h.
|
inlinevirtual |
Test if joint is in an over torque condition.
Definition at line 698 of file hekKinJoint.h.
|
inline |
Test if actively moving joint.
Definition at line 541 of file hekKinJoint.h.
|
inline |
Test if actively moving joint to goal.
Definition at line 521 of file hekKinJoint.h.
Referenced by act(), hekateros::HekKinJointWristRot::act(), nlmove(), hekateros::HekKinJointWristRot::nlmove(), planMotion(), hekateros::HekKinJointWristRot::planMotion(), react(), and hekateros::HekKinJointWristRot::react().
|
inlinevirtual |
Test if joint is stopped (i.e. control is not active).
Definition at line 551 of file hekKinJoint.h.
Referenced by hekateros::HekKinJointWristRot::act(), and hekateros::HekKinJointWristRot::react().
|
inline |
Test if actively stopping joint.
Definition at line 531 of file hekKinJoint.h.
Referenced by react(), and hekateros::HekKinJointWristRot::react().
|
virtual |
Convert joint position to the equivalent servo position.
| fPos | Joint position (radians). |
Reimplemented in hekateros::HekKinJointWristRot.
Definition at line 1244 of file hekKinJoint.cxx.
References hekateros::HekRobotJoint::m_fTicksPerJointRad, and m_pJoint.
Referenced by hekateros::HekKinJointWristRot::nlmove(), nlspecifyMove(), and hekateros::HekKinJointWristRot::planMotion().
|
protectedvirtual |
Calculate the joint velocity from delta servo positions.
| fPos1 | Later joint position (radians/second). |
| fPos0 | Earlier joint position (radians/second). |
| fDt | Delta time in seconds. |
Definition at line 1254 of file hekKinJoint.cxx.
Referenced by senseDynamics().
|
inlineprotected |
Lock the joint kinematics.
The calling thread will block while waiting for the mutex to become available. Once locked, the Hekateros kinematics thread will block when accessing this joint.
The lock()/unlock() primitives provide a safe mechanism to modify the joint data, such as the next goals.
Definition at line 874 of file hekKinJoint.h.
Referenced by act(), hekateros::HekKinJointWristRot::act(), applyTorqueControl(), move(), planMotion(), hekateros::HekKinJointWristRot::planMotion(), react(), hekateros::HekKinJointWristRot::react(), reload(), resetServoOdometer(), senseDynamics(), specifyMove(), and stop().
|
virtual |
Move joint using joint PID controller.
Once the move has reached the goal joint position, within tolerence, the move will automatically stop.
Definition at line 1028 of file hekKinJoint.cxx.
References lock(), m_pServo, MoveStateIdle, nlmove(), and unlock().
|
protected |
Move servo.
| nServoGoalSpeed | Servo goal speed (raw unitless). |
| nServoGoalPos | Servo goal position (odometer ticks). |
| bNewMove | This is [not] a new move. |
Definition at line 1080 of file hekKinJoint.cxx.
References hekateros::cap(), hekateros::iabs(), m_eState, m_pServo, MoveStateMoving, and MoveStateNewMove.
Referenced by nlmove(), and hekateros::HekKinJointWristRot::nlmove().
|
protectedvirtual |
Apply torque limit control (no lock version).
Definition at line 982 of file hekKinJoint.cxx.
References filterTorques(), hekateros::HEK_OK, m_fOverTorqueTh, m_fTorqueOut, m_nServoCurLoad, m_pServo, TORQUE_CTL_BACKOFF_POS, and TORQUE_CTL_BACKOFF_SPEED.
Referenced by act(), hekateros::HekKinJointWristRot::act(), applyTorqueControl(), react(), and hekateros::HekKinJointWristRot::react().
|
protectedvirtual |
Move joint using joint PID controller (no lock version).
Once the move has reached the goal joint position, within tolerence, the move will automatically stop.
Reimplemented in hekateros::HekKinJointWristRot.
Definition at line 1046 of file hekKinJoint.cxx.
References hekateros::HekPid::control(), estimateServoTgtSpeed(), isMovingToGoal(), m_eState, m_fDt, m_fJointCurPos, m_fJointCurVel, m_fJointGoalPos, m_fJointTgtVel, m_fTolPos, m_fTolVel, m_nServoGoalPos, m_nServoTgtSpeed, m_pid, moveServo(), MoveStateNewMove, and nlstop().
Referenced by act(), hekateros::HekKinJointWristRot::act(), and move().
|
protectedvirtual |
Slow to stop (no lock version).
| msgs | Synchronous move messages container object. |
Reimplemented in hekateros::HekKinJointWristRot.
Definition at line 1210 of file hekKinJoint.cxx.
References addServoMsgEntries(), estimateServoTgtSpeed(), hekateros::HEK_OK, m_fJointCurVel, m_fStopVelTh, m_nServoGoalPos, and nlstop().
Referenced by react(), and hekateros::HekKinJointWristRot::react().
|
protectedvirtual |
Specify a new joint goal position and velocity move (no lock version).
The joint PID will begin to control to the new goals, smoothly transitioning (I hope) from the current goals.
| fGoalPos | Joint goal position (radians). |
| fGoalVel | Joint goal velocity (radians/second). |
Definition at line 675 of file hekKinJoint.cxx.
References hekateros::HEK_OK, hekateros::HekJointTypeContinuous, hekateros::HekOpStateCalibrated, jointPosToServoPos(), hekateros::HekRobotJoint::m_eJointType, hekateros::HekRobotJoint::m_eOpState, m_eState, m_fJointCurPos, m_fJointGoalPos, m_fJointGoalVel, hekateros::HekRobotJoint::m_fMaxSoftLimitRads, hekateros::HekRobotJoint::m_fMinSoftLimitRads, m_fVelDerate, hekateros::HekRobotJoint::m_nMasterServoId, m_nServoGoalPos, m_pid, m_pJoint, hekateros::HekRobotJoint::m_strName, MoveStateNewMove, hekateros::radToDeg(), and hekateros::HekPid::specifySetPoint().
Referenced by hekateros::HekKinJointWristRot::act(), hekateros::HekKinJointWristRot::react(), and specifyMove().
|
protectedvirtual |
Stop movement and move control of the joint (no lock version).
Definition at line 1162 of file hekKinJoint.cxx.
References canStopNow(), hekateros::HEK_OK, m_eState, m_fJointCurPos, m_fJointCurVel, m_fJointGoalPos, m_fJointGoalVel, m_fJointPrevPos, m_fJointTgtVel, m_nServoCurPos, m_nServoCurSpeed, m_nServoGoalPos, m_nServoPrevPos, m_nServoTgtSpeed, m_pServo, MoveStateIdle, MoveStateStopping, and servoPosToJointPos().
Referenced by nlmove(), hekateros::HekKinJointWristRot::nlmove(), nlslowToStop(), hekateros::HekKinJointWristRot::nlslowToStop(), react(), hekateros::HekKinJointWristRot::react(), resetServoOdometer(), and stop().
| HekKinJoint & HekKinJoint::operator= | ( | const HekKinJoint & | rhs | ) |
Assignment operator.
| rhs | Right hand side object. |
Definition at line 520 of file hekKinJoint.cxx.
References m_bOverTorqueCond, m_eState, m_fClearTorqueTh, m_fDt, m_fDtAvg, m_fJointCurPos, m_fJointCurVel, m_fJointGoalPos, m_fJointGoalVel, m_fJointPosOut, m_fJointPrevPos, m_fJointRadPerTick, m_fJointTgtVel, m_fJointVelOut, m_fOverTorqueTh, m_fStopVelTh, m_fTolPos, m_fTolVel, m_fTorqueOut, m_histDtIn, m_histPosIn, m_histTorqueIn, m_histVelIn, m_nServoCurPos, m_nServoCurSpeed, m_nServoGoalPos, m_nServoPrevPos, m_nServoTgtSpeed, m_pid, m_pJoint, m_pServo, m_tblVelSpeed, and m_tsPrev.
|
virtual |
Plan motion.
| bIsControlling | Joint is [not] being actively controlled. However, planning may still be desired. |
| msgs | Synchronous move messages container object. |
Reimplemented in hekateros::HekKinJointWristRot.
Definition at line 895 of file hekKinJoint.cxx.
References addServoMsgEntries(), canMoveInPlannedDir(), hekateros::HekPid::control(), estimateServoTgtSpeed(), isMovingToGoal(), lock(), m_eState, m_fDt, m_fJointCurPos, m_fJointCurVel, m_fJointGoalPos, m_fJointTgtVel, m_fTolPos, m_fTolVel, m_nServoGoalPos, m_nServoTgtSpeed, m_pid, m_pServo, MoveStateIdle, MoveStateNewMove, and unlock().
|
virtual |
React to recently read sensor data.
| bIsControlling | Joint is [not] being actively controlled. However, reaction may still be desired. |
| msgs | Synchronous move messages container object. |
Reimplemented in hekateros::HekKinJointWristRot.
Definition at line 854 of file hekKinJoint.cxx.
References canStopNow(), hekateros::HEK_OK, isMovingToGoal(), isStopping(), lock(), m_bOverTorqueCond, m_fJointCurPos, m_fJointGoalPos, m_fTolPos, nlapplyTorqueControl(), nlslowToStop(), nlstop(), and unlock().
|
virtual |
Reload configuration tuning parameters.
| tunes | Hekateros tuning parameters. |
Definition at line 565 of file hekKinJoint.cxx.
References hekateros::HekTunes::getPidKParams(), hekateros::HekTunes::getPidMaxDeltaV(), hekateros::HekTunes::getToleranceParams(), hekateros::HekTunes::getTorqueParams(), hekateros::HekTunes::getVelocityDerate(), lock(), m_fClearTorqueTh, m_fOverTorqueTh, m_fStopVelTh, m_fTolPos, m_fTolVel, m_fVelDerate, m_pJoint, m_pServo, hekateros::HekRobotJoint::m_strName, setPidKParams(), setPidMaxDeltaVParam(), SLOW_DERATE_DELTA_V, and unlock().
|
virtual |
Reset servo odometer zero point to the current encoder position.
Definition at line 605 of file hekKinJoint.cxx.
References hekateros::boolstr(), hekateros::HEK_ECODE_DYNA, hekateros::HEK_OK, lock(), m_fJointCurPos, m_fJointCurVel, m_fJointGoalPos, m_fJointGoalVel, m_fJointPrevPos, m_fJointTgtVel, hekateros::HekRobotJoint::m_nMasterServoDir, hekateros::HekRobotJoint::m_nMasterServoId, m_nServoCurPos, m_nServoCurSpeed, m_nServoGoalPos, m_nServoPrevPos, m_nServoTgtSpeed, m_pJoint, m_pServo, hekateros::HekRobotJoint::m_strName, nlstop(), and unlock().
|
virtual |
Sense (read) the current servo dynamics and transform to useful state.
| bIsControlling | Joint is [not] being actively controlled. |
Definition at line 760 of file hekKinJoint.cxx.
References dejitterServoPos(), delta_t(), filterPositions(), filterTorques(), filterVelocities(), hekateros::HEK_ECODE_DYNA, hekateros::HEK_OK, hekateros::HekOpStateCalibrated, hekateros::iabs(), jointVelocity(), lock(), m_bOverTorqueCond, hekateros::HekRobotJoint::m_eOpState, m_fClearTorqueTh, m_fDt, m_fJointCurPos, m_fJointCurVel, m_fJointPosOut, m_fJointPrevPos, m_fJointVelOut, m_fOverTorqueTh, hekateros::HekRobotJoint::m_fTicksPerServoRad, m_fTorqueOut, m_nServoCurLoad, m_nServoCurPos, m_nServoCurSpeed, m_nServoPrevPos, m_pJoint, m_pServo, hekateros::HekRobotJoint::m_strName, servoPosToJointPos(), unlock(), and updateAssoc().
Referenced by hekateros::HekKinematics::exec().
|
virtual |
Convert servo position to the equivalent joint position.
| nOdPos | Servo position (odometer ticks). |
Reimplemented in hekateros::HekKinJointWristRot.
Definition at line 1249 of file hekKinJoint.cxx.
References hekateros::HekRobotJoint::m_fTicksPerJointRad, and m_pJoint.
Referenced by nlstop(), and senseDynamics().
|
inline |
Set the joint's position and velocity PID K parameters.
| [in] | fKp | Proportional gain parameter. |
| [in] | fKi | Integral gain parameter. |
| [in] | fKd | Derivative gain parameter. |
Definition at line 589 of file hekKinJoint.h.
Referenced by HekKinJoint(), and reload().
|
inline |
Set joint PID maximum delta v (radians/second) parameter.
| fMaxDeltaV | Maximum output delta velocity (radians/second). |
Definition at line 609 of file hekKinJoint.h.
Referenced by HekKinJoint(), and reload().
|
inline |
Set the position and velocity tolerance parameters.
The joint PID will try to control to the goal position ± position tolerance and to the goal velocity ± velocity tolerance.
| [in] | fTolPos | Joint position tolerance (radians). |
| [in] | fTolVel | Joint velocity tolerance (radians/second). |
Definition at line 638 of file hekKinJoint.h.
| int HekKinJoint::specifyMove | ( | const double | fGoalPos, |
| const double | fGoalVel | ||
| ) |
Specify a new joint goal position and velocity move.
The joint PID will begin to control to the new goals, smoothly transitioning (I hope) from the current goals.
| fGoalPos | Joint goal position (radians). |
| fGoalVel | Joint goal velocity (radians/second). |
Definition at line 662 of file hekKinJoint.cxx.
References lock(), nlspecifyMove(), and unlock().
|
virtual |
Stop movement and move control of the joint.
Definition at line 1144 of file hekKinJoint.cxx.
References hekateros::HEK_ECODE_DYNA, lock(), m_pServo, nlstop(), and unlock().
|
inlineprotected |
Unlock the joint kinematics.
The Hekateros kinematics thread will be available to run when accessing this joint.
Definition at line 888 of file hekKinJoint.h.
Referenced by act(), hekateros::HekKinJointWristRot::act(), applyTorqueControl(), move(), planMotion(), hekateros::HekKinJointWristRot::planMotion(), react(), hekateros::HekKinJointWristRot::react(), reload(), resetServoOdometer(), senseDynamics(), specifyMove(), and stop().
|
protectedvirtual |
Update joint velocity - servo speed association.
| fJointVel | Joint velocity (radians/second). |
| nServoSpeed | Servo speed (raw unitless). |
Reimplemented in hekateros::HekKinJointWristRot.
Definition at line 1259 of file hekKinJoint.cxx.
References m_tblVelSpeed, and hekateros::VelSpeedLookupTbl::update().
Referenced by senseDynamics().