@@ -291,6 +291,7 @@ uint16_t BNO080::parseInputReport(void)
291
291
uint16_t data3 = (uint16_t )shtpData[5 + 9 ] << 8 | shtpData[5 + 8 ];
292
292
uint16_t data4 = 0 ;
293
293
uint16_t data5 = 0 ; // We would need to change this to uin32_t to capture time stamp value on Raw Accel/Gyro/Mag reports
294
+ uint16_t data6 = 0 ;
294
295
295
296
if (dataLength - 5 > 9 )
296
297
{
@@ -300,6 +301,11 @@ uint16_t BNO080::parseInputReport(void)
300
301
{
301
302
data5 = (uint16_t )shtpData[5 + 13 ] << 8 | shtpData[5 + 12 ];
302
303
}
304
+ if (dataLength - 5 > 13 )
305
+ {
306
+ data6 = (uint16_t )shtpData[5 + 15 ] << 8 | shtpData[5 + 14 ];
307
+ }
308
+
303
309
304
310
// Store these generic values to their proper global variable
305
311
if (shtpData[5 ] == SENSOR_REPORTID_ACCELEROMETER)
@@ -317,12 +323,22 @@ uint16_t BNO080::parseInputReport(void)
317
323
rawLinAccelZ = data3;
318
324
}
319
325
else if (shtpData[5 ] == SENSOR_REPORTID_GYROSCOPE)
320
- {
326
+ {
321
327
gyroAccuracy = status;
322
328
rawGyroX = data1;
323
329
rawGyroY = data2;
324
330
rawGyroZ = data3;
325
331
}
332
+ else if (shtpData[5 ] == SENSOR_REPORTID_UNCALIBRATED_GYRO)
333
+ {
334
+ UncalibGyroAccuracy = status;
335
+ rawUncalibGyroX = data1;
336
+ rawUncalibGyroY = data2;
337
+ rawUncalibGyroZ = data3;
338
+ rawBiasX = data4;
339
+ rawBiasY = data5;
340
+ rawBiasZ = data6;
341
+ }
326
342
else if (shtpData[5 ] == SENSOR_REPORTID_MAGNETIC_FIELD)
327
343
{
328
344
magAccuracy = status;
@@ -697,6 +713,61 @@ uint8_t BNO080::getGyroAccuracy()
697
713
return (gyroAccuracy);
698
714
}
699
715
716
+ // Gets the full uncalibrated gyro vector
717
+ // x,y,z,bx,by,bz output floats
718
+ void BNO080::getUncalibratedGyro (float &x, float &y, float &z, float &bx, float &by, float &bz, uint8_t &accuracy)
719
+ {
720
+ x = qToFloat (rawUncalibGyroX, gyro_Q1);
721
+ y = qToFloat (rawUncalibGyroY, gyro_Q1);
722
+ z = qToFloat (rawUncalibGyroZ, gyro_Q1);
723
+ bx = qToFloat (rawBiasX, gyro_Q1);
724
+ by = qToFloat (rawBiasY, gyro_Q1);
725
+ bz = qToFloat (rawBiasZ, gyro_Q1);
726
+ accuracy = UncalibGyroAccuracy;
727
+ }
728
+ // Return the gyro component
729
+ float BNO080::getUncalibratedGyroX ()
730
+ {
731
+ float gyro = qToFloat (rawUncalibGyroX, gyro_Q1);
732
+ return (gyro);
733
+ }
734
+ // Return the gyro component
735
+ float BNO080::getUncalibratedGyroY ()
736
+ {
737
+ float gyro = qToFloat (rawUncalibGyroY, gyro_Q1);
738
+ return (gyro);
739
+ }
740
+ // Return the gyro component
741
+ float BNO080::getUncalibratedGyroZ ()
742
+ {
743
+ float gyro = qToFloat (rawUncalibGyroZ, gyro_Q1);
744
+ return (gyro);
745
+ }
746
+ // Return the gyro component
747
+ float BNO080::getUncalibratedGyroBiasX ()
748
+ {
749
+ float gyro = qToFloat (rawBiasX, gyro_Q1);
750
+ return (gyro);
751
+ }
752
+ // Return the gyro component
753
+ float BNO080::getUncalibratedGyroBiasY ()
754
+ {
755
+ float gyro = qToFloat (rawBiasY, gyro_Q1);
756
+ return (gyro);
757
+ }
758
+ // Return the gyro component
759
+ float BNO080::getUncalibratedGyroBiasZ ()
760
+ {
761
+ float gyro = qToFloat (rawBiasZ, gyro_Q1);
762
+ return (gyro);
763
+ }
764
+
765
+ // Return the gyro component
766
+ uint8_t BNO080::getUncalibratedGyroAccuracy ()
767
+ {
768
+ return (UncalibGyroAccuracy);
769
+ }
770
+
700
771
// Gets the full gravity vector
701
772
// x,y,z output floats
702
773
void BNO080::getGravity (float &x, float &y, float &z, uint8_t &accuracy)
@@ -1113,6 +1184,7 @@ uint8_t BNO080::resetReason()
1113
1184
// See https://en.wikipedia.org/wiki/Q_(number_format)
1114
1185
float BNO080::qToFloat (int16_t fixedPointValue, uint8_t qPoint)
1115
1186
{
1187
+
1116
1188
float qFloat = fixedPointValue;
1117
1189
qFloat *= pow (2 , qPoint * -1 );
1118
1190
return (qFloat);
@@ -1166,6 +1238,12 @@ void BNO080::enableGyro(uint16_t timeBetweenReports)
1166
1238
setFeatureCommand (SENSOR_REPORTID_GYROSCOPE, timeBetweenReports);
1167
1239
}
1168
1240
1241
+ // Sends the packet to enable the uncalibrated gyro
1242
+ void BNO080::enableUncalibratedGyro (uint16_t timeBetweenReports)
1243
+ {
1244
+ setFeatureCommand (SENSOR_REPORTID_UNCALIBRATED_GYRO, timeBetweenReports);
1245
+ }
1246
+
1169
1247
// Sends the packet to enable the magnetometer
1170
1248
void BNO080::enableMagnetometer (uint16_t timeBetweenReports)
1171
1249
{
0 commit comments