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
81 stars 62 forks source link

Getting linear acceleration in the NED (North East Down) frame of reference #65

Closed jerabaul29 closed 3 years ago

jerabaul29 commented 3 years ago

Do you know if there is a native way to get the acceleration in the NED (North East Down) frame of reference? If not, I suppose this should be attainable by using the quaternion orientation and the linear accelerations, right? (is the quaternion orientation well describing the orientation relative to NED?).

PaulZC commented 3 years ago

Hi JR,

You can read the accelerometer data in X/Y/Z - the frame of reference is the chip package. You should be able to combine that with the Euler angles (roll, pitch, yaw) where the frame of reference is deviation from horizontal, yaw is relative to magnetic north. The Euler angles are calculated from the quaternion data by the library. The BNO080 can't provide NED acceleration directly.

I wonder if "Robot Vacuum Cleaner" mode is what you need? It provides Roll, Pitch, Yaw and X/Y/Z acceleration over UART at 100Hz at 115200 Baud. Please have a look at the BNO080 datasheet for more details.

Best wishes, Paul

jerabaul29 commented 3 years ago

FYI: I was able to obtain the quantities in the North-East-Down NED (or rather East-North-Up ENU, see below, but that is the same for all practical matters) frame of reference. The method I used was:

All the code is available here: https://github.com/jerabaul29/Artemis_MbedOS_recipes/tree/main/recipes/recipe_IMU_quaternions .

You can find:

I tested with an Artemis RedBoard + Qwiic BNO080 Sf breakout + Qwiic cables. Works fine (module the issues #68 and #69 ).

I have validated that:

https://github.com/jerabaul29/Artemis_MbedOS_recipes/blob/b93aaef5978ed483c4ac5b72b01d37c98484e66a/recipes/recipe_IMU_quaternions/recipe_IMU_quaternions.ino#L135

https://github.com/jerabaul29/Artemis_MbedOS_recipes/blob/b93aaef5978ed483c4ac5b72b01d37c98484e66a/recipes/recipe_IMU_quaternions/recipe_IMU_quaternions.ino#L142

I think this may be useful to other users too. Would you consider either writing some small tools that do a similar work, or would you consider a pull request with a few tools that add these functionalities to the library?

If you would consider taking a pull request about that, may you re-open the issue, and may we discuss here some specification / conventions / format stuff? :)

PaulZC commented 3 years ago

Hi JR, We are always open to Pull Requests if they add value to the library, provide new features or corrections and - importantly - maintain backward compatibility. Please include an example that demonstrates how the new features work. Please also update keywords.txt with the new function names etc.. Best wishes, Paul

PaulZC commented 3 years ago

But please target the release_candidate branch as described here: https://github.com/sparkfun/SparkFun_BNO080_Arduino_Library/blob/master/CONTRIBUTING.md

jerabaul29 commented 3 years ago

Sounds good, will look at it :) .

I may loose internet in the days to come for around 2 weeks, going far into the Arctic, just so that you know why I stop answering if this happens :) . Worst case I will take care of that when I get internet back :) .

PaulZC commented 3 years ago

Good luck JR - I hope your trip is successful. I spent 22 years working in a University instrumentation group. I really enjoyed the field trips - they were really rewarding. But always stressful in equal measure too! All the best, Paul PS. I hope the Northern Lights are good!

jerabaul29 commented 3 years ago

Many thanks :) We had very nice Northern lights three days ago. Not seen much of them since, coding 14 hours a day to try to get the prototype instruments to work ^^ (this is why I open so many issues :) ). We have a total of 14 Artemis Global Trackers with us, and we want to turn them into sea ice wave motion, drift, and breakup monitoring devices together with the BNO IMU and some FFT analysis. We have also "well proven" instruments with us (some older designs based on Arduino Mega, RPi, and Vectornav VN100), but having a proof to show to the management that the new, much cheaper and easier to build prototype is promising would be great, that would allow to apply for / plan a large-scale deployment of these motion trackers later on :) .

University instrumentation group must have been really exciting :) . Yes, fieldwork is a bit stressful, but things are still quite OK - we have always made it clear that the stuff I work on now is work in progress :) .