Skip to content
Bjarne Hansen edited this page Jan 1, 2021 · 20 revisions

Orientation Sensor Testing wiki

Here's a collection of test plans, results, thoughts, and discussion relating to the performance of the FXOS8700/FXAS21002 combination orientation sensor. Select sub-pages for more details on each topic.

Work-In-Progress

List here what's happening, and who is doing it.

  • obtain copy of NXP Fusion Library, version 7
  • port library to ESP platform
  • add wireless streaming of data
  • code cleanup
  • C++ wrapper for fusion code
  • integrate with SensESP (in progress) (Bjarne)
  • initial comparisons of fusion algorithms versions 4 and 7
  • stability, accuracy, step response testing (ongoing)
  • add to this wiki as we learn (ongoing) (all)

Sensor Fusion Algorithm

The Fusion algorithm is central to the performance of the sensor. A great resource for background info is reference 6 (NXP User Guide to their Sensor Fusion Library) below.

The SensESP orientation sensor uses the Adafruit AHRS code, which is derived from https://github.com/memsindustrygroup/Open-Source-Sensor-Fusion/ This location has lots of info, including that it is based on Freescale's version 4.2.2 Sensor Fusion library. NXP now has version 7.20 released, which includes improved calibration features and faster CPU performance apparently. This project is my port of version 7.20 to the ESP32. It now displays data on NXP's Sensor Fusion Toolbox Windows app (reference 8 below). An interface class has now also been created that works with the SensESP project, and a PR is place to make this more permanent.

Initial impressions are that the Toolbox will be very useful in developing and debugging orientation sensors (which shouldn't be surprising, as that's what it was intended to do ;-) The Toolbox doesn't perform any of the sensor fusion itself (that's all run on the ESP or other microprocessor) but rather displays the results of the various algorithms graphically. It also shows calibration results and the amount of magnetic interference being sensed.

While going through the exercise of porting the fusion code, these major improvements over version 4.2 have stuck out:

  • v 7.20 supports sensor hardware's internal FIFOs. The default configuration runs the ICs at sampling rates of 400 Hz, and has the ESP32 poll the buffered data at 40 Hz. Sampling faster improves the signal to noise ratio of the processed data.
  • many internal parameters and intermediate results of the fusion algorithms are stored in a structure that is easily accessed. In fact, most of the contents of this struct are sent to the Fusion Toolbox application, where they can easily be seen and some can be adjusted.
  • magnetic calibration runs in parallel with the fusion algorithm, so I believe one can monitor the magnetic environment of the sensor while in use and adjust the calibration if necessary.

Resources

  1. https://github.com/SignalK/signalk-imu
  2. https://www.tindie.com/products/onehorse/ultimate-sensor-fusion-solution-mpu9250/
  3. kriswiner's Github repositories, including: https://github.com/kriswiner/EM7180_SENtral_sensor_hub/wiki/K.-Limits-of-Absolute-Heading-Accuracy-Using-Inexpensive-MEMS-Sensors and https://github.com/kriswiner/MPU6050/wiki/Affordable-9-DoF-Sensor-Fusion
  4. Estimation of heading using magnetometer and GPS
  5. Performance Improvement of Inertial Navigation System by Using Magnetometer with Vehicle Dynamic Constraints
  6. NXP User Guide to Sensor Fusion Library
  7. NXP Sensor Fusion Library Datasheet for Kinetis MCUs
  8. NXP Sensor Fusion Toolbox for Windows
  9. NXP Application Note AN5017 - Coordinate Systems