Hekateros  3.4.3
RoadNarrows Robotics Robot Arm Project
hekKinJoint.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Hekateros
4 //
5 // Library: libhekateros
6 //
7 // File: hekKinJoint.h
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2015-02-10 13:39:03 -0700 (Tue, 10 Feb 2015) $
12  * $Rev: 3866 $
13  *
14  * \brief Hekateros powered joint kinematics and dynamics control class
15  * interface.
16  *
17  * \copyright
18  * \h_copy 2014-2018. RoadNarrows LLC.\n
19  * http://www.roadnarrows.com\n
20  * All Rights Reserved
21  */
22 /*
23  * @EulaBegin@
24  *
25  * Unless otherwise stated explicitly, all materials contained are copyrighted
26  * and may not be used without RoadNarrows LLC's written consent,
27  * except as provided in these terms and conditions or in the copyright
28  * notice (documents and software) or other proprietary notice provided with
29  * the relevant materials.
30  *
31  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY
32  * MEMBERS/EMPLOYEES/CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE
33  * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
34  * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
35  * DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN
36  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  *
38  * THE AUTHORS AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
39  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
40  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
41  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
42  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
43  *
44  * @EulaEnd@
45  */
46 ////////////////////////////////////////////////////////////////////////////////
47 
48 #ifndef _HEK_KIN_JOINT_H
49 #define _HEK_KIN_JOINT_H
50 
51 #include <sys/time.h>
52 #include <time.h>
53 #include <pthread.h>
54 
55 #include <vector>
56 #include <deque>
57 
58 #include "rnr/rnrconfig.h"
59 #include "rnr/log.h"
60 
61 #include "Dynamixel/Dynamixel.h"
62 #include "Dynamixel/DynaError.h"
63 #include "Dynamixel/DynaTypes.h"
64 #include "Dynamixel/DynaPid.h"
65 #include "Dynamixel/DynaServo.h"
66 
67 #include "Hekateros/hekateros.h"
68 #include "Hekateros/hekJoint.h"
69 #include "Hekateros/hekPid.h"
70 #include "Hekateros/hekUtils.h"
71 
72 //
73 // Define or undef for
74 //
75 #define HEK_KIN_EXEC_ALG_SYNC ///< synchronous move execution algorithm
76 
77 #ifdef HEK_KIN_EXEC_ALG_SYNC
78 #undef HEK_KIN_EXEC_ALG_INDIV ///< individual move execution algorithm
79 #else
80 #define HEK_KIN_EXEC_ALG_INDIV ///< individual move execution algorithm
81 #endif // HEK_KIN_EXEC_ALG_SYNC
82 
83 
84 namespace hekateros
85 {
86  // ---------------------------------------------------------------------------
87  // SyncMoveMsgs
88  // ---------------------------------------------------------------------------
89 
90  /*!
91  * \brief Container class to hold Dynamixel synchronous messages data.
92  */
94  {
95  public:
96  /*!
97  * \brief Default constructor.
98  */
99  SyncMoveMsgs();
100 
101  /*!
102  * \brief Destructor.
103  */
104  virtual ~SyncMoveMsgs()
105  {
106  }
107 
108  /*!
109  * \brief Clear sync messages.
110  */
111  void clear();
112 
113  /*!
114  * \brief Add servo speed to speed tuple array.
115  *
116  * \param nServoId Servo id.
117  * \param nServoSpeed Servo speed (raw unitless).
118  *
119  * \return
120  * On success, returns index of added tuple of speed tuple array.
121  * On failures, -1.
122  */
123  int addSpeed(int nServoId, int nServoSpeed);
124 
125  /*!
126  * \brief Add servo position to position tuple array.
127  *
128  * \param nServoId Servo id.
129  * \param nServoPos Servo position (odometer ticks).
130  *
131  * \return
132  * On success, returns index of added tuple of position tuple array.
133  * On failures, -1.
134  */
135  int addOdPos(int nServoId, int nServoPos);
136 
137  /*!
138  * \brief Get the number of added speed tuples to speed tuple array.
139  *
140  * \return Count.
141  */
143  {
144  return m_uSpeedTupCount;
145  }
146 
147  /*!
148  * \brief Get the speed tuple array.
149  *
150  * \return Pointer.
151  */
152  DynaSpeedTuple_T *getSpeedTuples()
153  {
154  return m_tupSpeed;
155  }
156 
157  /*!
158  * \brief Get the number of added position tuples to position tuple array.
159  *
160  * \return Count.
161  */
163  {
164  return m_uOdPosTupCount;
165  }
166 
167  /*!
168  * \brief Get the position tuple array.
169  *
170  * \return Pointer.
171  */
172  DynaPosTuple_T *getOdPosTuples()
173  {
174  return m_tupOdPos;
175  }
176 
177  protected:
178  DynaSpeedTuple_T m_tupSpeed[DYNA_ID_NUMOF]; ///< speed tuple array
179  uint_t m_uSpeedTupCount; ///< speed tuple count
180  DynaPosTuple_T m_tupOdPos[DYNA_ID_NUMOF]; ///< position tuple array
181  uint_t m_uOdPosTupCount; ///< positon tuple count
182  };
183 
184 
185  // ---------------------------------------------------------------------------
186  // VelSpeedTuple
187  // ---------------------------------------------------------------------------
188 
189  /*!
190  * \brief Joint velocity to servo speed tuple class
191  *
192  * For each measured joint velocity (radians/second) the associated servo
193  * speed (raw unitless) has been read.
194  */
196  {
197  public:
198  double m_fJointVel; ///< joint velocity (radians/second)
199  int m_nServoSpeed; ///< associated servo speed (raw unitless)
200 
201  /*!
202  * \brief Default constructor.
203  */
204  VelSpeedTuple();
205 
206  /*!
207  * \brief Initialization constructor.
208  */
209  VelSpeedTuple(const double fJointVel, const int nServoSpeed);
210 
211  /*!
212  * \brief Copy constructor.
213  *
214  * \param src Source object to copy.
215  */
216  VelSpeedTuple(const VelSpeedTuple &src);
217 
218  /*!
219  * \brief Destructor.
220  */
222  {
223  }
224 
225  /*!
226  * \brief Assignment operator.
227  *
228  * \param rhs Right hand side object.
229  *
230  * \return Returns copy of this.
231  */
232  VelSpeedTuple operator=(const VelSpeedTuple &rhs);
233  };
234 
235 
236  // ---------------------------------------------------------------------------
237  // VelSpeedLookupTbl Class
238  // ---------------------------------------------------------------------------
239 
240  /*!
241  * \brief Joint velocity/ servo speed lookup table class.
242  *
243  * A table of associated joint velocities to servo speed is dynamically built
244  * and updated to provide:
245  * \li Good estimates of servo speed given the goal velocity through linear
246  * interpolation.
247  * \li Adaptive kinodynamics.
248  */
250  {
251  public:
252  /*! \brief Velocity-speed table type. */
253  typedef std::vector<VelSpeedTuple> VelSpeedTbl;
254 
255  /*! \brief No table entry value. */
256  static const int NO_ENTRY = -1;
257 
258  /*! \brief Minimum servo speed for non-zero velocities. */
259  static const int MIN_NON_ZERO_SPEED = 10;
260 
261  /*!
262  * \brief Default constructor.
263  */
265 
266  /*!
267  * \brief Destructor.
268  */
270  {
271  }
272 
273  /*!
274  * \brief Assignment operator.
275  *
276  * \param rhs Right hand side object.
277  *
278  * \return Returns copy of this.
279  */
280  VelSpeedLookupTbl operator=(const VelSpeedLookupTbl &rhs);
281 
282  /*!
283  * \brief Create lookup table.
284  *
285  * \param fJointMaxVel Joint maximum velocity (radians/second).
286  * \param fBucketSize Table bucket size (radians/second).
287  */
288  void create(double fJointMaxVel, double fBucketSize);
289 
290  /*!
291  * \brief Hash joint velocity to table index.
292  *
293  * \param fJointVel Joint velocity (radians/second).
294  *
295  * \return Table index.
296  */
297  int hash(double fJointVel);
298 
299  /*!
300  * \brief Update lookup table entry.
301  *
302  * \param fJointVel Joint velocity (radians/second).
303  * \param nServoSpeed Servo speed (raw unitless).
304  */
305  void update(double fJointVel, int nServoSpeed);
306 
307  /*!
308  * \brief Estimate servo goal speed.
309  *
310  * Linear interpolation is performed between the two nearest neighbors in
311  * the lookup table.
312  *
313  * \param fJointGoalVel Joint goal velocity (radians/second).
314  *
315  * \return Servo speed estimate.
316  */
317  int estimate(double fJointGoalVel);
318 
319  /*!
320  * \brief Get the lookup table fixed size.
321  *
322  * \return int
323  */
325  {
326  return (int)m_tbl.size();
327  }
328 
329  /*!
330  * \brief Get the number of populated entries in lookup table.
331  *
332  * \return int
333  */
335  {
336  return m_nNumEntries;
337  }
338 
339  /*!
340  * \brief Enable table debugging.
341  *
342  * Debugging is printed to stderr.
343  *
344  * \param strId Debug identification string.
345  */
346  void enableDebugging(const std::string &strId);
347 
348  /*!
349  * \brief Disable table debugging.
350  */
351  void disableDebugging();
352 
353  /*!
354  * \brief Dump lookup table entries.
355  *
356  * Debugging is printed to stderr.
357  *
358  * \param strId Debug identification string.
359  */
360  void dumpTable(const std::string &strId);
361 
362  protected:
363  double m_fBucketSize; ///< table entry size (degrees/second)
364  int m_nMaxIndex; ///< maximum index into table
365  int m_nNumEntries; ///< number of populated table entries.
366  VelSpeedTbl m_tbl; ///< dynamic interpolation table
367  std::string m_strDbgId; ///< debugging id
368  bool m_bDbg; ///< enable [disable] debugging
369  };
370 
371 
372  // ---------------------------------------------------------------------------
373  // HekKinJoint Class
374  // ---------------------------------------------------------------------------
375 
376  /*!
377  * \brief Hekateros powered joint dynamics and kinematics control class.
378  *
379  * One or more motors can power a joint. Two or more joints may be coupled
380  * (e.g. wrist pitch and rotation).
381  * Motors can be actuators with built in controllers, DC motors, synthetic
382  * muscle, or any other physical entity that can provide usefull force and be
383  * controlled.
384  *
385  * Currently, only Dynamixels actuators (servos) are supported.
386  */
388  {
389  public:
390  /*!
391  * \brief Position sliding window size for low-pass band filtering of input
392  * positions.
393  */
394  static const size_t POS_WIN_SIZE = 6;
395 
396  /*!
397  * \brief Delta t sliding window size for low-pass band filtering of input
398  * delta times.
399  */
400  static const size_t DT_WIN_SIZE = 10;
401 
402  /*!
403  * \brief Velocity sliding window size for low-pass band filtering of input
404  * Velocities.
405  */
406  static const size_t VEL_WIN_SIZE = 6;
407 
408  /*!
409  * \brief Stop delta v as a fraction of max_delta_v tune parameter
410  */
411  static const double SLOW_DERATE_DELTA_V;
412 
413  /*!
414  * \brief Torque sliding window size for low-pass band filtering of input
415  * torques.
416  */
417  static const size_t TORQUE_WIN_SIZE = 4;
418 
419  /*!
420  * \brief Torque control backoff speed (raw unitless)
421  */
422  static const int TORQUE_CTL_BACKOFF_SPEED = 100;
423 
424  /*!
425  * \brief Torque control backoff positon (odometer ticks)
426  */
427  static const int TORQUE_CTL_BACKOFF_POS = 5;
428 
429  /*!
430  * \brief Kinedynamics joint position and velocity control states.
431  *
432  * \note Actively apply torque control in an over torque condition is
433  * somewhat independent of the control states.
434  */
436  {
437  MoveStateIdle, ///< no active goal or stopping control
438  MoveStateNewMove, ///< start move to new goal
439  MoveStateMoving, ///< actively moving to goal
440  MoveStateStopping, ///< actively stopping joint
441  };
442 
443  /*!
444  * \brief Default constructor.
445  */
446  HekKinJoint();
447 
448  /*!
449  * \brief Initialization constructor.
450  *
451  * \param pJoint Pointer to joint description.
452  * \param pServo Pointer to master servo controller.
453  * \param tunes Hekateros tuning parameters.
454  */
455  HekKinJoint(HekRobotJoint *pJoint,
456  DynaServo *pServo,
457  const HekTunes &tunes);
458 
459  /*!
460  * \brief Copy constructor.
461  *
462  * \param src Source object.
463  */
464  //HekKinJoint(const HekKinJoint &src);
465 
466  /*!
467  * \brief Destructor.
468  */
469  virtual ~HekKinJoint()
470  {
471  nlstop();
472  pthread_mutex_destroy(&m_mutexSync);
473  }
474 
475  /*!
476  * \brief Couple joint.
477  *
478  * \param pKinJointCoupled Base class joint has no coupled joint.
479  */
480  virtual void coupleJoint(HekKinJoint *)
481  {
482  // N/A
483  }
484 
485  /*!
486  * \brief Assignment operator.
487  *
488  * \param rhs Right hand side object.
489  *
490  * \return *this
491  */
492  HekKinJoint &operator=(const HekKinJoint &rhs);
493 
494  /*!
495  * \brief Reload configuration tuning parameters.
496  *
497  * \param tunes Hekateros tuning parameters.
498  */
499  virtual void reload(const HekTunes &tunes);
500 
501 
502  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
503  // Attribute and State Methods
504  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
505 
506  /*!
507  * \brief Get move control state for this joint.
508  *
509  * \return MoveState
510  */
512  {
513  return m_eState;
514  }
515 
516  /*!
517  * \brief Test if actively moving joint to goal.
518  *
519  * \return Returns true or false.
520  */
522  {
523  return m_eState == MoveStateNewMove || m_eState == MoveStateMoving;
524  }
525 
526  /*!
527  * \brief Test if actively stopping joint.
528  *
529  * \return Returns true or false.
530  */
531  bool isStopping()
532  {
533  return m_eState == MoveStateStopping;
534  }
535 
536  /*!
537  * \brief Test if actively moving joint.
538  *
539  * \return Returns true or false.
540  */
541  bool isMoving()
542  {
543  return isMovingToGoal() || isStopping();
544  }
545 
546  /*!
547  * \brief Test if joint is stopped (i.e. control is not active).
548  *
549  * \return Returns true if stopped, false otherwise.
550  */
551  virtual bool isStopped()
552  {
553  return m_eState == MoveStateIdle;
554  }
555 
556  /*!
557  * \brief Test if can stop now without slowing down.
558  *
559  * \return Returns true or false.
560  */
561  bool canStopNow()
562  {
563  return (m_pJoint->m_eOpState != HekOpStateCalibrated) ||
564  (m_fStopVelTh == HekTunePidDeltaVNoMax) ||
565  (fabs(m_fJointCurVel) <= m_fStopVelTh);
566  }
567 
568  /*!
569  * \brief Get the joint's position and velocity PID K parameters.
570  *
571  * \param [out] fKp Proportional gain parameter.
572  * \param [out] fKi Integral gain parameter.
573  * \param [out] fKd Derivative gain parameter.
574  */
575  void getPidKParams(double &fKp, double &fKi, double &fKd) const
576  {
577  m_pid.getKParams(fKp, fKi, fKd);
578  }
579 
580  /*!
581  * \brief Set the joint's position and velocity PID K parameters.
582  *
583  * \param [in] fKp Proportional gain parameter.
584  * \param [in] fKi Integral gain parameter.
585  * \param [in] fKd Derivative gain parameter.
586  *
587  * \return
588  */
589  void setPidKParams(const double fKp, const double fKi, const double fKd)
590  {
591  m_pid.setKParams(fKp, fKi, fKd);
592  }
593 
594  /*!
595  * \brief Get joint PID maximum delta v (radians/second) parameter.
596  *
597  * \return Maximum output delta velocity (radians/second).
598  */
599  double getPidMaxDeltaVParam() const
600  {
601  return m_pid.getMaxDeltaVParam();
602  }
603 
604  /*!
605  * \brief Set joint PID maximum delta v (radians/second) parameter.
606  *
607  * \param fMaxDeltaV Maximum output delta velocity (radians/second).
608  */
609  void setPidMaxDeltaVParam(const double fMaxDeltaV)
610  {
611  m_pid.setMaxDeltaVParam(fMaxDeltaV);
612  }
613 
614  /*!
615  * \brief Get the position and velocity tolerance parameters.
616  *
617  * The joint PID will try to control to the goal position \h_plusmn position
618  * tolerance and to the goal velocity \h_plusmn velocity tolerance.
619  *
620  * \param [out] fTolPos Joint position tolerance (radians).
621  * \param [out] fTolVel Joint velocity tolerance (radians/second).
622  */
623  void getToleranceParams(double &fTolPos, double &fTolVel) const
624  {
625  fTolPos = m_fTolPos;
626  fTolVel = m_fTolVel;
627  }
628 
629  /*!
630  * \brief Set the position and velocity tolerance parameters.
631  *
632  * The joint PID will try to control to the goal position \h_plusmn position
633  * tolerance and to the goal velocity \h_plusmn velocity tolerance.
634  *
635  * \param [in] fTolPos Joint position tolerance (radians).
636  * \param [in] fTolVel Joint velocity tolerance (radians/second).
637  */
638  void setToleranceParams(const double fTolPos, const double fTolVel)
639  {
640  m_fTolPos = fTolPos;
641  m_fTolVel = fTolVel;
642  }
643 
644  /*!
645  * \brief Get the instantaneous current joint position and velocity.
646  *
647  * \param [out] fCurPos Current joint position (radians).
648  * \param [out] fCurVel Current joint velocity (radians/second).
649  */
650  void getJointCurPosVel(double &fCurPos, double &fCurVel) const
651  {
652  fCurPos = m_fJointCurPos;
653  fCurVel = m_fJointCurVel;
654  }
655 
656  /*!
657  * \brief Get the smoothed (filtered) current joint position and velocity.
658  *
659  * \param [out] fCurPos Current joint position (radians).
660  * \param [out] fCurVel Current joint velocity (radians/second).
661  */
662  void getFilteredJointCurPosVel(double &fCurPos, double &fCurVel) const
663  {
664  fCurPos = m_fJointPosOut;
665  fCurVel = m_fJointVelOut;
666  }
667 
668  /*!
669  * \brief Get the instantaneous current servo position and speed.
670  *
671  * \param [out] nServoCurPos Current servo position (odometer ticks).
672  * \param [out] nServoCurSpeed Current servo velocity (raw unitless).
673  */
674  void getServoCurPosSpeed(int &nServoCurPos, int &nServoCurSpeed) const
675  {
676  nServoCurPos = m_nServoCurPos;
677  nServoCurSpeed = m_nServoCurSpeed;
678  }
679 
680  /*!
681  * \brief Get the PID output target joint velocity and the corresponding
682  * servo speed estemate.
683  *
684  * \param [out] fTgtVel Target joint velocity (radians/second).
685  * \param [out] nTgtSpeed Target servo speed (raw unitless).
686  */
687  void getTgtVelSpeed(double &fTgtVel, int &nTgtSpeed) const
688  {
689  fTgtVel = m_fJointTgtVel;
690  nTgtSpeed = m_nServoTgtSpeed;
691  }
692 
693  /*!
694  * \brief Test if joint is in an over torque condition.
695  *
696  * \return Returns true if in condition, false otherwise.
697  */
698  virtual bool hasOverTorqueCondition()
699  {
700  return m_bOverTorqueCond;
701  }
702 
703  /*!
704  * \brief Convert joint position to the equivalent servo position.
705  *
706  * \param fPos Joint position (radians).
707  *
708  * \return Equivalent servo position (odometer ticks).
709  */
710  virtual int jointPosToServoPos(const double fPos);
711 
712  /*!
713  * \brief Convert servo position to the equivalent joint position.
714  *
715  * \param nOdPos Servo position (odometer ticks).
716  *
717  * \return Equivalent joint position (radian).
718  */
719  virtual double servoPosToJointPos(const int nOdPos);
720 
721 
722  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
723  // Kinodynamics Methods
724  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
725 
726  /*!
727  * \brief Reset servo odometer zero point to the current encoder position.
728  *
729  * \copydoc doc_return_std
730  */
731  virtual int resetServoOdometer();
732 
733  /*!
734  * \brief Specify a new joint goal position and velocity move.
735  *
736  * The joint PID will begin to control to the new goals, smoothly
737  * transitioning (I hope) from the current goals.
738  *
739  * \param fGoalPos Joint goal position (radians).
740  * \param fGoalVel Joint goal velocity (radians/second).
741  *
742  * \copydoc doc_return_std
743  */
744  int specifyMove(const double fGoalPos, const double fGoalVel);
745 
746  /*!
747  * \brief Sense (read) the current servo dynamics and transform to useful
748  * state.
749  *
750  * \param bIsControlling Joint is [not] being actively controlled.
751  *
752  * \copydoc doc_return_std
753  */
754  virtual int senseDynamics(bool bIsControlling);
755 
756  /*!
757  * \brief React to recently read sensor data.
758  *
759  * \param bIsControlling Joint is [not] being actively controlled.
760  * However, reaction may still be desired.
761  * \param msgs Synchronous move messages container object.
762  *
763  * \copydoc doc_return_std
764  */
765  virtual int react(bool bIsControlling, SyncMoveMsgs &msgs);
766 
767  /*!
768  * \brief Plan motion.
769  *
770  * \param bIsControlling Joint is [not] being actively controlled.
771  * However, planning may still be desired.
772  * \param msgs Synchronous move messages container object.
773  *
774  * \return Move control state after call.
775  */
776  virtual MoveState planMotion(bool bIsControlling, SyncMoveMsgs &msgs);
777 
778  /*!
779  * \brief Act (write) to effect the servo dynamics for torque and motion
780  * control.
781  *
782  * \copydoc doc_return_std
783  */
784  virtual int act();
785 
786  /*!
787  * \brief Apply torque limit control.
788  *
789  * \copydoc doc_return_std
790  */
791  virtual int applyTorqueControl();
792 
793  /*!
794  * \brief Move joint using joint PID controller.
795  *
796  * Once the move has reached the goal joint position, within tolerence,
797  * the move will automatically stop.
798  *
799  * \return Move control state after call.
800  */
801  virtual MoveState move();
802 
803  /*!
804  * \brief Stop movement and move control of the joint.
805  *
806  * \copydoc doc_return_std
807  */
808  virtual int stop();
809 
810  protected:
811  // base
812  MoveState m_eState; ///< joint control state
813  pthread_mutex_t m_mutexSync; ///< synchonization mutex
814  HekRobotJoint* m_pJoint; ///< joint description
815  DynaServo* m_pServo; ///< joint master servo control
816 
817  // joint tolerances, thresholds, and pid
818  double m_fTolPos; ///< joint position \h_plusmn tolerance (rads)
819  double m_fTolVel; ///< joint velocity \h_plusmn tolerance (rads/s)
820  double m_fStopVelTh; ///< joint velocity threshold to safely stop move
821  HekPid m_pid; ///< joint position and velocity PID
822 
823  // position state
824  double m_fJointRadPerTick; ///< joint radians / odometer tick
825  double m_fJointGoalPos; ///< joint goal position (radians)
826  int m_nServoGoalPos; ///< servo goal position (odometer ticks)
827  double m_fJointCurPos; ///< joint current position (radians)
828  int m_nServoCurPos; ///< servo current position (odometer ticks)
829  double m_fJointPrevPos; ///< joint current position (radians)
830  int m_nServoPrevPos; ///< servo previous pos (odometer ticks)
831  double m_fJointPosOut; ///< low-pass filtered joint cur position
832  std::deque<double> m_histPosIn; ///< recent history of joint positions
833 
834  // time
835  double m_fDt; ///< delta time between positions reads
836  struct timespec m_tsPrev; ///< previous time mark
837  double m_fDtAvg; ///< average delta t
838  std::deque<double> m_histDtIn; ///< sliding window of delta t's
839 
840  // velocity state
841  double m_fJointGoalVel; ///< joint goal velocity (radians/second)
842  double m_fJointCurVel; ///< joint current velocity (radians/second)
843  int m_nServoCurSpeed; ///< current motor speed (raw unitless)
844  double m_fVelDerate; ///< joint velocity derate (normalized)
845  VelSpeedLookupTbl m_tblVelSpeed; ///< dynamic velocity/speed lookup table
846  double m_fJointVelOut; ///< low-pass filtered joint cur velocity
847  std::deque<double> m_histVelIn; ///< sliding window of current velocities
848 
849  // pid output state
850  double m_fJointTgtVel; ///< joint target velocity (radians/second)
851  int m_nServoTgtSpeed; ///< target motor speed (raw unitless)
852 
853  // torque state
854  bool m_bOverTorqueCond; ///< is [not] in torque overload condition
855  double m_fOverTorqueTh; ///< set over torque condition threshold
856  double m_fClearTorqueTh; ///< clear over torque condition threshold
857  int m_nServoCurLoad; ///< servo current load (raw unitless)
858  double m_fTorqueOut; ///< low-pass filtered torque
859  std::deque<double> m_histTorqueIn; ///< recent history of joint torques
860 
861  /*!
862  * \brief Lock the joint kinematics.
863  *
864  * The calling thread will block while waiting for the mutex to become
865  * available. Once locked, the Hekateros kinematics thread will block when
866  * accessing this joint.
867  *
868  * The lock()/unlock() primitives provide a safe mechanism to modify the
869  * joint data, such as the next goals.
870  *
871  * \par Context:
872  * Any.
873  */
874  void lock()
875  {
876  pthread_mutex_lock(&m_mutexSync);
877  }
878 
879  /*!
880  * \brief Unlock the joint kinematics.
881  *
882  * The Hekateros kinematics thread will be available to run when accessing
883  * this joint.
884  *
885  * \par Context:
886  * Any.
887  */
888  void unlock()
889  {
890  pthread_mutex_unlock(&m_mutexSync);
891  }
892 
893  /*!
894  * \brief Calculate the delta time between calls to this.
895  *
896  * \return Delta time secs.frac (seconds).
897  */
898  double delta_t();
899 
900  /*!
901  * \brief Apply a running average for the delta times (seconds).
902  *
903  * A simple moving average (SMa) of delta times with a window size of
904  * \ref DT_WIN_SIZE is used.
905  *
906  * \param fDtAvg Current delta time average (seconds).
907  * \param fDt New delta time (seconds).
908  *
909  * \return New average delta time (seconds).
910  */
911  double averageDt(double fDtAvg, double fDt);
912 
913  /*!
914  * \brief De-jitter servo odometer position.
915  *
916  * The servo can report encoder position of \plusmn 1.
917  *
918  * \param nServoCurPos Servo current odometer position.
919  * \param nServoPrevPos Servo previous odometer position.
920  *
921  * \return Return de-jittered current servo position.
922  */
923  int dejitterServoPos(int nServoCurPos, int nServoPrevPos);
924 
925  /*!
926  * \brief Apply a low-pass band filter on the joint positions (radians).
927  *
928  * A simple moving average (SMA) of positions with a window size of
929  * \ref POS_WIN_SIZE is used as the filter.
930  *
931  * \param fPosAvg Current joint position average (radians).
932  * \param fJointPos New joint position (radians).
933  *
934  * \return New filtered joint position (radians).
935  */
936  double filterPositions(double fPosAvg, double fJointPos);
937 
938  /*!
939  * \brief Apply a low-pass band filter on the joint velocities
940  * (radians/second).
941  *
942  * A simple moving average (SMA) of velocities with a window size of
943  * \ref VEL_WIN_SIZE is used as the filter.
944  *
945  * \param fVelAvg Current joint velocitie average (radians/second).
946  * \param fJointVel New joint velocity (radians/second).
947  *
948  * \return New filtered joint velocity (radians/second).
949  */
950  double filterVelocities(double fVelAvg, double fJointVel);
951 
952  /*!
953  * \brief Apply a low-pass band filter on the sensed torques (loads).
954  *
955  * The torques are interpreted from the read servo loads which are unitless
956  * values (and probably non-linear).
957  *
958  * A simple moving average (SMA) of load values with a window size of
959  * \ref TORQUE_WIN_SIZE is used as the filter.
960  *
961  * \param fTorqueAvg Current torque (load) average value.
962  * \param nServoLoad New servo load value (raw unitless).
963  *
964  * \return New torque average (raw unitless).
965  */
966  double filterTorques(double fTorqueAvg, int nServoLoad);
967 
968  /*!
969  * \brief Get the current goal rotation direction.
970  *
971  * The direction is deterimed by the difference of current odometer value
972  * and the goal position.
973  *
974  * Normally counter-clockwise is positive, clockwise is negative, but the
975  * sence can be reversed in the odometer configuration.
976  *
977  * \return 1 or -1.
978  */
979  int getGoalDir();
980 
981  /*!
982  * \brief Get the planned target rotation direction.
983  *
984  * The direction is deterimed sign of the servo speed.
985  *
986  * Normally counter-clockwise is positive, clockwise is negative, but the
987  * sence can be reversed in the odometer configuration.
988  *
989  * \param nServoTgtSpeed Planned servo target speed (raw unitless).
990  * Odometer configuration is already added!
991  *
992  * \return 1 or -1.
993  */
994  int getPlannedDir(int nServoTgtSpeed);
995 
996  /*!
997  * \brief Test if joint can move in direction of goal position.
998  *
999  * The joint must not be in an over torque condition or the move will ease
1000  * the torque, not exacerbate the condition.
1001  *
1002  * \return Returns true or false.
1003  */
1004  bool canMoveInGoalDir();
1005 
1006  /*!
1007  * \brief Test if joint can move in planned direction.
1008  *
1009  * The joint must not be in an over torque condition or the move will ease
1010  * the torque, not worsen the condition.
1011  *
1012  * \param nServoTgtSpeed Planned servo target speed (raw unitless).
1013  *
1014  * \return Returns true or false.
1015  */
1016  bool canMoveInPlannedDir(int nServoTgtSpeed);
1017 
1018  /*!
1019  * \brief Calculate the joint velocity from delta servo positions.
1020  *
1021  * \param fPos1 Later joint position (radians/second).
1022  * \param fPos0 Earlier joint position (radians/second).
1023  * \param fDt Delta time in seconds.
1024  *
1025  * \return Calculated joint velocity (radians).
1026  */
1027  virtual double jointVelocity(double fPos1, double fPos0, double fDt);
1028 
1029  /*!
1030  * \brief Update joint velocity - servo speed association.
1031  *
1032  * \param fJointVel Joint velocity (radians/second).
1033  * \param nServoSpeed Servo speed (raw unitless).
1034  */
1035  virtual void updateAssoc(double fJointVel, int nServoSpeed);
1036 
1037  /*!
1038  * \brief Estimate of target servo speed from target joint velocity.
1039  *
1040  * The Dynamixel speed value is a raw, unitless (and probably non-linear)
1041  * value. The estimate is made using linear interpolation from a dynamically
1042  * maintained velocity,speed lookup table.
1043  *
1044  * \param fJointTgtVel Target joint velocity (radians/seconds).
1045  *
1046  * \return Servo speed estimate matching target velocity.
1047  */
1048  virtual int estimateServoTgtSpeed(double fJointTgtVel);
1049 
1050  /*!
1051  * \brief Simple estimate of target servo speed from target joint velocity.
1052  *
1053  * The Dynamixel speed value is a raw, unitless (and probably non-linear)
1054  * value. The estimate is made by interpolating the current
1055  * speed between 0 and the maximum unloaded joint velocity.
1056  *
1057  * \param fJointTgtVel Target joint velocity (radians/seconds).
1058  *
1059  * \return Servo speed estimate matching target velocity.
1060  */
1061  virtual int estimateServoTgtSpeedSimple(double fJointTgtVel);
1062 
1063  /*!
1064  * \brief Move servo.
1065  *
1066  * \param nServoGoalSpeed Servo goal speed (raw unitless).
1067  * \param nServoGoalPos Servo goal position (odometer ticks).
1068  * \param bNewMove This is [not] a new move.
1069  */
1070  void moveServo(int nServoGoalSpeed, int nServoGoalPos);
1071 
1072 
1073  /*!
1074  * \brief Add servo to synchronous move message(s).
1075  *
1076  * \param msgs Synchronous move messages container object.
1077  * \param nServoGoalSpeed Servo goal speed (raw unitless).
1078  * \param nServoGoalPos Servo goal position (odometer ticks).
1079  */
1080  void addServoMsgEntries(SyncMoveMsgs &msg,
1081  int nServoGoalSpeed,
1082  int nServoGoalPos);
1083 
1084  /*!
1085  * \brief Specify a new joint goal position and velocity move
1086  * (no lock version).
1087  *
1088  * The joint PID will begin to control to the new goals, smoothly
1089  * transitioning (I hope) from the current goals.
1090  *
1091  * \param fGoalPos Joint goal position (radians).
1092  * \param fGoalVel Joint goal velocity (radians/second).
1093  *
1094  * \copydoc doc_return_std
1095  */
1096  virtual int nlspecifyMove(const double fGoalPos, const double fGoalVel);
1097 
1098  /*!
1099  * \brief Apply torque limit control (no lock version).
1100  *
1101  * \copydoc doc_return_std
1102  */
1103  virtual int nlapplyTorqueControl();
1104 
1105  /*!
1106  * \brief Move joint using joint PID controller (no lock version).
1107  *
1108  * Once the move has reached the goal joint position, within tolerence,
1109  * the move will automatically stop.
1110  *
1111  * \return Move control state after move call.
1112  */
1113  virtual MoveState nlmove();
1114 
1115  /*!
1116  * \brief Stop movement and move control of the joint (no lock version).
1117  *
1118  * \copydoc doc_return_std
1119  */
1120  virtual int nlstop();
1121 
1122  /*!
1123  * \brief Slow to stop (no lock version).
1124  *
1125  * \param msgs Synchronous move messages container object.
1126  *
1127  * \copydoc doc_return_std
1128  */
1129  virtual int nlslowToStop(SyncMoveMsgs &msg);
1130  };
1131 
1132 
1133  // ---------------------------------------------------------------------------
1134  // HekKinJointWristRot Class
1135  // ---------------------------------------------------------------------------
1136 
1137  /*!
1138  * \brief Special wrist rotation joint kinematics and dynamics class.
1139  *
1140  * The Hekateros wrist joints are coupled in that wrist pitch effect wrist
1141  * rotation. This class "decouples" these joints in software.
1142  */
1144  {
1145  public:
1146  /*!
1147  * \brief Default constructor.
1148  */
1150  {
1151  m_pKinJointWristPitch = NULL;
1152  m_eStateWristPitch = MoveStateIdle;
1153  }
1154 
1155  /*!
1156  * \brief Initialization constructor.
1157  *
1158  * \param pJoint Pointer to joint description.
1159  * \param pServo Pointer to master servo controller.
1160  * \param tunes Hekateros tuning parameters.
1161  */
1163  DynaServo *pServo,
1164  const HekTunes &tunes) :
1165  HekKinJoint(pJoint, pServo, tunes)
1166  {
1167  m_pKinJointWristPitch = NULL;
1168  m_eStateWristPitch = MoveStateIdle;
1169  }
1170 
1171  /*!
1172  * \brief Destructor.
1173  */
1175  {
1176  }
1177 
1178  /*!
1179  * \brief Assignment operator.
1180  *
1181  * \param rhs Right hand side object.
1182  *
1183  * \return *this
1184  */
1186  {
1187  m_pKinJointWristPitch = rhs.m_pKinJointWristPitch;
1188  m_eStateWristPitch = rhs.m_eStateWristPitch;
1189 
1190  return *this;
1191  }
1192 
1193  /*!
1194  * \brief Couple joint.
1195  *
1196  * \param pKinJointWristPitch Wrist pitch joint kinematics.
1197  */
1198  virtual void coupleJoint(HekKinJoint *pKinJointWristPitch)
1199  {
1200  m_pKinJointWristPitch = pKinJointWristPitch;
1201  if( m_pKinJointWristPitch != NULL )
1202  {
1203  m_eStateWristPitch = m_pKinJointWristPitch->getMoveState();
1204  }
1205  }
1206 
1207  /*!
1208  * \brief React to recently read sensor data.
1209  *
1210  * \param bIsControlling Joint is [not] being actively controlled.
1211  * However, reaction may still be desired.
1212  * \param msgs Synchronous move messages container object.
1213  *
1214  * \copydoc doc_return_std
1215  */
1216  virtual int react(bool bIsControlling, SyncMoveMsgs &msgs);
1217 
1218  /*!
1219  * \brief Plan motion.
1220  *
1221  * \param bIsControlling Joint is [not] being actively controlled.
1222  * However, planning may still be desired.
1223  * \param msgs Synchronous move messages container object.
1224  *
1225  * \return Move control state after call.
1226  */
1227  virtual MoveState planMotion(bool bIsControlling, SyncMoveMsgs &msgs);
1228 
1229  /*!
1230  * \brief Act (write) to effect the servo dynamics for torque and motion
1231  * control.
1232  *
1233  * Since the wrist rotation is coupled to wrist pitch, if the pitch is
1234  * moving, so must the rotation.
1235  *
1236  * \copydoc doc_return_std
1237  */
1238  virtual int act();
1239 
1240  /*!
1241  * \brief Convert joint position to the equivalent servo position.
1242  *
1243  * Adjust for wrist pitch.
1244  *
1245  * \param fPos Joint position (radians).
1246  *
1247  * \return Equivalent servo position (odometer ticks).
1248  */
1249  virtual int jointPosToServoPos(double fPos);
1250 
1251  /*!
1252  * \brief Convert servo position to the equivalent joint position.
1253  *
1254  * Adjust for wrist pitch.
1255  *
1256  * \param nOdPos Servo position (odometer ticks).
1257  *
1258  * \return Equivalent joint position (radian).
1259  */
1260  virtual double servoPosToJointPos(int nOdPos);
1261 
1262  protected:
1263  HekKinJoint *m_pKinJointWristPitch; ///< wrist pitch joint description
1264  MoveState m_eStateWristPitch; ///< joint control state
1265 
1266  /*!
1267  * \brief Update joint velocity - servo speed association.
1268  *
1269  * Adjustment is made for wrist pitch current velocity.
1270  *
1271  * \param fJointVel Joint velocity (radians/second).
1272  * \param nServoSpeed Servo speed (raw unitless).
1273  */
1274  virtual void updateAssoc(double fJointVel, int nServoSpeed);
1275 
1276  /*!
1277  * \brief Get coupled joint's move state.
1278  *
1279  * \return State.
1280  */
1281  MoveState getCoupledJointState();
1282 
1283  /*!
1284  * \brief Test if coupled joint is stopped.
1285  *
1286  * \return Returns true if stopped, false otherwise.
1287  */
1288  virtual bool isCoupledJointStopped()
1289  {
1290  return getCoupledJointState() == MoveStateIdle;
1291  }
1292 
1293  /*!
1294  * \brief Test if coupled joint is moving.
1295  *
1296  * \return Returns true if moving, false otherwise.
1297  */
1298  virtual bool isCoupledJointMoving()
1299  {
1300  return !isCoupledJointStopped();
1301  }
1302 
1303  /*!
1304  * \brief Move joint using joint PID controller (no lock version).
1305  *
1306  * Once the move has reached the goal joint position, within tolerence,
1307  * the move will automatically stop.
1308  *
1309  * Since the wrist rotation is coupled to wrist pitch, if the pitch is
1310  * moving, so must the rotation.
1311  *
1312  * \return Move control state after call.
1313  */
1314  virtual MoveState nlmove();
1315 
1316  /*!
1317  * \brief Slow to stop (no lock version).
1318  *
1319  * Since the wrist rotation is coupled to wrist pitch, if the pitch is
1320  * moving, so must the rotation. Slowing down must take this coupled action
1321  * into account.
1322 
1323  * \param msgs Synchronous move messages container object.
1324  *
1325  * \copydoc doc_return_std
1326  */
1327  virtual int nlslowToStop(SyncMoveMsgs &msg);
1328  };
1329 
1330 } // namespace hekateros
1331 
1332 #endif // _HEK_KIN_JOINT_H
int addSpeed(int nServoId, int nServoSpeed)
Add servo speed to speed tuple array.
int getNumLookupTableEntries()
Get the number of populated entries in lookup table.
Definition: hekKinJoint.h:334
double m_fOverTorqueTh
set over torque condition threshold
Definition: hekKinJoint.h:855
int getLookupTableSize()
Get the lookup table fixed size.
Definition: hekKinJoint.h:324
DynaPosTuple_T m_tupOdPos[DYNA_ID_NUMOF]
position tuple array
Definition: hekKinJoint.h:180
double getPidMaxDeltaVParam() const
Get joint PID maximum delta v (radians/second) parameter.
Definition: hekKinJoint.h:599
VelSpeedTbl m_tbl
dynamic interpolation table
Definition: hekKinJoint.h:366
DynaSpeedTuple_T * getSpeedTuples()
Get the speed tuple array.
Definition: hekKinJoint.h:152
bool isMoving()
Test if actively moving joint.
Definition: hekKinJoint.h:541
double m_fVelDerate
joint velocity derate (normalized)
Definition: hekKinJoint.h:844
int m_nServoCurLoad
servo current load (raw unitless)
Definition: hekKinJoint.h:857
DynaPosTuple_T * getOdPosTuples()
Get the position tuple array.
Definition: hekKinJoint.h:172
static const double HekTunePidDeltaVNoMax
No maximum PID delta V output special value.
Definition: hekTune.h:319
std::deque< double > m_histPosIn
recent history of joint positions
Definition: hekKinJoint.h:832
double m_fStopVelTh
joint velocity threshold to safely stop move
Definition: hekKinJoint.h:820
uint_t getSpeedTupleCount()
Get the number of added speed tuples to speed tuple array.
Definition: hekKinJoint.h:142
HekRobotJoint * m_pJoint
joint description
Definition: hekKinJoint.h:814
~VelSpeedLookupTbl()
Destructor.
Definition: hekKinJoint.h:269
int m_nServoCurPos
servo current position (odometer ticks)
Definition: hekKinJoint.h:828
Operational robotic joint description class.
Definition: hekJoint.h:80
static const double SLOW_DERATE_DELTA_V
Stop delta v as a fraction of max_delta_v tune parameter.
Definition: hekKinJoint.h:411
DynaServo * m_pServo
joint master servo control
Definition: hekKinJoint.h:815
int m_nNumEntries
number of populated table entries.
Definition: hekKinJoint.h:365
double m_fJointVelOut
low-pass filtered joint cur velocity
Definition: hekKinJoint.h:846
int m_nServoCurSpeed
current motor speed (raw unitless)
Definition: hekKinJoint.h:843
int m_nServoGoalPos
servo goal position (odometer ticks)
Definition: hekKinJoint.h:826
std::deque< double > m_histTorqueIn
recent history of joint torques
Definition: hekKinJoint.h:859
HekKinJointWristRot()
Default constructor.
Definition: hekKinJoint.h:1149
double m_fTolPos
joint position &plusmn; tolerance (rads)
Definition: hekKinJoint.h:818
int m_nMaxIndex
maximum index into table
Definition: hekKinJoint.h:364
void lock()
Lock the joint kinematics.
Definition: hekKinJoint.h:874
int addOdPos(int nServoId, int nServoPos)
Add servo position to position tuple array.
std::string m_strDbgId
debugging id
Definition: hekKinJoint.h:367
pthread_mutex_t m_mutexSync
synchonization mutex
Definition: hekKinJoint.h:813
void unlock()
Unlock the joint kinematics.
Definition: hekKinJoint.h:888
Hekateros tuning data class.
Definition: hekTune.h:408
MoveState m_eState
joint control state
Definition: hekKinJoint.h:812
uint_t getOdPosTupleCount()
Get the number of added position tuples to position tuple array.
Definition: hekKinJoint.h:162
void getServoCurPosSpeed(int &nServoCurPos, int &nServoCurSpeed) const
Get the instantaneous current servo position and speed.
Definition: hekKinJoint.h:674
Container class to hold Dynamixel synchronous messages data.
Definition: hekKinJoint.h:93
int m_nServoTgtSpeed
target motor speed (raw unitless)
Definition: hekKinJoint.h:851
void setPidKParams(const double fKp, const double fKi, const double fKd)
Set the joint&#39;s position and velocity PID K parameters.
Definition: hekKinJoint.h:589
Hekateros powered joint dynamics and kinematics control class.
Definition: hekKinJoint.h:387
double m_fDt
delta time between positions reads
Definition: hekKinJoint.h:835
~VelSpeedTuple()
Destructor.
Definition: hekKinJoint.h:221
double m_fJointGoalPos
joint goal position (radians)
Definition: hekKinJoint.h:825
void getToleranceParams(double &fTolPos, double &fTolVel) const
Get the position and velocity tolerance parameters.
Definition: hekKinJoint.h:623
virtual ~HekKinJointWristRot()
Destructor.
Definition: hekKinJoint.h:1174
HekKinJoint * m_pKinJointWristPitch
wrist pitch joint description
Definition: hekKinJoint.h:1263
double m_fBucketSize
table entry size (degrees/second)
Definition: hekKinJoint.h:363
Joint velocity/ servo speed lookup table class.
Definition: hekKinJoint.h:249
SyncMoveMsgs()
Default constructor.
Definition: hekKinJoint.cxx:82
Hekateros joint classes interfaces.
double m_fJointPrevPos
joint current position (radians)
Definition: hekKinJoint.h:829
double m_fJointPosOut
low-pass filtered joint cur position
Definition: hekKinJoint.h:831
MoveState m_eStateWristPitch
joint control state
Definition: hekKinJoint.h:1264
void getTgtVelSpeed(double &fTgtVel, int &nTgtSpeed) const
Get the PID output target joint velocity and the corresponding servo speed estemate.
Definition: hekKinJoint.h:687
virtual bool isCoupledJointStopped()
Test if coupled joint is stopped.
Definition: hekKinJoint.h:1288
virtual void coupleJoint(HekKinJoint *pKinJointWristPitch)
Couple joint.
Definition: hekKinJoint.h:1198
double m_fTorqueOut
low-pass filtered torque
Definition: hekKinJoint.h:858
std::deque< double > m_histDtIn
sliding window of delta t&#39;s
Definition: hekKinJoint.h:838
int m_nServoPrevPos
servo previous pos (odometer ticks)
Definition: hekKinJoint.h:830
double m_fJointRadPerTick
joint radians / odometer tick
Definition: hekKinJoint.h:824
void clear()
Clear sync messages.
Definition: hekKinJoint.cxx:96
void getPidKParams(double &fKp, double &fKi, double &fKd) const
Get the joint&#39;s position and velocity PID K parameters.
Definition: hekKinJoint.h:575
double m_fJointCurPos
joint current position (radians)
Definition: hekKinJoint.h:827
std::deque< double > m_histVelIn
sliding window of current velocities
Definition: hekKinJoint.h:847
double m_fJointVel
joint velocity (radians/second)
Definition: hekKinJoint.h:198
The Hekateros joint position and velocity PID class interface.
Top-level package include file.
bool isMovingToGoal()
Test if actively moving joint to goal.
Definition: hekKinJoint.h:521
no active goal or stopping control
Definition: hekKinJoint.h:437
virtual ~HekKinJoint()
Copy constructor.
Definition: hekKinJoint.h:469
void setPidMaxDeltaVParam(const double fMaxDeltaV)
Set joint PID maximum delta v (radians/second) parameter.
Definition: hekKinJoint.h:609
virtual void coupleJoint(HekKinJoint *)
Couple joint.
Definition: hekKinJoint.h:480
HekPid m_pid
joint position and velocity PID
Definition: hekKinJoint.h:821
virtual bool isStopped()
Test if joint is stopped (i.e. control is not active).
Definition: hekKinJoint.h:551
int m_nServoSpeed
associated servo speed (raw unitless)
Definition: hekKinJoint.h:199
double m_fJointCurVel
joint current velocity (radians/second)
Definition: hekKinJoint.h:842
VelSpeedLookupTbl m_tblVelSpeed
dynamic velocity/speed lookup table
Definition: hekKinJoint.h:845
double m_fJointGoalVel
joint goal velocity (radians/second)
Definition: hekKinJoint.h:841
virtual bool hasOverTorqueCondition()
Test if joint is in an over torque condition.
Definition: hekKinJoint.h:698
virtual ~SyncMoveMsgs()
Destructor.
Definition: hekKinJoint.h:104
uint_t m_uOdPosTupCount
positon tuple count
Definition: hekKinJoint.h:181
double m_fJointTgtVel
joint target velocity (radians/second)
Definition: hekKinJoint.h:850
void getJointCurPosVel(double &fCurPos, double &fCurVel) const
Get the instantaneous current joint position and velocity.
Definition: hekKinJoint.h:650
DynaSpeedTuple_T m_tupSpeed[DYNA_ID_NUMOF]
speed tuple array
Definition: hekKinJoint.h:178
Hekateros common utilities.
virtual bool isCoupledJointMoving()
Test if coupled joint is moving.
Definition: hekKinJoint.h:1298
uint_t m_uSpeedTupCount
speed tuple count
Definition: hekKinJoint.h:179
void getFilteredJointCurPosVel(double &fCurPos, double &fCurVel) const
Get the smoothed (filtered) current joint position and velocity.
Definition: hekKinJoint.h:662
void setToleranceParams(const double fTolPos, const double fTolVel)
Set the position and velocity tolerance parameters.
Definition: hekKinJoint.h:638
double m_fDtAvg
average delta t
Definition: hekKinJoint.h:837
bool m_bDbg
enable [disable] debugging
Definition: hekKinJoint.h:368
double m_fTolVel
joint velocity &plusmn; tolerance (rads/s)
Definition: hekKinJoint.h:819
MoveState getMoveState()
Get move control state for this joint.
Definition: hekKinJoint.h:511
Joint velocity to servo speed tuple class.
Definition: hekKinJoint.h:195
bool canStopNow()
Test if can stop now without slowing down.
Definition: hekKinJoint.h:561
bool isStopping()
Test if actively stopping joint.
Definition: hekKinJoint.h:531
HekKinJointWristRot(HekRobotJoint *pJoint, DynaServo *pServo, const HekTunes &tunes)
Initialization constructor.
Definition: hekKinJoint.h:1162
bool m_bOverTorqueCond
is [not] in torque overload condition
Definition: hekKinJoint.h:854
double m_fClearTorqueTh
clear over torque condition threshold
Definition: hekKinJoint.h:856
MoveState
Kinedynamics joint position and velocity control states.
Definition: hekKinJoint.h:435
Special wrist rotation joint kinematics and dynamics class.
Definition: hekKinJoint.h:1143
std::vector< VelSpeedTuple > VelSpeedTbl
Velocity-speed table type.
Definition: hekKinJoint.h:253
HekKinJointWristRot & operator=(const HekKinJointWristRot &rhs)
Assignment operator.
Definition: hekKinJoint.h:1185
The <b><i>Hekateros</i></b> namespace encapsulates all <b><i>Hekateros</i></b> related constructs...
Definition: hekateros.h:56