Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
laeDb.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Laelaps
4 //
5 // Library: liblaelaps
6 //
7 // File: laeDb.cxx
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2015-12-28 10:06:00 -0700 (Mon, 28 Dec 2015) $
12  * $Rev: 4247 $
13  *
14  * \brief Laelaps real-time "database" implementation.
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 #include "rnr/rnrconfig.h"
50 
51 #include "Laelaps/laelaps.h"
52 #include "Laelaps/laeSysDev.h"
53 #include "Laelaps/RoboClaw.h"
54 #include "Laelaps/laeMotor.h"
55 #include "Laelaps/laeVL6180.h"
56 #include "Laelaps/laeImu.h"
57 #include "Laelaps/laeAlarms.h"
58 #include "Laelaps/laeTune.h"
59 #include "Laelaps/laeThread.h"
60 #include "Laelaps/laeThreadWd.h"
61 #include "Laelaps/laeDb.h"
62 
63 using namespace std;
64 using namespace laelaps;
65 using namespace motor::roboclaw;
66 using namespace sensor::vl6180;
67 
68 //
69 // The real-time database.
70 //
72 {
73  // header
74  {0, }, // signature (keep first)
75  LAE_VERSION(1, 2, 0), // db version
76 
77  // product
78  {
79  LaeProdIdUnknown, // RoadNarrows product id
80  LAE_VERSION(0, 0, 0), // hardware version
81  {0, 0}, // motor controllers firmware version
82  0, // IMU firmware version
83  0, // watchdog sub-processor firmware version
84  0, // time-of-flight mux sub-processor firmware version
85  0 // accessory sub-processor firmware version
86  },
87 
88  // configuration
89  {
90  LaeTuneThreadKinHzDft, ///< kinodynamics thread exec rate (Hertz)
91  LaeTuneThreadImuHzDft, ///< imu thread exec rate (Hertz)
92  LaeTuneThreadRangeHzDft, ///< range thread exec rate (Hertz)
93  LaeThreadWd::ThreadWdHzDft, ///< watchdog thread exec rate (Hertz)
94  LaeTuneWdTimeoutDft, ///< watchdog timeout (seconds)
95  LaeTuneVelDerateDft ///< velocity derate (percent)
96  },
97 
98  // robot top-level status
99  {
100  false, // critical hardware [not] connected
101  LaeRobotModeUnknown, // robot mode
102  false, // robot is [not] emergency stopped
103  false, // robot is [not] alarmed
104  false, // robot motors are [not] driven
105  false, // 1+ motors are [not] moving
106  0.0 // average interior temperature (C)
107  },
108 
109  // enables
110  {
111  false, // motor controllers enable
112  false, // battery aux. port enable
113  false, // 5V aux. port enable
114  false, // Range sensors enable
115  false, // IMU sensor enable
116  true // front camera enable
117  },
118 
119  // motor controllers
120  {
121  // front
122  {
123  ParamStatusNormal, // status
124  0.0, // temperature
125  0.0, // battery voltage
126  {0.0, } // motor currents
127  },
128  // rear
129  {
130  ParamStatusNormal, // status
131  0.0, // temperature
132  0.0, // battery voltage
133  {0.0, } // motor currents
134  }
135  },
136 
137  // range sensors
138  {
140  },
141 
142  // imu
143  {
144  {0.0, }, // acceleration
145  {0.0, }, // gyroscope
146  {0.0, }, // roll, pitch, yaw
147  },
148 
149  // kinodynamics
150  {
151  { {0, 0, 0.0, 0.0, 0.0, 0.0}, }, // powertrain kinodynamics
152  {0.0, 0.0, 0.0, 0.0, 0.0} // robot kinodynamics
153  },
154 
155  // energy monitoring
156  {
157  false, // battery is not being charged
158  0.0, // power supply jack voltage
159  LaeTuneBattNominalV, // battery voltage
160  100.0, // battery state of charge
161  0.1, // total robot current draw
162  0.5, // total robot power
163  },
164 
165  // alarms
166  {
167  // system alarms
168  {false, LAE_ALARM_NONE, LAE_WARN_NONE},
169 
170  // battery alarms
171  {false, LAE_ALARM_NONE, LAE_WARN_NONE},
172 
173  // motor controller alarms
174  {false, LAE_ALARM_NONE, LAE_WARN_NONE},
175 
176  // motor alarms
177  {false, LAE_ALARM_NONE, LAE_WARN_NONE},
178 
179  // sensor alarms
180  {false, LAE_ALARM_NONE, LAE_WARN_NONE}
181  }
182 };
Laelaps thread base class interface.
#define VL6180X_AMBIENT_MIN
minimum ambient light (lux)
Definition: laeVL6180.h:147
RoboClaw motor controller class interface.
LaeDb RtDb
The real-time database.
Definition: laeDb.h:244
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
#define VL6180X_RANGE_NO_OBJ
no object detected
Definition: laeVL6180.h:133
Laelaps built-in Inertial Measurement Unit class interface.
Laelaps tuning.
Laelaps system devices.
Laelaps motors, encoder, and controllers hardware abstraction interfaces.
Laelaps watchdog thread class interface.
Laelaps alarm monitoring class interface.
#define LAE_VERSION(major, minor, revision)
Convert version triplet to integer equivalent.
Definition: laelaps.h:158
Simple real-time database structure.
Definition: laeDb.h:223
Laelaps real-time "database".
Top-level package include file.