sparkfun / SparkFun_BNO08x_Arduino_Library

An Arduino Library for the BNO08x IMU combination triple axis accelerometer/gyro/magnetometer packaged with an ARM Cortex M0+ running powerful algorithms.
Other
14 stars 8 forks source link

Getting both Linear Vector and Rotation Vector reports. #9

Closed LazaroFilm closed 11 months ago

LazaroFilm commented 1 year ago

When I set my program to get two reports at the same time, the reports are lowed down to a crawl I'm trying to get myIMU.enableLinearAccelerometer() and myIMU.enableRotationVector() together to display them separately, however, as soon as I uncomment the second enable report, the sensor events for the Rotation Vector slow down to a crawl.

I set the console to print ROTATION at each Rotation Vector report and linear at each linearAcceleration report. Each line is a cycle. As you can see the rotation is much lower than linear. Without linear on, I get a rotation report at each cycle.

ROTATION
          linear
          linear
          linear
          linear
          linear
          linear
          linear
ROTATION
          linear
          linear
          linear
          linear
          linear
          linear
          linear
          linear
          linear
ROTATION
          linear
          linear
ROTATION
          linear
          linear
          linear
          linear
          linear
ROTATION
          linear
          linear
          linear
          linear
          linear
          linear
          linear
ROTATION
          linear
          linear
ROTATION
          linear
          linear
ROTATION
          linear
          linear
          linear
          linear
ROTATION
          linear
          linear
          linear
          linear
          linear
          linear
          linear
          linear
          linear
          linear
ROTATION
          linear
          linear
ROTATION

EDIT: SOLVED I needed to add a refresh rate value like myIMU.enableLinearAccelerometer(25) to lower the refresh rate of each report. I guess the linear acceleration was taking over the CPU of the IMU and preventing the calculation heavy rotation vector from ever happening. Limiting the Linear acceleration refresh rate allowed for the Rotation to report at a decent interval