Added BNO080Wheelchair.h
Dependents: BNO080_program wheelchaircontrol8 Version1-9 BNO080_program
Diff: BNO080Wheelchair.cpp
- Revision:
- 12:f013530d8358
- Parent:
- 11:dbe6d8d0ceb1
--- a/BNO080Wheelchair.cpp Fri Aug 02 23:34:30 2019 +0000 +++ b/BNO080Wheelchair.cpp Wed Aug 07 18:49:44 2019 +0000 @@ -10,8 +10,8 @@ } //Check if all the -void BNO080Wheelchair::setup() { - imu -> begin(); +bool BNO080Wheelchair::setup() { + bool setup = imu -> begin(); //Tell the IMU to report every 100ms imu -> enableReport(BNO080::TOTAL_ACCELERATION, 200); imu -> enableReport(BNO080::LINEAR_ACCELERATION, 200); @@ -28,7 +28,11 @@ // imu -> enableReport(BNO080::STEP_COUNTER, 100); // imu -> enableReport(BNO080::SIGNIFICANT_MOTION, 100); // imu -> enableReport(BNO080::SHAKE_DETECTOR, 100); + return setup; +} +bool BNO080Wheelchair::hasNewData(BNO080::Report report) { + return imu -> hasNewData(report); } //Get the x component of the angular velocity from IMU. Stores the component @@ -155,12 +159,12 @@ } //Get the rotation of the IMU (from magnetic north) in radians -Quaternion BNO080Wheelchair::rotation() { +TVector4 BNO080Wheelchair::rotation() { wait(0.05); //printf("Update Data GYRO X: %d \n", imu -> updateData()); // hasNewData()? imu -> updateData(); //wait(0.05); - return imu -> rotationVector; + return imu -> rotationVector.vector(); } /*