Kuon  1.1.3
RoadNarrows Robotics Large Outdoor Mobile Robot Project
kuonRobot.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Kuon
4 //
5 // Library: libkuon
6 //
7 // File: kuonRobot.h
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2014-04-09 16:45:20 -0600 (Wed, 09 Apr 2014) $
12  * $Rev: 3639 $
13  *
14  * \brief Kuon Robot Class interface.
15  *
16  * \author Robin Knight (robin.knight@roadnarrows.com)
17  * \author Daniel Packard (daniel@roadnarrows.com)
18  *
19  * \copyright
20  * \h_copy 2013-2017. RoadNarrows LLC.\n
21  * http://www.roadnarrows.com\n
22  * All Rights Reserved
23  */
24 /*
25  * @EulaBegin@
26  *
27  * Permission is hereby granted, without written agreement and without
28  * license or royalty fees, to use, copy, modify, and distribute this
29  * software and its documentation for any purpose, provided that
30  * (1) The above copyright notice and the following two paragraphs
31  * appear in all copies of the source code and (2) redistributions
32  * including binaries reproduces these notices in the supporting
33  * documentation. Substantial modifications to this software may be
34  * copyrighted by their authors and need not follow the licensing terms
35  * described here, provided that the new terms are clearly indicated in
36  * all files where they apply.
37  *
38  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
39  * OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
40  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
41  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
42  * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
43  * THE POSSIBILITY OF SUCH DAMAGE.
44  *
45  * THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
46  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
47  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
48  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
49  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
50  *
51  * @EulaEnd@
52  */
53 ////////////////////////////////////////////////////////////////////////////////
54 
55 #ifndef _KUON_ROBOT_H
56 #define _KUON_ROBOT_H
57 
58 #include <pthread.h>
59 
60 #include <string>
61 #include <map>
62 
63 #include "rnr/rnrconfig.h"
64 #include "rnr/log.h"
65 #include "rnr/units.h"
66 
67 #include "Kuon/RS160DControl.h"
68 
69 #include "Kuon/kuon.h"
70 #include "Kuon/kuonUtils.h"
71 #include "Kuon/kuonDesc.h"
72 #include "Kuon/kuonJoint.h"
73 #include "Kuon/kuonTraj.h"
74 #include "Kuon/kuonStatus.h"
75 
76 namespace kuon
77 {
78  /*!
79  * \brief Kuon robotic manipulator plus accesories class.
80  *
81  * Includes up to 3 kinematic chains.
82  */
83  class KuonRobot
84  {
85  public:
86  static const float GovernorDft; ///< speed limit governor start-up default
87  static const float BrakeDft; ///< brake start-up default
88  static const float SlewDft; ///< slew start-up default
89 
90  /*!
91  * \brief Map of robot joints.
92  *
93  * \termblock
94  * \term key: \termdata motor id \endterm
95  * \term mapped type: \termdata joint data \endterm
96  * \endtermblock
97  *
98  * \note Joint order is critical. Ascending motor ids keeps map in order,
99  * but if this cannot be guaranteed, then change strategy.
100  */
101  typedef std::map<int, KuonRobotJoint> MapRobotJoints;
102 
103  /*!
104  * \brief Indirect map of robot joints.
105  *
106  * \termblock
107  * \term key: \termdata joint name \endterm
108  * \term mapped type: \termdata motor id \endterm
109  * \endtermblock
110  */
111  typedef std::map<std::string, int> IMapRobotJoints;
112 
113  /*!
114  * \brief Asynchronous task id.
115  */
117  {
118  AsyncTaskIdNone, ///< no task
119 
120  // add others here, as needed
121  };
122 
123  /*!
124  * \brief Default initialization constructor.
125  *
126  * \param bNoExec Do [not] execute arm physical movements. All commands
127  * and responses are supported but the lower level arm
128  * movement commands will not be issued.
129  */
130  KuonRobot(bool bNoExec=false);
131 
132  /*!
133  * \brief Destructor.
134  */
135  virtual ~KuonRobot();
136 
137 
138  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
139  // Communication and Robot Initialization Methods
140  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
141 
142  /*!
143  * \brief Connect to \h_kuon.
144  *
145  * \param strDevMotorCtlr0 Motor controller serial device name 0.
146  * \param strDevMotorCtlr1 Motor controller serial device name 1.
147  * \param nBaudRateMotorCtlr Motor controllers baud rate.
148  *
149  * \copydoc doc_return_std
150  */
151  int connect(const std::string &strDevMotorCtlr0 = KuonDevMotorCtlr0,
152  const std::string &strDevMotorCtlr1 = KuonDevMotorCtlr1,
153  int nBaudRateMotorCtlr = KuonBaudRateMotorCtlr);
154 
155  /*!
156  * \brief Disconnect from \h_kuon.
157  *
158  * \copydoc doc_return_std
159  */
160  int disconnect();
161 
162  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
163  // Canned Movements
164  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
165 
166  // todo left 90, right 90, 180 uturn
167 
168  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
169  // Fundamental Base Operations
170  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
171 
172  /*!
173  * \brief Emergency stop.
174  *
175  * All motor will stop driving, so arm or accessories may fall.
176  *
177  * \copydoc doc_return_std
178  */
179  int estop();
180 
181  /*!
182  * \brief Freeze arm and accessories at current position.
183  *
184  * Motors are still being driven.
185  *
186  * \copydoc doc_return_std
187  */
188  int freeze();
189 
190  /*!
191  * \brief Release arm and accessories.
192  *
193  * Motors will stop driving, so the arm may fall.
194  *
195  * \copydoc doc_return_std
196  */
197  int release();
198 
199  /*!
200  * \brief Attempt to clear all motor alarms in all kinematic chains.
201  *
202  * \note Not all alarms are clearable (e.g. temperature).
203  *
204  * \copydoc doc_return_std
205  */
206  int clearAlarms();
207 
208  /*!
209  * \brief Reset (clears) emergency stop condition.
210  *
211  * \note Motors are not re-powered until an move or freeze action is called.
212  */
213  void resetEStop()
214  {
215  m_bIsEStopped = false;
216  m_bAlarmState = false;
217  }
218 
219  /*!
220  * \brief Set speed limit governor value.
221  *
222  * Governor is defined as:\n
223  * speed = cap(set_speed, min_speed * governor, max_speed * governor)
224  *
225  * \param fGovernor Governor value between [0.0, 1.0].
226  *
227  * \return Returns new governor value.
228  */
229  float setGovernor(float fGovernor)
230  {
231  m_fGovernor = (float)fcap(fGovernor, 0.0, 1.0);
232  m_nGovernSpeedMin = (int)(m_fGovernor * (float)RS160D_MOTOR_SPEED_MIN);
233  m_nGovernSpeedMax = (int)(m_fGovernor * (float)RS160D_MOTOR_SPEED_MAX);
234 
235  return m_fGovernor;
236  }
237 
238  /*!
239  * \brief Increment/decrement speed limit governor value.
240  *
241  * Governor is defined as:\n
242  * speed = set_speed * governor
243  *
244  * \param fDelta Governor \h_plusmn delta.
245  *
246  * \return Returns new governor value.
247  */
248  float incrementGovernor(float fDelta)
249  {
250  return setGovernor(m_fGovernor+fDelta);
251  }
252 
253  /*!
254  * \brief Set robot's auto-brake value.
255  *
256  * The brake value is applied to all motors. In the current Kuon, rheostatic
257  * motor braking is used. Future versions may use regenerative and/or
258  * mechanical braking.
259  *
260  * Braking is automatically applied when motor speeds are 0.
261  *
262  * \param fBrake Brake value between [0.0, 1.0] where 0.0 is coasting and
263  * 1.0 is full brake.
264  *
265  * \copydoc doc_return_std
266  */
267  int setBrake(float fBrake);
268 
269  /*!
270  * \brief Set robot's power slew value.
271  *
272  * The slew value is applied to all motors. It defines the power ramp up
273  * scale when accelerating.
274  *
275  * Slewing is automatically applied on acceleration changes.
276  *
277  * \param fSlew Slew value between [0.0, 1.0] where 0.0 is full power
278  * applied instantly with quickest response and 1.0 is the
279  * slowest ramp up with sloggish response but little back
280  * EMF generated.
281  *
282  * \copydoc doc_return_std
283  */
284  int setSlew(float fSlew);
285 
286  /*!
287  * \brief Set robot's left and right motor speeds.
288  *
289  * \param fSpeedLeft Left motor speeds in the given units.
290  * \param fSpeedRight Right motor speeds in the given units.
291  * \param units Speed units. One of: \n
292  * units_norm units_percent units_permil units_raw.
293  *
294  * \copydoc doc_return_std
295  */
296  int setSpeed(double fSpeedLeft,
297  double fSpeedRight,
298  units_t units=units_norm);
299 
300  /*!
301  * \brief Move platform through trajectory point.
302  *
303  * TODO
304  *
305  * \param trajectoryPoint Trajectory end point.
306  *
307  * \copydoc doc_return_std
308  */
309  int move(KuonWheelTrajectoryPoint &trajectoryPoint);
310 
311  /*!
312  * \brief Convert velocity to raw motor speed value.
313  *
314  * \param fVelocity Velocity.
315  * \param units Velocity units. One of:\n
316  * units_norm [-1.0, 1.0]\n
317  * units_percent [-100.0, 100.0]\n
318  * units_permil [-1000.0, 1000.0]\n
319  * units_raw [min, max]
320  *
321  * \return Raw speed value.
322  */
323  int velocityToRawSpeed(double fVelocity, units_t units=units_norm);
324 
325 
326  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
327  // Industrial Base Status and State
328  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
329 
330  /*!
331  * \brief Get the robot current status.
332  *
333  * \param [in,out] robotStatus Robot status.
334  *
335  * \copydoc doc_return_std
336  */
337  int getRobotStatus(KuonRobotStatus &robotStatus);
338 
339  /*!
340  * \brief Get the joint states of a kinematic chain.
341  *
342  * \param [in,out] jointStatePoint Joint state point.
343  *
344  * \copydoc doc_return_std
345  */
346  int getJointState(KuonJointStatePoint &jointStatePoint);
347 
348  /*!
349  * \brief Get trajectory feedback.
350  *
351  * TODO
352  * \param [in,out] trajectoryFeedback Wheel state point.
353  *
354  * \copydoc doc_return_std
355  */
357 
358  /*!
359  * \brief Set robot's operational mode.
360  *
361  * \return eRobotMode Robot operation mode. See \ref KuonRobotMode.
362  */
363  void setRobotMode(KuonRobotMode eRobotMode)
364  {
365  m_eRobotMode = eRobotMode;
366  }
367 
368  /*!
369  * \brief Cancel any asynchronous task.
370  *
371  * \note There may be a little delay between canceling an async task
372  * and the task actually stopping.
373  */
374  void cancelAsyncTask();
375 
376  /*!
377  * \brief Get the current asynchronous task state.
378  *
379  * \return \ref KuonAsyncTaskState enum value.
380  */
382  {
383  return m_eAsyncTaskState;
384  }
385 
386  /*!
387  * \brief Get the last asynchronous task return code.
388  *
389  * \return
390  * Returns KUON_OK when task terminated successfully.
391  * Otherwise, returns \h_lt 0 \ref kuon_ecodes.
392  */
394  {
395  return m_rcAsyncTask;
396  }
397 
398 
399  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
400  // Attribute Methods
401  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
402 
403  /*!
404  * \brief Test if connected to \h_kuon hardware.
405  *
406  * \return Returns true or false.
407  */
408  bool isConnected()
409  {
410  return (m_fdMotorCtlr0 >= 0) && (m_fdMotorCtlr1 >= 0);
411  }
412 
413  /*!
414  * \brief Get the \h_kuon robotic arm hardware version number.
415  *
416  * \param [out] nVerMajor Major version number.
417  * \param [out] nVerMinor Minor version number.
418  * \param [out] nVerRevision Revision version number.
419  */
420  void getVersion(int &nVerMajor, int &nVerMinor, int &nRevision)
421  {
422  uint_t uHwVer;
423 
425  nVerMajor = KUON_VER_MAJOR(uHwVer);
426  nVerMinor = KUON_VER_MINOR(uHwVer);
427  nRevision = KUON_VER_REV(uHwVer);
428  }
429 
430  /*!
431  * \brief Get the \h_kuon robotic arm hardware version string.
432  *
433  * Version number strings are of the dotted form maj.min.rev.
434  *
435  * \return Version string.
436  */
437  std::string getVersion()
438  {
439  return m_descKuon.getBaseDesc()->getProdHwVer();
440  }
441 
442  /*!
443  * \brief Get the \h_kuon product description.
444  *
445  * \return Returns pointer to description.
446  */
448  {
449  return &m_descKuon;
450  }
451 
452  /*!
453  * \brief Convenience function to get this \h_kuon description's base
454  * product id.
455  *
456  * \return Returns product id. See \ref KuonProdId.
457  */
458  int getProdId()
459  {
460  return m_descKuon.getBaseDesc()->getProdId();
461  }
462 
463  /*!
464  * \brief Convenience function to get this \h_kuon description's base
465  * product name.
466  *
467  * \return Returns product name. See \ref KuonProdName.
468  */
469  std::string getProdName()
470  {
471  return m_descKuon.getBaseDesc()->getProdName();
472  }
473 
474  /*!
475  * \brief Get the \h_kuon full brief descirption.
476  *
477  * \return Returns product brief description.
478  */
479  std::string getFullProdBrief()
480  {
481  return m_descKuon.getFullProdBrief();
482  }
483 
484  /*!
485  * \brief Test if robot is fully described via configuration XML.
486  *
487  * \return Returns true or false.
488  */
490  {
491  return m_descKuon.isDescribed();
492  }
493 
494  /*!
495  * \brief Test if robot is current emergency stopped.
496  *
497  * \return Returns true or false.
498  */
500  {
501  return m_bIsEStopped;
502  }
503 
504  /*!
505  * \brief Test if robot motor are currently being driven (powered).
506  *
507  * \return Returns true or false.
508  */
510  {
511  return m_bAreMotorsPowered;
512  }
513 
514  /*!
515  * \brief Test if any joint in any of the kinematic chains is moving.
516  *
517  * \note RS160D motor controller provide no feedback.
518  *
519  * \return Returns true or false.
520  */
521  bool isInMotion()
522  {
523  return (m_nSetPtSpeedLeft != 0) || (m_nSetPtSpeedRight != 0);
524  }
525 
526  /*!
527  * \brief Test if robot is alarmed.
528  *
529  * \return Returns true or false.
530  */
531  int isAlarmed()
532  {
533  return m_bAlarmState;
534  }
535 
536  /*!
537  * \brief Get current speed limit governor setting.
538  *
539  * \return Return value.
540  */
541  float getGovernor()
542  {
543  return m_fGovernor;
544  }
545 
546  /*!
547  * \brief Get current brake setting.
548  *
549  * \return Return value.
550  */
551  float getBrake()
552  {
553  return m_fBrake;
554  }
555 
556  /*!
557  * \brief Get current slew setting.
558  *
559  * \return Return value.
560  */
561  float getSlew()
562  {
563  return m_fSlew;
564  }
565 
566  /*!
567  * \brief Get the current left and right side motor velocity set points.
568  *
569  * \param [out] fSpeedLeft Current left motors set velocity in units.
570  * \param [out] fSpeedRight Current right motors set velocity in units.
571  * \param units Velocity units.
572  */
573  void getVelocitySetPoints(double &fSpeedLeft,
574  double &fSpeedRight,
575  units_t units=units_norm);
576 
577 
578  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
579  // Kinematic Access and Mapping Methods
580  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
581 
582  /*!
583  * \brief Get robotic joint in arm+ee kinematic chain at the given index.
584  *
585  * \param index Joint index.
586  *
587  * \return If found, returns pointer to joint. Otherwise returns NULL.
588  */
590  {
591  return index < m_kinBase.size()? &m_kinBase.at(index): NULL;
592  }
593 
594  /*!
595  * \brief Get robotic joint in arm+ee kinematic chain.
596  *
597  * \param strName Joint name (key).
598  *
599  * \return If found, returns pointer to joint. Otherwise returns NULL.
600  */
601  KuonRobotJoint *getBaseJoint(std::string &strName)
602  {
603  IMapRobotJoints::iterator iter;
604 
605  if( (iter = m_imapBase.find(strName)) != m_imapBase.end() )
606  {
607  return &(m_kinBase[iter->second]);
608  }
609  else
610  {
611  return NULL;
612  }
613  }
614 
615  /*!
616  * \brief Get robotic joint in arm+ee kinematic chain.
617  *
618  * \param nMotorId Motor id (primary key).
619  *
620  * \return If found, returns pointer to joint. Otherwise returns NULL.
621  */
623  {
624  MapRobotJoints::iterator iter;
625 
626  if( (iter = m_kinBase.find(nMotorId)) != m_kinBase.end() )
627  {
628  return &(iter->second);
629  }
630  else
631  {
632  return NULL;
633  }
634  }
635 
636  protected:
637  // state
638  bool m_bNoExec; ///< do [not] execute physical movements
639  KuonDesc m_descKuon; ///< \h_kuon description
640  KuonRobotMode m_eRobotMode; ///< robot operating mode
641  bool m_bIsEStopped; ///< arm is [not] emergency stopped
642  bool m_bAlarmState; ///< robot is [not] alarmed
643  bool m_bAreMotorsPowered;///< arm motor are [not] driven
644  float m_fGovernor; ///< speed limit governor setting
645  float m_fBattery; ///< battery energy level
646  float m_fBrake; ///< motor braking
647  float m_fSlew; ///< power slewing
648  int m_nGovernSpeedMin; ///< minimum governed speed limit
649  int m_nGovernSpeedMax; ///< maximum governed speed limit
650  int m_nSetPtSpeedLeft; ///< left motors raw speed set point
651  int m_nSetPtSpeedRight; ///< right motors raw speed set point
652 
653  // RS160D motor controllers
654  int m_fdMotorCtlr0; ///< motor controller 0 file descriptor
655  int m_fdMotorCtlr1; ///< motor controller 1 file descriptor
656 
657  // joints and kinematics chains
658  MapRobotJoints m_kinBase; ///< robot base kin
659  IMapRobotJoints m_imapBase; ///< robot base indirect kin map
660 
661  // motion
662  KuonWheelTrajectoryPoint m_lastTrajBase; ///< last trajectory point for base
663 
664  // asynchronous task control
665  KuonAsyncTaskState m_eAsyncTaskState; ///< asynchronous task state
666  int m_rcAsyncTask; ///< last async task return code
667  AsyncTaskId m_eAsyncTaskId; ///< asynchronous task id
668  void *m_pAsyncTaskArg; ///< asynchronous argument
669  pthread_t m_threadAsync; ///< async pthread identifier
670 
671 
672  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
673  // Convert Static Specifications Methods
674  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
675 
676  /*!
677  * \brief Convert specification(s) to operational parameters.
678  *
679  * The specifications must be defined and the connecton to the \h_kuon
680  * hardware must be open.
681  *
682  * There are up to 3 kinematic chains, given the specifications and the
683  * hardware:
684  * \li arm + end effector
685  * \li equipment deck effector
686  * \li auxiliary effector
687  *
688  * \note A kinematic chain differs from the dynamixel chain. \h_kuon
689  * supports one dynamixel bus in which all motor hang. A dynamixel chain
690  * defines this communication bus. Motors on the bus can be associated with
691  * any of the above three kinematic chains.
692  *
693  * \copydoc doc_return_std
694  */
695  int convertSpecs();
696 
697  /*!
698  * \brief Add a joint to robot's kinematic chain.
699  *
700  * \param [in] pSpecJoint Pointer to joint spcecification.
701  * \param [in] pSpecMotor Pointer to motor spcecification.
702  * \param [out] kin Modified kinematics chain of joints.
703  * \param [out] imap Indirect map of kinematic chain.
704  *
705  * \copydoc doc_return_std
706  */
707  int addRobotJoint(KuonSpecMotor_T *pSpecJoint,
708  MapRobotJoints &kin,
709  IMapRobotJoints &imap);
710 
711  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
712  // Hardware and Software Methods
713  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
714 
715  /*!
716  * \brief Configure \h_kuon for normal operation.
717  *
718  * The arm, end effector, and accessory effectors are configured for
719  * normal operation.
720  *
721  * \copydoc doc_return_std
722  */
723  int configForOperation();
724 
725 
726  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
727  // Asynchronous Operation Methods
728  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
729 
730  /*!
731  * \brief Create the asynchronous thread.
732  *
733  * \par Context:
734  * Calling thread.
735  *
736  * \copydoc doc_return_std
737  */
738  int createAsyncThread();
739 
740  /*!
741  * \brief Asynchronous operation thread.
742  *
743  * \param pArg Thread argument (point to KuonRobot object).
744  *
745  * \return Returns NULL on thread exit.
746  */
747  static void *asyncThread(void *pArg);
748  };
749 
750 } // namespace kuon
751 
752 
753 #endif // _KUON_ROBOT_H
int estop()
Emergency stop.
Definition: kuonRobot.cxx:307
void getVersion(int &nVerMajor, int &nVerMinor, int &nRevision)
Get the <b><i>Kuon</i></b> robotic arm hardware version number.
Definition: kuonRobot.h:420
int m_nGovernSpeedMin
minimum governed speed limit
Definition: kuonRobot.h:648
int m_nSetPtSpeedLeft
left motors raw speed set point
Definition: kuonRobot.h:650
int isDescribed()
Test if robot is fully described via configuration XML.
Definition: kuonRobot.h:489
int m_fdMotorCtlr1
motor controller 1 file descriptor
Definition: kuonRobot.h:655
std::string getProdName()
Get this base description&#39;s name.
Definition: kuonDescBase.h:146
std::map< std::string, int > IMapRobotJoints
Indirect map of robot joints.
Definition: kuonRobot.h:111
int addRobotJoint(KuonSpecMotor_T *pSpecJoint, MapRobotJoints &kin, IMapRobotJoints &imap)
Add a joint to robot&#39;s kinematic chain.
Definition: kuonRobot.cxx:681
Kuon common utilities.
void getVelocitySetPoints(double &fSpeedLeft, double &fSpeedRight, units_t units=units_norm)
Get the current left and right side motor velocity set points.
Definition: kuonRobot.cxx:489
int createAsyncThread()
Create the asynchronous thread.
Definition: kuonRobot.cxx:737
int getAsyncRc()
Get the last asynchronous task return code.
Definition: kuonRobot.h:393
int release()
Release arm and accessories.
Definition: kuonRobot.cxx:344
int isAlarmed()
Test if robot is alarmed.
Definition: kuonRobot.h:531
KuonDesc m_descKuon
<b><i>Kuon</i></b> description
Definition: kuonRobot.h:639
int getProdId()
Get this base description&#39;s base product id.
Definition: kuonDescBase.h:136
int getProdId()
Convenience function to get this <b><i>Kuon</i></b> description&#39;s base product id.
Definition: kuonRobot.h:458
const char *const KuonDevMotorCtlr1
motor controller 1 device name
Definition: kuon.h:271
AsyncTaskId
Asynchronous task id.
Definition: kuonRobot.h:116
Kuon robotic manipulator plus accesories class.
Definition: kuonRobot.h:83
KuonAsyncTaskState
Asynchronous task state.
Definition: kuon.h:374
static const float BrakeDft
brake start-up default
Definition: kuonRobot.h:87
void * m_pAsyncTaskArg
asynchronous argument
Definition: kuonRobot.h:668
std::string getProdName()
Convenience function to get this <b><i>Kuon</i></b> description&#39;s base product name.
Definition: kuonRobot.h:469
KuonRobotJoint * getBaseJoint(int nMotorId)
Get robotic joint in arm+ee kinematic chain.
Definition: kuonRobot.h:622
std::string getProdHwVer()
Get this base description&#39;s hardware version.
Definition: kuonDescBase.h:166
uint_t strToVersion(const std::string &str)
Convert version dotted string to integer equivalent.
Kuon Robot Status classes interfaces.
int getTrajectoryState(KuonWheelTrajectoryFeedback &trajFeedback)
Get trajectory feedback.
Definition: kuonRobot.cxx:639
Wheel trajectory point class.
Definition: kuonTraj.h:186
The <b><i>Kuon</i></b> namespace encapsulates all <b><i>Kuon</i></b> related constructs.
Definition: kuon.h:66
float m_fBattery
battery energy level
Definition: kuonRobot.h:645
std::map< int, KuonRobotJoint > MapRobotJoints
Map of robot joints.
Definition: kuonRobot.h:101
bool m_bIsEStopped
arm is [not] emergency stopped
Definition: kuonRobot.h:641
void resetEStop()
Reset (clears) emergency stop condition.
Definition: kuonRobot.h:213
Robotic motor specification.
Definition: kuonSpec.h:111
KuonRobotJoint * getBaseJointAt(int index)
Get robotic joint in arm+ee kinematic chain at the given index.
Definition: kuonRobot.h:589
float getSlew()
Get current slew setting.
Definition: kuonRobot.h:561
int setBrake(float fBrake)
Set robot&#39;s auto-brake value.
Definition: kuonRobot.cxx:369
int areMotorsPowered()
Test if robot motor are currently being driven (powered).
Definition: kuonRobot.h:509
Kuon Robot Joint class interfaces.
AsyncTaskId m_eAsyncTaskId
asynchronous task id
Definition: kuonRobot.h:667
KuonRobotJoint * getBaseJoint(std::string &strName)
Get robotic joint in arm+ee kinematic chain.
Definition: kuonRobot.h:601
KuonRobot(bool bNoExec=false)
Default initialization constructor.
Definition: kuonRobot.cxx:143
int isEStopped()
Test if robot is current emergency stopped.
Definition: kuonRobot.h:499
#define KUON_VER_REV(ver)
Get revision number from version.
Definition: kuon.h:186
float incrementGovernor(float fDelta)
Increment/decrement speed limit governor value.
Definition: kuonRobot.h:248
KuonRobotMode
<b><i>Kuon</i></b> mode of operation.
Definition: kuon.h:364
int configForOperation()
Configure <b><i>Kuon</i></b> for normal operation.
Definition: kuonRobot.cxx:718
int m_rcAsyncTask
last async task return code
Definition: kuonRobot.h:666
MapRobotJoints m_kinBase
robot base kin
Definition: kuonRobot.h:658
#define KUON_VER_MINOR(ver)
Get version minor number from version.
Definition: kuon.h:177
RoadNarrows Kuon robot top-level header file.
#define KUON_VER_MAJOR(ver)
Get version major number from version.
Definition: kuon.h:168
bool m_bNoExec
do [not] execute physical movements
Definition: kuonRobot.h:638
const int KuonBaudRateMotorCtlr
motor controllers baud rate
Definition: kuon.h:282
int getRobotStatus(KuonRobotStatus &robotStatus)
Get the robot current status.
Definition: kuonRobot.cxx:526
int freeze()
Freeze arm and accessories at current position.
Definition: kuonRobot.cxx:326
int m_nGovernSpeedMax
maximum governed speed limit
Definition: kuonRobot.h:649
bool m_bAreMotorsPowered
arm motor are [not] driven
Definition: kuonRobot.h:643
int m_fdMotorCtlr0
motor controller 0 file descriptor
Definition: kuonRobot.h:654
std::string getFullProdBrief()
Get the <b><i>Kuon</i></b> full brief descirption.
Definition: kuonDesc.h:177
int setSpeed(double fSpeedLeft, double fSpeedRight, units_t units=units_norm)
Set robot&#39;s left and right motor speeds.
Definition: kuonRobot.cxx:419
Trajectory classes interfaces.
Kuon full robotic mobile platform descripition class interface.
const char *const KuonDevMotorCtlr0
motor controller 0 device name
Definition: kuon.h:260
int clearAlarms()
Attempt to clear all motor alarms in all kinematic chains.
Definition: kuonRobot.cxx:362
std::string getFullProdBrief()
Get the <b><i>Kuon</i></b> full brief descirption.
Definition: kuonRobot.h:479
Kuon robotic manipulator full description class.
Definition: kuonDesc.h:83
KuonWheelTrajectoryPoint m_lastTrajBase
last trajectory point for base
Definition: kuonRobot.h:662
int move(KuonWheelTrajectoryPoint &trajectoryPoint)
Move platform through trajectory point.
Definition: kuonRobot.cxx:446
static const float SlewDft
slew start-up default
Definition: kuonRobot.h:88
Operational robotic joint class.
Definition: kuonJoint.h:83
Joint state point class.
Definition: kuonJoint.h:217
pthread_t m_threadAsync
async pthread identifier
Definition: kuonRobot.h:669
int disconnect()
Disconnect from <b><i>Kuon</i></b>.
Definition: kuonRobot.cxx:277
double fcap(double a, double min, double max)
Cap value within limits [min, max].
Definition: kuonUtils.h:140
Robot global status.
Definition: kuonStatus.h:110
static void * asyncThread(void *pArg)
Asynchronous operation thread.
Definition: kuonRobot.cxx:790
float setGovernor(float fGovernor)
Set speed limit governor value.
Definition: kuonRobot.h:229
bool isDescribed()
Test if required descriptions are described.
Definition: kuonDesc.h:145
int connect(const std::string &strDevMotorCtlr0=KuonDevMotorCtlr0, const std::string &strDevMotorCtlr1=KuonDevMotorCtlr1, int nBaudRateMotorCtlr=KuonBaudRateMotorCtlr)
Connect to <b><i>Kuon</i></b>.
Definition: kuonRobot.cxx:174
int convertSpecs()
Convert specification(s) to operational parameters.
Definition: kuonRobot.cxx:648
KuonDescBase * getBaseDesc()
Get the <b><i>Kuon</i></b> base product description.
Definition: kuonDesc.h:156
float getBrake()
Get current brake setting.
Definition: kuonRobot.h:551
bool m_bAlarmState
robot is [not] alarmed
Definition: kuonRobot.h:642
IMapRobotJoints m_imapBase
robot base indirect kin map
Definition: kuonRobot.h:659
KuonAsyncTaskState m_eAsyncTaskState
asynchronous task state
Definition: kuonRobot.h:665
int m_nSetPtSpeedRight
right motors raw speed set point
Definition: kuonRobot.h:651
float getGovernor()
Get current speed limit governor setting.
Definition: kuonRobot.h:541
float m_fSlew
power slewing
Definition: kuonRobot.h:647
int getJointState(KuonJointStatePoint &jointStatePoint)
Get the joint states of a kinematic chain.
Definition: kuonRobot.cxx:579
float m_fBrake
motor braking
Definition: kuonRobot.h:646
void cancelAsyncTask()
Cancel any asynchronous task.
Definition: kuonRobot.cxx:764
bool isInMotion()
Test if any joint in any of the kinematic chains is moving.
Definition: kuonRobot.h:521
int setSlew(float fSlew)
Set robot&#39;s power slew value.
Definition: kuonRobot.cxx:395
static const float GovernorDft
speed limit governor start-up default
Definition: kuonRobot.h:86
int velocityToRawSpeed(double fVelocity, units_t units=units_norm)
Convert velocity to raw motor speed value.
Definition: kuonRobot.cxx:452
KuonDesc * getKuonDesc()
Get the <b><i>Kuon</i></b> product description.
Definition: kuonRobot.h:447
std::string getVersion()
Get the <b><i>Kuon</i></b> robotic arm hardware version string.
Definition: kuonRobot.h:437
void setRobotMode(KuonRobotMode eRobotMode)
Set robot&#39;s operational mode.
Definition: kuonRobot.h:363
bool isConnected()
Test if connected to <b><i>Kuon</i></b> hardware.
Definition: kuonRobot.h:408
Wheel trajectory feedback class.
Definition: kuonTraj.h:319
virtual ~KuonRobot()
Destructor.
Definition: kuonRobot.cxx:169
float m_fGovernor
speed limit governor setting
Definition: kuonRobot.h:644
KuonRobotMode m_eRobotMode
robot operating mode
Definition: kuonRobot.h:640
KuonAsyncTaskState getAsyncState()
Get the current asynchronous task state.
Definition: kuonRobot.h:381