sparkfun / SparkFun_BNO080_Arduino_Library

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

Support for Gyro-Integrated Rotation Vector #32

Closed Nate711 closed 4 years ago

Nate711 commented 5 years ago

Just creating this issue to notify you that I'm working on adding support for the gyro-integrated rotation vector input report. This 'sensor' reports an absolute rotation quaternion and angular velocity at up to 1000Hz which I think could help many people using this sensor for robots with fast dynamics such as drones or legged robots. https://github.com/nate711/SparkFun_BNO080_Arduino_Library. I'll make a PR once testing is done. Thanks for your work!

vitorsotero commented 4 years ago

I gave it a try and got this compilation error:

`C:\Users\Sotero\Documents\Arduino\libraries\SparkFun_BNO080_Arduino_Library\src\SparkFun_BNO080_Arduino_Library.cpp:508:28: error: no 'float BNO080::getFastGyroX()' member function declared in class 'BNO080'

float BNO080::getFastGyroX()

                        ^

C:\Users\Sotero\Documents\Arduino\libraries\SparkFun_BNO080_Arduino_Library\src\SparkFun_BNO080_Arduino_Library.cpp:515:28: error: no 'float BNO080::getFastGyroY()' member function declared in class 'BNO080'

float BNO080::getFastGyroY()

                        ^

C:\Users\Sotero\Documents\Arduino\libraries\SparkFun_BNO080_Arduino_Library\src\SparkFun_BNO080_Arduino_Library.cpp:522:28: error: no 'float BNO080::getFastGyroZ()' member function declared in class 'BNO080'

float BNO080::getFastGyroZ()

                        ^

C:\Users\Sotero\Documents\Arduino\libraries\SparkFun_BNO080_Arduino_Library\src\SparkFun_BNO080_Arduino_Library.cpp:830:76: error: no 'void BNO080::enableGyroIntegratedRotationVector(uint16_t)' member function declared in class 'BNO080'

void BNO080::enableGyroIntegratedRotationVector(uint16_t timeBetweenReports)

                                                                        ^

exit status 1 Erro compilando para a placa Arduino Nano`

Nate711 commented 4 years ago

Thanks for pointing that out! Please try again with the new code.

vitorsotero commented 4 years ago

Now I can compilate, but it doesn't show any results.

When I call "myIMU.enableGyroIntegratedRotationVector(1);", it doesn't change the color to orange (arduino code). It differs from the other functions (ex: myIMU.getQuatI();)

nseidle commented 4 years ago

Very cool! Please continue your work. We'd welcome a PR to add more features.

badVibes-- commented 4 years ago

I managed to make this work and made a pull request (my first ever \o/). I have to give credit to Nate711 because I started from one of his old commits. Don't know how to pull in old stuff so the chain would be intact. The code is not in Nates current branch:/.

Anyway, it works and its fast.

spiderolsen commented 4 years ago

I managed to make this work and made a pull request (my first ever \o/). I have to give credit to Nate711 because I started from one of his old commits. Don't know how to pull in old stuff so the chain would be intact. The code is not in Nates current branch:/.

Anyway, it works and its fast.

Hi badVibes,

I´ve just tested your rewritten library. Unfortunately with your changes it is not possible to turn town myIMU.enableGyroIntegratedRotationVector(5); below 5ms without freezing an arduino nano. With the normal sparkfun library it is possible to send a update every 1ms and the loop void runs about 250Hz. I think an arduino nano will crash as soon as the loop void is faster than around 250Hz. At myIMU.enableGyroIntegratedRotationVector(5); the loop void is runnging at 190-200Hz.

badVibes-- commented 4 years ago

I´ve just tested your rewritten library. Unfortunately with your changes it is not possible to turn town myIMU.enableGyroIntegratedRotationVector(5); below 5ms without freezing an arduino nano. With the normal sparkfun library it is possible to send a update every 1ms and the loop void runs about 250Hz. I think an arduino nano will crash as soon as the loop void is faster than around 250Hz. At myIMU.enableGyroIntegratedRotationVector(5); the loop void is runnging at 190-200Hz.

Hey spiderolsen, that seems strange. One thing that comes to mind is that the nano might be too slow. I tested all this on teensy 3.2 & 3.6 which are quite a bit faster. If you request a 1ms update for any other rotation vector it will not send it any faster than 400hz. How are you interfacing with the sensor, I2C or SPI?

If you are using SPI you could try the Tare branch on my repo. I added some fixes for SPI and a method to configure the FRS record of the Gyro Integrated Rotation Vector. Its still not fully tested but maybe it helps. I know SPI example didn't really work for me before the fix.

PaulZC commented 4 years ago

Hi @Nate711 & @badVibes-- , I've just merged PR #41 which adds support for the Gyro-Integrated Rotation Vector. I'm going to close this issue but please feel free to reopen it if we have missed anything. Best wishes, Paul