@@ -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;
@@ -690,6 +706,62 @@ uint8_t BNO080::getGyroAccuracy()
690
706
return (gyroAccuracy);
691
707
}
692
708
709
+ // Gets the full uncalibrated gyro vector
710
+ // x,y,z,bx,by,bz output floats
711
+ void BNO080::getUncalibratedGyro (float &x, float &y, float &z, float &bx, float &by, float &bz, uint8_t &accuracy)
712
+ {
713
+ x = qToFloat (rawUncalibGyroX, gyro_Q1);
714
+ y = qToFloat (rawUncalibGyroY, gyro_Q1);
715
+ z = qToFloat (rawUncalibGyroZ, gyro_Q1);
716
+ bx = qToFloat (rawBiasX, gyro_Q1);
717
+ by = qToFloat (rawBiasY, gyro_Q1);
718
+ bz = qToFloat (rawBiasZ, gyro_Q1);
719
+ accuracy = UncalibGyroAccuracy;
720
+ }
721
+ // Return the gyro component
722
+ float BNO080::getUncalibratedGyroX ()
723
+ {
724
+ float gyro = qToFloat (rawUncalibGyroX, gyro_Q1);
725
+ return (gyro);
726
+ }
727
+ // Return the gyro component
728
+ float BNO080::getUncalibratedGyroY ()
729
+ {
730
+ float gyro = qToFloat (rawUncalibGyroY, gyro_Q1);
731
+ return (gyro);
732
+ }
733
+ // Return the gyro component
734
+ float BNO080::getUncalibratedGyroZ ()
735
+ {
736
+ float gyro = qToFloat (rawUncalibGyroZ, gyro_Q1);
737
+ return (gyro);
738
+ }
739
+ // Return the gyro component
740
+ float BNO080::getUncalibratedGyroBiasX ()
741
+ {
742
+ float gyro = qToFloat (rawBiasX, gyro_Q1);
743
+ return (gyro);
744
+ }
745
+ // Return the gyro component
746
+ float BNO080::getUncalibratedGyroBiasY ()
747
+ {
748
+ float gyro = qToFloat (rawBiasY, gyro_Q1);
749
+ return (gyro);
750
+ }
751
+ // Return the gyro component
752
+ float BNO080::getUncalibratedGyroBiasZ ()
753
+ {
754
+ float gyro = qToFloat (rawBiasZ, gyro_Q1);
755
+ return (gyro);
756
+ }
757
+
758
+ // Return the gyro component
759
+ uint8_t BNO080::getUncalibratedGyroAccuracy ()
760
+ {
761
+ return (UncalibGyroAccuracy);
762
+ }
763
+
764
+
693
765
// Gets the full mag vector
694
766
// x,y,z output floats
695
767
void BNO080::getMag (float &x, float &y, float &z, uint8_t &accuracy)
@@ -1071,6 +1143,7 @@ uint8_t BNO080::resetReason()
1071
1143
// See https://en.wikipedia.org/wiki/Q_(number_format)
1072
1144
float BNO080::qToFloat (int16_t fixedPointValue, uint8_t qPoint)
1073
1145
{
1146
+
1074
1147
float qFloat = fixedPointValue;
1075
1148
qFloat *= pow (2 , qPoint * -1 );
1076
1149
return (qFloat);
@@ -1118,6 +1191,12 @@ void BNO080::enableGyro(uint16_t timeBetweenReports)
1118
1191
setFeatureCommand (SENSOR_REPORTID_GYROSCOPE, timeBetweenReports);
1119
1192
}
1120
1193
1194
+ // Sends the packet to enable the uncalibrated gyro
1195
+ void BNO080::enableUncalibratedGyro (uint16_t timeBetweenReports)
1196
+ {
1197
+ setFeatureCommand (SENSOR_REPORTID_UNCALIBRATED_GYRO, timeBetweenReports);
1198
+ }
1199
+
1121
1200
// Sends the packet to enable the magnetometer
1122
1201
void BNO080::enableMagnetometer (uint16_t timeBetweenReports)
1123
1202
{
0 commit comments