Example/test programs for my BNO080 driver.

Dependencies:   BNO080

BNO080 Driver Examples

These examples show how to use some of the functionality on my BNO080 driver. To get started with MBed CLI:

Build Instructions

$ hg clone https://MultipleMonomials@os.mbed.com/users/MultipleMonomials/code/BNO080-Examples/
$ cd BNO080-Examples
$ mbed deploy
$ mbed compile
Revision:
1:14c135ea7134
Parent:
0:82ee5f7adbb0
Child:
3:f72d98d0095e
--- a/BNOTestSuite.cpp	Sat Dec 29 04:14:43 2018 -0800
+++ b/BNOTestSuite.cpp	Fri Jun 14 20:33:19 2019 -0700
@@ -309,6 +309,29 @@
 	}
 }
 
+void BNOTestSuite::test_permanentOrientation()
+{
+	pc.printf("Setting permanent sensor orientation...\n");
+	Timer orientationTimer;
+	orientationTimer.start();
+
+	// rotate sensor 90 degrees CCW about the Y axis, so X points up, Y points back, and Z points out
+	// (values from BNO datasheet page 41)
+	// imu.setPermanentOrientation(Quaternion(1.0f/SQRT_2, -1.0f/SQRT_2, 0, 0));
+
+	// rotate sensor 180 degrees about Y axis
+	//with these quaternion values x axis is oriented to point toward BRB, Z points up and Y points out towards you when you face the unit
+	// see page 5 and 11 of hillcrestlabs FSM30X datasheet
+	imu.setPermanentOrientation(Quaternion(0,-1, 0, 0)); 
+	
+	// reset to default orientation
+	//imu.setPermanentOrientation(Quaternion(0, 0, 0, 0));
+
+	orientationTimer.stop();
+	pc.printf("Done setting orientation (took %.03f seconds)\r\n", orientationTimer.read());
+
+}
+
 void BNOTestSuite::test_disable()
 {
 	const size_t update_rate_ms = 200;
@@ -386,8 +409,9 @@
 	pc.printf("8. Test stability classifier\r\n");
 	pc.printf("9. Test metadata reading (requires BNO_DEBUG = 1)\r\n");
 	pc.printf("10. Test set orientation\r\n");
-	pc.printf("11. Test disabling reports\r\n");
-	pc.printf("12. Exit test suite\r\n");
+	pc.printf("11. Test set permanent orientation\r\n");
+	pc.printf("12. Test disabling reports\r\n");
+	pc.printf("13. Exit test suite\r\n");
 
 	pc.scanf("%d", &test);
 	pc.printf("Running test %d:\r\n\n", test);
@@ -426,9 +450,12 @@
 			harness.test_orientation();
 			break;
 		case 11:
+			harness.test_permanentOrientation();
+			break;
+		case 12:
 			harness.test_disable();
 			break;
-		case 12:
+		case 13:
 			pc.printf("Exiting test suite.\r\n");
 			return 0;
 		default: