@@ -135,6 +135,13 @@ void BNO080::parseInputReport(void)
135
135
rawAccelY = data2;
136
136
rawAccelZ = data3;
137
137
}
138
+ else if (shtpData[5 ] == SENSOR_REPORTID_LINEAR_ACCELERATION)
139
+ {
140
+ accelLinAccuracy = status;
141
+ rawLinAccelX = data1;
142
+ rawLinAccelY = data2;
143
+ rawLinAccelZ = data3;
144
+ }
138
145
else if (shtpData[5 ] == SENSOR_REPORTID_GYROSCOPE)
139
146
{
140
147
gyroAccuracy = status;
@@ -221,7 +228,7 @@ float BNO080::getQuatRadianAccuracy()
221
228
// Return the acceleration component
222
229
uint8_t BNO080::getQuatAccuracy ()
223
230
{
224
- return (accelAccuracy );
231
+ return (quatAccuracy );
225
232
}
226
233
227
234
// Return the acceleration component
@@ -251,6 +258,35 @@ uint8_t BNO080::getAccelAccuracy()
251
258
return (accelAccuracy);
252
259
}
253
260
261
+ // linear acceleration, i.e. minus gravity
262
+
263
+ // Return the acceleration component
264
+ float BNO080::getLinAccelX ()
265
+ {
266
+ float accel = qToFloat (rawLinAccelX, linear_accelerometer_Q1);
267
+ return (accel);
268
+ }
269
+
270
+ // Return the acceleration component
271
+ float BNO080::getLinAccelY ()
272
+ {
273
+ float accel = qToFloat (rawLinAccelY, linear_accelerometer_Q1);
274
+ return (accel);
275
+ }
276
+
277
+ // Return the acceleration component
278
+ float BNO080::getLinAccelZ ()
279
+ {
280
+ float accel = qToFloat (rawLinAccelZ, linear_accelerometer_Q1);
281
+ return (accel);
282
+ }
283
+
284
+ // Return the acceleration component
285
+ uint8_t BNO080::getLinAccelAccuracy ()
286
+ {
287
+ return (accelLinAccuracy);
288
+ }
289
+
254
290
// Return the gyro component
255
291
float BNO080::getGyroX ()
256
292
{
@@ -536,6 +572,12 @@ void BNO080::enableAccelerometer(uint16_t timeBetweenReports)
536
572
setFeatureCommand (SENSOR_REPORTID_ACCELEROMETER, timeBetweenReports);
537
573
}
538
574
575
+ // Sends the packet to enable the accelerometer
576
+ void BNO080::enableLinearAccelerometer (uint16_t timeBetweenReports)
577
+ {
578
+ setFeatureCommand (SENSOR_REPORTID_LINEAR_ACCELERATION, timeBetweenReports);
579
+ }
580
+
539
581
// Sends the packet to enable the gyro
540
582
void BNO080::enableGyro (uint16_t timeBetweenReports)
541
583
{
@@ -883,4 +925,4 @@ void BNO080::printPacket(void)
883
925
_debugPort->println ();
884
926
}
885
927
886
- }
928
+ }
0 commit comments