Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
laeRobot.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Laelasp
4 //
5 // Library: liblaelaps
6 //
7 // File: laeRobot.h
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2016-04-11 13:03:57 -0600 (Mon, 11 Apr 2016) $
12  * $Rev: 4381 $
13  *
14  * \brief Laelasp Robot Class interface.
15  *
16  * \author Robin Knight (robin.knight@roadnarrows.com)
17  *
18  * \par Copyright
19  * \h_copy 2015-2017. RoadNarrows LLC.\n
20  * http://www.roadnarrows.com\n
21  * All Rights Reserved
22  */
23 /*
24  * @EulaBegin@
25  *
26  * Unless otherwise stated explicitly, all materials contained are copyrighted
27  * and may not be used without RoadNarrows LLC's written consent,
28  * except as provided in these terms and conditions or in the copyright
29  * notice (documents and software) or other proprietary notice provided with
30  * the relevant materials.
31  *
32  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY
33  * MEMBERS/EMPLOYEES/CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE
34  * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
35  * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
36  * DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN
37  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  *
39  * THE AUTHORS AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
40  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
41  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
42  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
43  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
44  *
45  * @EulaEnd@
46  */
47 ////////////////////////////////////////////////////////////////////////////////
48 
49 #ifndef _LAE_ROBOT_H
50 #define _LAE_ROBOT_H
51 
52 #include <pthread.h>
53 
54 #include <string>
55 #include <map>
56 
57 #include "rnr/rnrconfig.h"
58 #include "rnr/log.h"
59 #include "rnr/units.h"
60 #include "rnr/i2c.h"
61 
62 // common
63 #include "Laelaps/laelaps.h"
64 #include "Laelaps/laeUtils.h"
65 
66 // hardware
67 #include "Laelaps/laeSysDev.h"
68 #include "Laelaps/RoboClaw.h"
69 #include "Laelaps/laeMotor.h"
70 #include "Laelaps/laeGpio.h"
71 #include "Laelaps/laeI2C.h"
72 #include "Laelaps/laeI2CMux.h"
73 #include "Laelaps/laeWatchDog.h"
74 #include "Laelaps/laeWd.h"
75 #include "Laelaps/laeVL6180.h"
76 #include "Laelaps/laeImu.h"
77 #include "Laelaps/laeCams.h"
78 
79 // descriptions and tuning
80 #include "Laelaps/laeTune.h"
81 #include "Laelaps/laeDesc.h"
82 
83 // control and application interface
84 #include "Laelaps/laeTraj.h"
85 #include "Laelaps/laePowertrain.h"
86 #include "Laelaps/laePlatform.h"
87 #include "Laelaps/laeKin.h"
88 #include "Laelaps/laeReports.h"
89 #include "Laelaps/laeThread.h"
90 #include "Laelaps/laeThreadAsync.h"
91 #include "Laelaps/laeThreadImu.h"
92 #include "Laelaps/laeThreadKin.h"
93 #include "Laelaps/laeThreadRange.h"
94 #include "Laelaps/laeThreadWd.h"
95 
96 namespace laelaps
97 {
98  typedef std::vector<sensor::vl6180::LaeVL6180Mux*> VecToFSensors;
99 
100  /*!
101  * \brief Laelaps robotic manipulator plus accesories class.
102  */
103  class LaeRobot
104  {
105  public:
106  static const double GovernorDft; ///< speed limit governor start-up default
107 
108  /*!
109  * \brief Default initialization constructor.
110  *
111  * \param bNoExec Do [not] execute on physical hardware. All commands
112  * and responses are supported but the lower level hardware
113  * commands will not be issued.
114  */
115  LaeRobot(bool bNoExec=false);
116 
117  /*!
118  * \brief Destructor.
119  */
120  virtual ~LaeRobot();
121 
122 
123  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
124  // Communication and Robot Initialization Methods
125  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
126 
127  /*!
128  * \brief Connect to \h_laelaps.
129  *
130  * \copydoc doc_return_std
131  */
132  int connect();
133 
134  /*!
135  * \brief Disconnect from \h_laelaps.
136  *
137  * \copydoc doc_return_std
138  */
139  int disconnect();
140 
141  /*!
142  * \brief Reload \h_laelaps's reloadable configuration and reset operational
143  * parameters.
144  *
145  * The robot connection and calibration states are uneffected.
146  */
147  int reload();
148 
149 
150  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
151  // Action Methods.
152  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
153 
154  /*!
155  * \brief Emergency stop.
156  *
157  * All motor will stop driving, so arm or accessories may fall.
158  *
159  * \copydoc doc_return_std
160  */
161  int estop();
162 
163  /*!
164  * \brief Reset (clears) emergency stop condition.
165  *
166  * \note Motors are not re-powered until an move or freeze action is called.
167  */
168  int resetEStop();
169 
170  /*!
171  * \brief Freeze robot and accessories at current position.
172  *
173  * Motors are still being driven. The motors are either dynamically or
174  * regeneratively braked.
175  *
176  * \copydoc doc_return_std
177  */
178  int freeze();
179 
180  /*!
181  * \brief Release robot and accessories.
182  *
183  * Motors will stop being driven. The robot will coast to a stop (on a flat
184  * surface) and is capabable of being externally pushed.
185  *
186  * \copydoc doc_return_std
187  */
188  int release();
189 
190  /*!
191  * \brief Stop robot with full dynamic braking.
192  *
193  * \copydoc doc_return_std
194  */
195  int stop();
196 
197  /*!
198  * \brief Move by setting powertrain angular wheel velocities.
199  *
200  * The robot is controlled by setting the goal velocities of a [sub]set of
201  * powertrain motors.
202  *
203  * \param velocity Map of powertrain velocities.\n
204  * Keys are left_front, right_front, left_rear, and
205  * right_rear.\n
206  * Values are drive shaft/wheel angular velocities
207  * (radians/second).
208  *
209  * \copydoc doc_return_std
210  */
211  int move(const LaeMapVelocity &velocity);
212 
213  /*!
214  * \brief Move at the given linear and angular velocities.
215  *
216  * This move is typically used with the ROS Twist message where:
217  * - linear velocity is the x component Twist.linear.x
218  * - angular velocity is the yaw component Twist.angular.z
219  *
220  * \param fVelLinear Linear velocity (meters/second).
221  * \param fVelAngular Angular velocity (radians/second).
222  *
223  * \copydoc doc_return_std
224  */
225  int move(double fVelLinear, double fVelAngular);
226 
227  /*!
228  * \brief Set powertrain motor duty cycles.
229  *
230  * The robot is controlled by setting the goal duties of a [sub]set of
231  * powertrain motors.
232  *
233  * \param duty Map of powertrain duty cycles.\n
234  * Keys are left_front, right_front, left_rear, and
235  * right_rear.\n
236  * Values are normalized duty cycles [-1.0, 1.0].
237  *
238  * \copydoc doc_return_std
239  */
240  int setDutyCycles(const LaeMapDutyCycle &duty);
241 
242  /*!
243  * \brief Set speed limit governor value.
244  *
245  * \note Software governor is not implemented as yet.
246  *
247  * Governor is defined as:\n
248  * speed = cap(set_speed, min_speed * governor, max_speed * governor)
249  *
250  * \param fGovernor Governor value between [0.0, 1.0].
251  *
252  * \return Returns new governor value.
253  */
254  double setGovernor(double fGovernor);
255 
256  /*!
257  * \brief Increment/decrement speed limit governor value.
258  *
259  * \note Software governor is not implemented as yet.
260  *
261  * Governor is defined as:\n
262  * speed = set_speed * governor
263  *
264  * \param fDelta Governor \h_plusmn delta.
265  *
266  * \return Returns new governor value.
267  */
268  double incrementGovernor(double fDelta);
269 
270  /*!
271  * \brief Get current speed limit governor setting.
272  *
273  * \note Software governor is not implemented as yet.
274  *
275  * \return Return value.
276  */
277  double getGovernor();
278 
279  /*!
280  * \brief Set robot's operational mode.
281  *
282  * \param eRobotMode Robot operation mode. See \ref LaeRobotMode.
283  */
284  void setRobotMode(LaeRobotMode eRobotMode);
285 
286  /*!
287  * \brief Set top deck auxilliary power out enable state.
288  *
289  * \param strName Aux. power port name. One of: aux_batt_en aux_5v_en
290  * \param eState Aux. power state. One of: DISABLED(0) ENABLED(1)
291  *
292  * \copydoc doc_return_std
293  */
294  int setAuxPower(const std::string &strName, LaeTriState eState);
295 
296  /*!
297  * \brief Attempt to clear all alarms.
298  *
299  * \note For Laelaps, most alarms are not clearable (e.g. temperature,
300  * low battery). Only external intervention is effective.
301  *
302  * \copydoc doc_return_std
303  */
304  int clearAlarms();
305 
306  /*!
307  * \brief Configure a digital pin on the the watchdog subprocessor.
308  *
309  * \param pin Digital pin number.
310  * \param dir Pin direction. 0 == input, 1 == output.
311  *
312  * \copydoc doc_return_std
313  */
314  virtual int configDigitalPin(uint_t pin, uint_t dir);
315 
316  /*!
317  * \brief Read the value of a digital pin on the watchdog subprocessor.
318  *
319  * \param pin Digital pin number.
320  * \param [out] val Digital pin low (0) or high (1) value.
321  *
322  * \copydoc doc_return_std
323  */
324  virtual int readDigitalPin(uint_t pin, uint_t &val);
325 
326  /*!
327  * \brief Write a value to a digital pin on the watchdog subprocessor.
328  *
329  * \param pin Digital pin number.
330  * \param val Digital pin low (0) or high (1) value.
331  *
332  * \copydoc doc_return_std
333  */
334  virtual int writeDigitalPin(uint_t pin, uint_t val);
335 
336  /*!
337  * \brief Read the value of an analog pin on the watchdog subprocessor.
338  *
339  * \param pin Analog pin number.
340  * \param [out] val Analog 10-bit value [0-1023].
341  *
342  * \copydoc doc_return_std
343  */
344  virtual int readAnalogPin(uint_t pin, uint_t &val);
345 
346  /*!
347  * \brief Get the last read and converted inertia data.
348  *
349  * Not applicable data are set to zero.
350  *
351  * \param [out] accel Accelerometer data (m/s^2).
352  * The array size must be \h_ge \ref NumOfAxes.
353  * \param [out] gyro Gyroscope data (radians/s).
354  * The array size must be \h_ge \ref NumOfAxes.
355  * \param [out] rpy Roll,pitch,yaw data (radians).
356  * The array size must be \h_ge \ref NumOfAxes.
357  * \param [out] q Vehicle quaternion.
358  *
359  * \copydoc doc_return_std
360  */
361  virtual int getImu(double accel[],
362  double gyro[],
363  double rpy[],
365 
366  /*!
367  * \brief Get range sensor properties.
368  *
369  * \param strKey Sensor's unique name id (key).
370  * \param [out] strRadiationType Radiation type.
371  * \param [out] fFoV Field of View (radians).
372  * \param [out] fBeamdir Center of beam direction (radians).
373  * \param [out] fMin Minimum range (meters).
374  * \param [out] fMax Maximum range (meters).
375  *
376  * \copydoc doc_return_std
377  */
378  virtual int getRangeSensorProps(const std::string &strKey,
379  std::string &strRadiationType,
380  double &fFoV,
381  double &fBeamDir,
382  double &fMin,
383  double &fMax);
384 
385  /*!
386  * \brief Get a range measurement.
387  *
388  * \param strKey Sensor's unique name (key).
389  * \param [out] fRange Sensed object range (meters).
390  *
391  * \copydoc doc_return_std
392  */
393  virtual int getRange(const std::string &strKey, double &fRange);
394 
395  /*!
396  * \brief Get all sensor range measurements.
397  *
398  * \param [out] vecNames Vector of sensor unique names.
399  * \param [out] vecRanges Vector of associated sensor measured ranges
400  * (meters).
401  *
402  * \copydoc doc_return_std
403  */
404  virtual int getRange(std::vector<std::string> &vecNames,
405  std::vector<double> &vecRanges);
406 
407  /*!
408  * \brief Get an ambient light illuminance measurement.
409  *
410  * \param strKey Sensor's unique name (key).
411  * \param [out] fAmbient Sensed ambient light (lux).
412  *
413  * \copydoc doc_return_std
414  */
415  virtual int getAmbientLight(const std::string &strKey, double &fAmbient);
416 
417  /*!
418  * \brief Get all sensor ambient light illuminance measurements.
419  *
420  * \param [out] vecNames Vector of sensor unique names.
421  * \param [out] vecAmbient Vector of associated sensor measured ambients
422  * (lux).
423  *
424  * \copydoc doc_return_std
425  */
426  virtual int getAmbientLight(std::vector<std::string> &vecNames,
427  std::vector<double> &vecAmbient);
428 
429  /*!
430  * \brief Run asynchronous job.
431  *
432  * The new job object must be already created.
433  *
434  * \par Context:
435  * Calling thread.
436  *
437  * \copydoc doc_return_std
438  */
439  int runAsyncJob();
440 
441  /*!
442  * \brief Cancel any asynchronous job.
443  *
444  * \note There may be a little delay between canceling an async job
445  * and the job actually stopping.
446  */
447  void cancelAsyncJob();
448 
449  /*!
450  * \brief Get the current asynchronous job state.
451  *
452  * \return Job state enum value.
453  */
455 
456  /*!
457  * \brief Get the last asynchronous job exit return code.
458  *
459  * \return
460  * Returns LAE_OK when job terminated successfully.
461  * Otherwise, returns \h_lt 0 \ref laelaps_ecodes.
462  */
463  int getAsyncJobRc();
464 
465 
466  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
467  // Reports
468  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
469 
470  /*!
471  * \brief Get the robot current status.
472  *
473  * \param [in,out] rptBotStatus Robot status report.
474  *
475  * \copydoc doc_return_std
476  */
477  int getRobotStatus(LaeRptRobotStatus &rptBotStatus);
478 
479  /*!
480  * \brief Get the robot full dynamic state.
481  *
482  * \param [in,out] rptDynamics Robot dynamics state report.
483  *
484  * \copydoc doc_return_std
485  */
486  int getDynamics(LaeRptDynamics &rptDynamics);
487 
488  /*!
489  * \brief Get simple navigation feedback.
490  *
491  * \param [in,out] pathFeedback Navigation feedback state.
492  *
493  * \copydoc doc_return_std
494  */
495  int getNavigationState(LaeSimplePathFeedback &pathFeedback);
496 
497  /*!
498  * \brief Get navigation feedback.
499  *
500  * \param [in,out] pathFeedback Navigation feedback state.
501  *
502  * \copydoc doc_return_std
503  */
504  int getNavigationState(LaePathFeedback &pathFeedback);
505 
506 
507  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
508  // Attribute Methods
509  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
510 
511  /*!
512  * \brief Test if connected to \h_laelaps hardware.
513  *
514  * \return Returns true or false.
515  */
516  bool isConnected();
517 
518  /*!
519  * \brief Get the \h_laelaps hardware version number.
520  *
521  * \param [out] nVerMajor Major version number.
522  * \param [out] nVerMinor Minor version number.
523  * \param [out] nVerRevision Revision version number.
524  */
525  void getVersion(int &nVerMajor, int &nVerMinor, int &nRevision);
526 
527  /*!
528  * \brief Get the \h_laelaps robotic arm hardware version string.
529  *
530  * Version number strings are of the dotted form maj.min.rev.
531  *
532  * \return Version string.
533  */
534  std::string getVersionString();
535 
536  /*!
537  * \brief Get the \h_laelaps product description.
538  *
539  * \return Returns reference to description.
540  */
542 
543  /*!
544  * \brief Convenience function to get this \h_laelaps description's base
545  * product id.
546  *
547  * \return Returns product id. See \ref LaeProdId.
548  */
549  int getProdId();
550 
551  /*!
552  * \brief Convenience function to get this \h_laelaps description's base
553  * product name.
554  *
555  * \return Returns product name. See \ref LaeProdName.
556  */
557  std::string getProdName();
558 
559  /*!
560  * \brief Get the \h_laelaps full brief descirption.
561  *
562  * \return Returns product brief description.
563  */
564  std::string getFullProdBrief();
565 
566  /*!
567  * \brief Test if robot is fully described via configuration XML.
568  *
569  * \return Returns true or false.
570  */
571  bool isDescribed();
572 
573  /*!
574  * \brief Get robot's operational mode.
575  *
576  * \return Robot operation mode. See \ref LaeRobotMode.
577  */
579 
580  /*!
581  * \brief Test if robot is current emergency stopped.
582  *
583  * \return Returns true or false.
584  */
585  bool isEStopped();
586 
587  /*!
588  * \brief Test if robot motor are currently being driven (powered).
589  *
590  * \return Returns true or false.
591  */
592  bool areMotorsPowered();
593 
594  /*!
595  * \brief Test if any joint in any of the kinematic chains is moving.
596  *
597  * \note RS160D motor controller provide no feedback.
598  *
599  * \return Returns true or false.
600  */
601  bool isInMotion();
602 
603  /*!
604  * \brief Test if robot is alarmed.
605  *
606  * \return Returns true or false.
607  */
608  bool isAlarmed();
609 
610  /*!
611  * \brief Test if robot is safe to operate, given the current robot and
612  * alarm state.
613  *
614  * \return Returns true or false.
615  */
616  bool canMove();
617 
618 
619  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
620  // Kinematic Access and Mapping Methods
621  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
622 
623  /*!
624  * \brief Get the robotic joint in kinematic chain.
625  *
626  * \param strName Powertrain unique name (primary key).
627  *
628  * \return If found, returns pointer to joint. Otherwise returns NULL.
629  */
630  LaePowertrain *getPowertrain(const std::string &strName);
631 
632  /*!
633  * \brief Get robotic joint in kinematic chain.
634  *
635  * \param nMotorId Motor id (secondary key).
636  *
637  * \return If found, returns pointer to joint. Otherwise returns NULL.
638  */
639  LaePowertrain *getPowertrain(int nMotorId);
640 
641  protected:
642  // state
643  bool m_bNoExec; ///< do [not] execute physical movements
644  LaeDesc m_descLaelaps; ///< \h_laelaps description
645  bool m_bIsConnected; ///< critical hardware [not] connected
646  LaeRobotMode m_eRobotMode; ///< robot operating mode
647  bool m_bIsEStopped; ///< robot is [not] emergency stopped
648  bool m_bAlarmState; ///< robot is [not] alarmed
649  double m_fGovernor; ///< speed limit governor setting
650 
651  // tuning
652  LaeTunes m_tunes; ///< tuning parameters
653 
654  // auxilliary power enables (moved to watchdog)
655  //LaeAuxBattOutEnable m_powerBatt; ///< top deck battery power enable
656  //LaeAux5VOutEnable m_power5V; ///< top deck regulated 5V power enable
657 
658  // I2C sensors, IMU, and watchdog
659  LaeI2C m_i2cBus; ///< \h_i2c sensor bus
661  sensor::imu::LaeImuCleanFlight m_imu; ///< inertia measurement unit
662  LaeWd m_watchdog; ///< watchdog sub-processor
663 
664  // kinodynamics
665  LaeKinematics m_kin; ///< robot base dynamics and kinematics
666 
667  // threads
668  LaeThreadAsync m_threadAsync; ///< asynchronous action thread
669  LaeThreadImu m_threadImu; ///< IMU thread
670  LaeThreadKin m_threadKin; ///< kinodynamics thread
671  LaeThreadRange m_threadRange; ///< ToF range sensors thread
672  LaeThreadWd m_threadWatchDog; ///< watchdog thread
673 
674  // asynchronous job control
675  LaeAsyncJob *m_pAsyncJob; ///< asynchronous job
676 
677  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
678  // Database Methods.
679  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
680 
681  /*!
682  * \brief Synchronize real-time database with current robot state.
683  */
684  void syncDb();
685 
686 
687  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
688  // Hardare Connection and Configuration Methods.
689  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
690 
691  /*!
692  * \brief Connect to the \h_laelaps built-in sensors.
693  *
694  * Sensors are not critical to core operation, so failed sensors are
695  * simply blacklisted, rather than failing the robot.
696  *
697  * \par Sensors:
698  * * IMU
699  * * ToF infrared distance sensors
700  *
701  * \copydoc doc_return_std
702  */
703  int connSensors();
704 
705  /*!
706  * \brief Connect to the watchdog subprocessor.
707  *
708  * \copydoc doc_return_std
709  */
710  int connWatchDog();
711 
712  /*!
713  * \brief Connect to the \h_laelaps motor controllers
714  *
715  * Motors controller serial interface support multi-drop, so one serial
716  * device can support up to 8 motor controllers.
717  *
718  * \param strDevMotorCtlrs Motor controllers serial device name.
719  * \param nBaudRate Motor controllers serial baudrate.
720  *
721  * \copydoc doc_return_std
722  */
723  int connMotorControllers(const std::string &strDevMotorCtlrs,
724  const int nBaudRate);
725 
726  /*!
727  * \brief Configure \h_laelaps for normal operation.
728  *
729  * The arm, end effector, and accessory effectors are configured for
730  * normal operation.
731  *
732  * \copydoc doc_return_std
733  */
734  int configForOperation();
735 
736 
737  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
738  // Threads
739  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
740 
741  /*!
742  * \brief Create and start all real-time persistent core threads.
743  *
744  * \copydoc doc_return_std
745  */
746  int startCoreThreads();
747 
748  /*!
749  * \brief Create and start a thread at the given priority and hertz.
750  *
751  * \param pThread Pointer the thread object.
752  * \param nPriority Thread priority.
753  * \param fHz Thread execution hertz.
754  *
755  * \copydoc doc_return_std
756  */
757  int startThread(LaeThread *pThread, int nPriority, double fHz);
758 
759 
760  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
761  // Friends
762  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
763 
764  friend class LaeRptDynamics;
765  friend class LaeRptRobotStatus;
766 
767  }; // class LaeRobot
768 
769 } // namespace laelaps
770 
771 
772 #endif // _LAE_ROBOT_H
LaeRobot(bool bNoExec=false)
Default initialization constructor.
Definition: laeRobot.cxx:164
int getAsyncJobRc()
Get the last asynchronous job exit return code.
Definition: laeRobot.cxx:1142
double m_fGovernor
speed limit governor setting
Definition: laeRobot.h:649
std::map< std::string, double > LaeMapDutyCycle
Duty cycle trajectory type.
Definition: laeTraj.h:269
int startCoreThreads()
Create and start all real-time persistent core threads.
Definition: laeRobot.cxx:1035
Laelaps thread base class interface.
bool m_bIsEStopped
robot is [not] emergency stopped
Definition: laeRobot.h:647
std::string getFullProdBrief()
Get the <b><i>Laelaps</i></b> full brief descirption.
Definition: laeRobot.cxx:761
Laelaps kinodynamics thread class interface.
Laelaps tuning data class.
Definition: laeTune.h:566
std::string getProdName()
Convenience function to get this <b><i>Laelaps</i></b> description&#39;s base product name...
Definition: laeRobot.cxx:756
int setAuxPower(const std::string &strName, LaeTriState eState)
Set top deck auxilliary power out enable state.
Definition: laeRobot.cxx:570
Trajectory classes interfaces.
Laelaps robotic mobile platform full description class.
Definition: laeDesc.h:451
int resetEStop()
Reset (clears) emergency stop condition.
Definition: laeRobot.cxx:451
LaeThreadImu m_threadImu
IMU thread.
Definition: laeRobot.h:669
bool isEStopped()
Test if robot is current emergency stopped.
Definition: laeRobot.cxx:776
LaeThreadAsync m_threadAsync
asynchronous action thread
Definition: laeRobot.h:668
int connect()
Connect to <b><i>Laelaps</i></b>.
Definition: laeRobot.cxx:193
int connSensors()
Connect to the <b><i>Laelaps</i></b> built-in sensors.
Definition: laeRobot.cxx:849
sensor::imu::LaeImuCleanFlight m_imu
inertia measurement unit
Definition: laeRobot.h:661
virtual int readDigitalPin(uint_t pin, uint_t &val)
Read the value of a digital pin on the watchdog subprocessor.
Definition: laeRobot.cxx:619
Laelaps kinematics class.
Definition: laeKin.h:119
virtual int getRangeSensorProps(const std::string &strKey, std::string &strRadiationType, double &fFoV, double &fBeamDir, double &fMin, double &fMax)
Get range sensor properties.
Definition: laeRobot.cxx:643
LaeRobotMode
<b><i>Laelaps</i></b> mode of operation.
Definition: laelaps.h:327
void cancelAsyncJob()
Cancel any asynchronous job.
Definition: laeRobot.cxx:1125
LaePowertrain * getPowertrain(const std::string &strName)
Get the robotic joint in kinematic chain.
LaeWd m_watchdog
watchdog sub-processor
Definition: laeRobot.h:662
LaeRobotMode getRobotMode()
Get robot&#39;s operational mode.
Definition: laeRobot.cxx:771
RoboClaw motor controller class interface.
int startThread(LaeThread *pThread, int nPriority, double fHz)
Create and start a thread at the given priority and hertz.
Definition: laeRobot.cxx:1088
bool canMove()
Test if robot is safe to operate, given the current robot and alarm state.
Definition: laeRobot.cxx:807
Laelaps WatchDog software class interface.
Laelaps PCA9548A I2C multiplexer switch interface.
double setGovernor(double fGovernor)
Set speed limit governor value.
Definition: laeRobot.cxx:547
int getRobotStatus(LaeRptRobotStatus &rptBotStatus)
Get the robot current status.
Definition: laeRobot.cxx:605
LaeDesc m_descLaelaps
<b><i>Laelaps</i></b> description
Definition: laeRobot.h:644
bool isDescribed()
Test if robot is fully described via configuration XML.
Definition: laeRobot.cxx:766
static const double GovernorDft
speed limit governor start-up default
Definition: laeRobot.h:106
Laelaps dynamics report.
Definition: laeReports.h:302
virtual int configDigitalPin(uint_t pin, uint_t dir)
Configure a digital pin on the the watchdog subprocessor.
Definition: laeRobot.cxx:614
LaeThreadKin m_threadKin
kinodynamics thread
Definition: laeRobot.h:670
LaeDesc & getLaelapsDesc()
Get the <b><i>Laelaps</i></b> product description.
Definition: laeRobot.cxx:746
Laelaps I2C class interface.
int configForOperation()
Configure <b><i>Laelaps</i></b> for normal operation.
Definition: laeRobot.cxx:947
Simple path feedback class.
Definition: laeTraj.h:510
virtual int getRange(const std::string &strKey, double &fRange)
Get a range measurement.
LaeTunes m_tunes
tuning parameters
Definition: laeRobot.h:652
Laelaps Odroid General Purpose I/O class interfaces.
Laelaps Time-of-Flight sensors. The ToFs are used as a virtual bumper for close-in obstacle detection...
int disconnect()
Disconnect from <b><i>Laelaps</i></b>.
Definition: laeRobot.cxx:333
int reload()
Reload <b><i>Laelaps</i></b>&#39;s reloadable configuration and reset operational parameters.
Definition: laeRobot.cxx:372
int estop()
Emergency stop.
Definition: laeRobot.cxx:421
The <b><i>Laelaps</i></b> namespace encapsulates all <b><i>Laelaps</i></b> related constructs...
Definition: laeAlarms.h:64
Interfaces of Laelaps requested and/or published report classes.
Laelaps robotic base mobile platform description class interface.
bool m_bIsConnected
critical hardware [not] connected
Definition: laeRobot.h:645
double getGovernor()
Get current speed limit governor setting.
Definition: laeRobot.cxx:559
int connMotorControllers(const std::string &strDevMotorCtlrs, const int nBaudRate)
Connect to the <b><i>Laelaps</i></b> motor controllers.
Definition: laeRobot.cxx:928
LaeAsyncJob::JobState getAsyncJobState()
Get the current asynchronous job state.
Definition: laeRobot.cxx:1130
void syncDb()
Synchronize real-time database with current robot state.
Definition: laeRobot.cxx:836
double incrementGovernor(double fDelta)
Increment/decrement speed limit governor value.
Definition: laeRobot.cxx:554
Laelaps common utilities.
sensor::vl6180::LaeRangeSensorGroup m_range
range sensor group.
Definition: laeRobot.h:660
Laelaps built-in Inertial Measurement Unit class interface.
Simple path feedback class.
Definition: laeTraj.h:821
std::string getVersionString()
Get the <b><i>Laelaps</i></b> robotic arm hardware version string.
Definition: laeRobot.cxx:741
bool isAlarmed()
Test if robot is alarmed.
Definition: laeRobot.cxx:791
LaeI2C m_i2cBus
I2C sensor bus.
Definition: laeRobot.h:659
The Laelaps kinematics and dynamics class interface.
Laelaps powertrain class interfaces.
int freeze()
Freeze robot and accessories at current position.
Definition: laeRobot.cxx:486
Asynchronous job base class.
virtual int getImu(double accel[], double gyro[], double rpy[], sensor::imu::Quaternion &q)
Get the last read and converted inertia data.
Definition: laeRobot.cxx:634
Laelaps tuning.
int getProdId()
Convenience function to get this <b><i>Laelaps</i></b> description&#39;s base product id...
Definition: laeRobot.cxx:751
LaeThreadRange m_threadRange
ToF range sensors thread.
Definition: laeRobot.h:671
virtual int getAmbientLight(const std::string &strKey, double &fAmbient)
Get an ambient light illuminance measurement.
Laelaps system devices.
int getDynamics(LaeRptDynamics &rptDynamics)
Get the robot full dynamic state.
Definition: laeRobot.cxx:682
Quaternion class.
Definition: laeImu.h:118
int getNavigationState(LaeSimplePathFeedback &pathFeedback)
Get simple navigation feedback.
Definition: laeRobot.cxx:693
bool m_bNoExec
do [not] execute physical movements
Definition: laeRobot.h:643
Laelaps robotic platform control and dynamics state interface.
Laelaps built-in Arduino sub-processor.
Laelaps range sensors thread class interface.
virtual ~LaeRobot()
Destructor.
Definition: laeRobot.cxx:188
int connWatchDog()
Connect to the watchdog subprocessor.
Definition: laeRobot.cxx:909
bool isInMotion()
Test if any joint in any of the kinematic chains is moving.
Definition: laeRobot.cxx:786
Laelaps asynchronouse thread class interface.
Laelaps motors, encoder, and controllers hardware abstraction interfaces.
Laelaps watchdog thread class interface.
bool areMotorsPowered()
Test if robot motor are currently being driven (powered).
Definition: laeRobot.cxx:781
bool m_bAlarmState
robot is [not] alarmed
Definition: laeRobot.h:648
int clearAlarms()
Attempt to clear all alarms.
Definition: laeRobot.cxx:598
Robot global status report.
Definition: laeReports.h:163
int setDutyCycles(const LaeMapDutyCycle &duty)
Set powertrain motor duty cycles.
Definition: laeRobot.cxx:536
void setRobotMode(LaeRobotMode eRobotMode)
Set robot&#39;s operational mode.
Definition: laeRobot.cxx:564
void getVersion(int &nVerMajor, int &nVerMinor, int &nRevision)
Get the <b><i>Laelaps</i></b> hardware version number.
Definition: laeRobot.cxx:731
int move(const LaeMapVelocity &velocity)
Move by setting powertrain angular wheel velocities.
Definition: laeRobot.cxx:517
Laelaps IMU thread class interface.
LaeKinematics m_kin
robot base dynamics and kinematics
Definition: laeRobot.h:665
Laelaps supported cameras.
int release()
Release robot and accessories.
Definition: laeRobot.cxx:501
LaeAsyncJob * m_pAsyncJob
asynchronous job
Definition: laeRobot.h:675
std::map< std::string, double > LaeMapVelocity
Velocity trajectory type.
Definition: laeTraj.h:258
int stop()
Stop robot with full dynamic braking.
Definition: laeRobot.cxx:481
virtual int readAnalogPin(uint_t pin, uint_t &val)
Read the value of an analog pin on the watchdog subprocessor.
Definition: laeRobot.cxx:629
LaeTriState
<b><i>Laelaps</i></b> tri-state type.
Definition: laelaps.h:300
Powertrain data class.
bool isConnected()
Test if connected to <b><i>Laelaps</i></b> hardware.
Definition: laeRobot.cxx:726
int runAsyncJob()
Run asynchronous job.
Definition: laeRobot.cxx:1113
LaeThreadWd m_threadWatchDog
watchdog thread
Definition: laeRobot.h:672
Laelaps robotic manipulator plus accesories class.
Definition: laeRobot.h:103
Range sensor group class.
Definition: laeVL6180.h:1535
Top-level package include file.
LaeRobotMode m_eRobotMode
robot operating mode
Definition: laeRobot.h:646
virtual int writeDigitalPin(uint_t pin, uint_t val)
Write a value to a digital pin on the watchdog subprocessor.
Definition: laeRobot.cxx:624