Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
laeThreadRange.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Laelaps
4 //
5 // File: laeThreadRange.h
6 //
7 /*! \file
8  *
9  * $LastChangedDate: 2015-08-07 14:25:35 -0600 (Fri, 07 Aug 2015) $
10  * $Rev: 4051 $
11  *
12  * \brief Laelaps range sensors thread class interface.
13  *
14  * \author Robin Knight (robin.knight@roadnarrows.com)
15  *
16  * \par Copyright
17  * \h_copy 2015-2018. RoadNarrows LLC.\n
18  * http://www.roadnarrows.com\n
19  * All Rights Reserved
20  */
21 /*
22  * @EulaBegin@
23  *
24  * Unless otherwise stated explicitly, all materials contained are copyrighted
25  * and may not be used without RoadNarrows LLC's written consent,
26  * except as provided in these terms and conditions or in the copyright
27  * notice (documents and software) or other proprietary notice provided with
28  * the relevant materials.
29  *
30  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY
31  * MEMBERS/EMPLOYEES/CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE
32  * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
33  * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
34  * DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN
35  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37  * THE AUTHORS AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
38  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
39  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
40  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
41  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
42  *
43  * @EulaEnd@
44  */
45 ////////////////////////////////////////////////////////////////////////////////
46 
47 #ifndef _LAE_THREAD_RANGE_H
48 #define _LAE_THREAD_RANGE_H
49 
50 #include <sys/types.h>
51 #include <sys/time.h>
52 #include <time.h>
53 #include <pthread.h>
54 
55 #include <string>
56 #include <vector>
57 
58 #include "rnr/rnrconfig.h"
59 #include "rnr/log.h"
60 
61 #include "Laelaps/laelaps.h"
62 #include "Laelaps/laeUtils.h"
63 #include "Laelaps/laeTune.h"
64 
65 #include "Laelaps/laeGpio.h"
66 #include "Laelaps/laeVL6180.h"
67 
68 #include "Laelaps/laeThread.h"
69 
70 /*!
71  * \brief The \h_laelaps namespace encapsulates all \h_laelaps related
72  * constructs.
73  */
74 namespace laelaps
75 {
76  //----------------------------------------------------------------------------
77  // LaeThreadRange Class
78  //----------------------------------------------------------------------------
79 
80  /*!
81  * Range sensors thread class.
82  */
83  class LaeThreadRange : public LaeThread
84  {
85  public:
86  static const double ThreadRangePrioDft; ///< default priority
87  static const double ThreadRangeHzDft; ///< default run rate
88 
89  /*!
90  * \brief Default constructor.
91  */
93 
94  /*!
95  * \brief Destructor.
96  */
97  virtual ~LaeThreadRange();
98 
99  /*!
100  * \brief Reload tunable paramaters.
101  *
102  * This function executes under the lock/unlock mutex.
103  */
104  int reload(const LaeTunes &tunes);
105 
106  protected:
107  sensor::vl6180::LaeRangeSensorGroup &m_hwif; ///< hardware interface
108  LaeI2CMuxReset m_reset; ///< multiplexer reset
109  double m_fTSubTask; ///< sub-task time (seconds)
110  size_t m_iSensor; ///< next scheduled sensor index
111 
112  /*!
113  * \brief Execute watchdog task within scheduled cycle.
114  *
115  * This function executes under the lock/unlock mutex.
116  *
117  * \par Context:
118  * This thread.
119  */
120  virtual void exec();
121  };
122 
123 } // namespace laelaps
124 
125 
126 #endif // _LAE_THREAD_RANGE_H
Laelaps thread base class interface.
LaeI2CMuxReset m_reset
multiplexer reset
Laelaps tuning data class.
Definition: laeTune.h:566
size_t m_iSensor
next scheduled sensor index
double m_fTSubTask
sub-task time (seconds)
static const double ThreadRangePrioDft
default priority
sensor::vl6180::LaeRangeSensorGroup & m_hwif
hardware interface
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...
The <b><i>Laelaps</i></b> namespace encapsulates all <b><i>Laelaps</i></b> related constructs...
Definition: laeAlarms.h:64
virtual void exec()
Execute watchdog task within scheduled cycle.
Laelaps common utilities.
Laelaps tuning.
static const double ThreadRangeHzDft
default run rate
Laelaps I2C multiplexer reset class.
Definition: laeGpio.h:303
int reload(const LaeTunes &tunes)
Reload tunable paramaters.
virtual ~LaeThreadRange()
Destructor.
LaeThreadRange(sensor::vl6180::LaeRangeSensorGroup &hwif)
Default constructor.
Range sensor group class.
Definition: laeVL6180.h:1535
Top-level package include file.