-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModule_Base_RPI3B.h
349 lines (283 loc) · 9.22 KB
/
Module_Base_RPI3B.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
///-------------------------------------------------------------------------------------------------
/// @file POC\Module_Base_RPI3B.h.
///
/// @brief Declares the module base rpi 3 b class
#pragma once
#include "BasicPOCModule.h"
#include "PAC1720.h"
#include "BMI055.h"
#include <math.h>
#include <thread>
#include <queue>
#include <list>
#include "Vector3d.h"
#include "TimedState.h"
#include "CoordinateSystem3D.h"
#include "RepeatedTask.h"
using namespace std;
///-------------------------------------------------------------------------------------------------
/// @class BaseModuleController
///
/// @brief Example of a module specific POCController class. This can be used to customize the
/// controller by adding additional functionality
///
/// @author Benjamin
/// @date 08.09.2020
class BaseModuleController : public POCController {
public:
///-------------------------------------------------------------------------------------------------
/// @fn BaseModuleController::BaseModuleController(short slaveId, BasicPOCModule* itsPOCModule, list<Component*>& componentList)
///
/// @brief Constructor
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @param slaveId Identifier for the slave.
/// @param [in,out] itsPOCModule If non-null, its poc module.
/// @param [in,out] componentList [in,out] If non-null, list of components.
BaseModuleController(short slaveId, BasicPOCModule* itsPOCModule, list<Component*>& componentList) :
POCController("Base Module Controller", slaveId, itsPOCModule, componentList) {
}
};
///-------------------------------------------------------------------------------------------------
/// @class Module_Base_RPI3B
///
/// @brief Module class for the Raspberry Pi 3B base module
///
/// @author Benjamin
/// @date 08.09.2020
class Module_Base_RPI3B : public BasicPOCModule
{
private:
/// @brief The controller of this module
POCController pocController;
/// @brief The pac
PAC1720 pac;
/// @brief The inertial measurement unit located on this board
BMI055IMU imu;
/// @brief The gyroscope located on this board
BMI055Gyro gyro;
RepeatedTask gyroTask;
bool shouldStop = false;
/// @brief The current coordinate system of this module, base point is the position of the imu
CoordinateSystem3d<double> coordinateSystem;
/// @brief The imu temperature degrees c
float imuTemperature_degC;
public:
///-------------------------------------------------------------------------------------------------
/// @fn Module_Base_RPI3B::Module_Base_RPI3B();
///
/// @brief Default constructor
///
/// @author Benjamin
/// @date 28.09.2020
Module_Base_RPI3B();
///-------------------------------------------------------------------------------------------------
/// @fn void Module_Base_RPI3B::init();
///
/// @brief Initializes this object
///
/// @author Benjamin
/// @date 28.09.2020
void init();
///-------------------------------------------------------------------------------------------------
/// @fn void Module_Base_RPI3B::selfTest();
///
/// @brief Tests self
///
/// @author Benjamin
/// @date 28.09.2020
void selfTest();
///-------------------------------------------------------------------------------------------------
/// @fn const uint16_t Module_Base_RPI3B::getId() const;
///
/// @brief Gets the identifier
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The identifier.
const uint16_t getId() const;
///-------------------------------------------------------------------------------------------------
/// @fn const string Module_Base_RPI3B::getClassName() const;
///
/// @brief Gets class name
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The class name.
const string getClassName() const;
///-------------------------------------------------------------------------------------------------
/// @fn double Module_Base_RPI3B::getCurrentDrawHS();
///
/// @brief Gets current draw hs
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The current draw hs.
double getCurrentDrawHS();
///-------------------------------------------------------------------------------------------------
/// @fn double Module_Base_RPI3B::getVoltageHS();
///
/// @brief Gets voltage hs
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The voltage hs.
double getVoltageHS();
///-------------------------------------------------------------------------------------------------
/// @fn double Module_Base_RPI3B::getPowerHS();
///
/// @brief Gets power hs
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The power hs.
double getPowerHS();
///-------------------------------------------------------------------------------------------------
/// @fn double Module_Base_RPI3B::getCurrentDrawLS();
///
/// @brief Gets current draw ls
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The current draw ls.
double getCurrentDrawLS();
///-------------------------------------------------------------------------------------------------
/// @fn double Module_Base_RPI3B::getVoltageLS();
///
/// @brief Gets voltage ls
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The voltage ls.
double getVoltageLS();
///-------------------------------------------------------------------------------------------------
/// @fn double Module_Base_RPI3B::getPowerLS();
///
/// @brief Gets power ls
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The power ls.
double getPowerLS();
///-------------------------------------------------------------------------------------------------
/// @fn float Module_Base_RPI3B::getIMUBufferHealth() const;
///
/// @brief Gets imu buffer health
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The imu buffer health.
float getIMUBufferHealth() const;
///-------------------------------------------------------------------------------------------------
/// @fn float Module_Base_RPI3B::getGyroBufferHealth() const;
///
/// @brief Gets gyro buffer health
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The gyro buffer health.
float getGyroBufferHealth() const;
///-------------------------------------------------------------------------------------------------
/// @fn Vector3d<double> Module_Base_RPI3B::getAcceleration_g() const;
///
/// @brief Gets acceleration g
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The acceleration g.
Vector3d<double> getAcceleration_g() const;
///-------------------------------------------------------------------------------------------------
/// @fn Vector3d<double> Module_Base_RPI3B::getVelocity_ms() const;
///
/// @brief Gets velocity milliseconds
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The velocity milliseconds.
Vector3d<double> getVelocity_ms() const;
///-------------------------------------------------------------------------------------------------
/// @fn Vector3d<double> Module_Base_RPI3B::getLocation_m() const;
///
/// @brief Gets location m
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The location m.
Vector3d<double> getLocation_m() const;
///-------------------------------------------------------------------------------------------------
/// @fn Vector3d<double> Module_Base_RPI3B::getRotation() const;
///
/// @brief Gets the rotation
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The rotation.
Vector3d<double> getRotation() const;
///-------------------------------------------------------------------------------------------------
/// @fn Vector3d<double> Module_Base_RPI3B::getRotationRate_s() const;
///
/// @brief Gets rotation rate s
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The rotation rate s.
Vector3d<double> getRotationRate_s() const;
///-------------------------------------------------------------------------------------------------
/// @fn Vector3d<double> Module_Base_RPI3B::getRotationAcceleration_s2() const;
///
/// @brief Gets rotation acceleration s 2
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The rotation acceleration s 2.
Vector3d<double> getRotationAcceleration_s2() const;
///-------------------------------------------------------------------------------------------------
/// @fn float Module_Base_RPI3B::getIMUTemperature_degC() const;
///
/// @brief Gets imu temperature degrees c
///
/// @author Benjamin
/// @date 28.09.2020
///
/// @returns The imu temperature degrees c.
void getUnitVectors(Vector3d<double>& eX, Vector3d<double>& eY, Vector3d<double>& eZ);
Vector3d<double> getEulerAngles() const;
float getIMUTemperature_degC() const;
~Module_Base_RPI3B();
private:
//void updateIMUData();
///-------------------------------------------------------------------------------------------------
/// @fn void Module_Base_RPI3B::updateIMUTemperature();
///
/// @brief Updates the imu temperature
///
/// @author Benjamin
/// @date 28.09.2020
void updateIMUTemperature();
///-------------------------------------------------------------------------------------------------
/// @fn void Module_Base_RPI3B::updateGyroData();
///
/// @brief Updates the gyro data
///
/// @author Benjamin
/// @date 28.09.2020
void updateGyroData();
};