# On the Functional and Extra-Functional Properties of IMU Fusion Algorithms for Body-Worn Smart Sensors

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Related Work

## 3. Background and Methods

#### 3.1. Used Algorithms

- Complementary Filter

- Mahony Filter

- Madgwick filter

- Kalman Filter

#### 3.2. Quaternion Representation

#### 3.3. Data Formats

#### 3.3.1. Single Precision Floating-Point

#### 3.3.2. Fixed-Point Numbers

#### 3.4. Used Hardware

- The SAM D20 contains a single cycle hardware multiplier for 32-bit integer numbers, which means that addition and multiplication take the same time.
- The SAM D20 does not have hardware support for floating-point numbers. All floating-point operations have to be emulated in software resulting in higher execution time and power consumption.

#### 3.5. Analysis of Extra-Functional Properties

#### 3.5.1. Code Size

#### 3.5.2. Computational Effort

#### 3.6. Analysis of Functional Properties

#### Filter and Measurement Parameters

^{2}.

#### 3.7. Statistical Analysis

## 4. Results: Extra-Functional Properties

#### 4.1. Code Size

#### Explanation of the Size Differences

#### 4.2. Execution Time

#### 4.3. Summary for the Extra-Functional Properties

## 5. Results: Functional Properties

#### 5.1. General Comparison of the Fusion Results

#### 5.1.1. Quantization Errors

#### 5.2. Statistical Analysis

#### 5.2.1. Results Grouped by Data Format

#### 5.2.2. Results Grouped by Movement Speed

#### 5.3. Analysis of External Influences

#### 5.3.1. Movement Speed

#### 5.3.2. User Interaction

#### 5.3.3. Other Factors

- Precision of the image analysis. This factor is influenced by the resolution of the camera, the frame rate of the camera, and the precision of the used image analysis algorithm.
- Cross correlation of the data from reference and sensor fusion. When the timestamps of the data do not fit precisely, there will be an error added to the whole measurement.

## 6. Discussion

## Author Contributions

## Funding

## Conflicts of Interest

## Abbreviations

AHRS | Attitude and Heading Reference System |

BLE | Bluetooth Low Energy |

MEMS | Micro-Electro-Mechanical Systems |

$\mathsf{\mu}$C | Microcontroller |

IMU | Inertial Measurement Unit |

SiP | System in Package |

ROM | Read Only Memory |

SRAM | Static Random-Access Memory |

## References

- Lammel, G. The future of MEMS sensors in our connected world. In Proceedings of the 28th IEEE International Conference on Micro Electro Mechanical Systems (MEMS), Estoril, Portugal, 18–22 January 2015; IEEE: Estoril, Portugal, 2015. [Google Scholar]
- Mendes, J.J.A., Jr.; Vieira, M.E.M.; Pires, M.B.; Stevan, S.L., Jr. Sensor Fusion and Smart Sensor in Sports and Biomedical Applications. Sensors
**2016**, 16, 1569. [Google Scholar] [CrossRef] [PubMed] - Hunter, G.W.; Stetter, J.R.; Hesketh, P.; Liu, C. Smart Sensor Systems. Electrochem. Soc. Interface
**2010**, 19, 29. [Google Scholar] [CrossRef] [Green Version] - ATSAMD20G18—Arm Cortex-M3 MCU. Available online: https://www.microchip.com/wwwproducts/en/ATSAMD20G18 (accessed on 24 January 2021).
- STM32F103CB—32-bit SAM Microcontrollers. Available online: https://www.st.com/en/microcontrollers-microprocessors/stm32f103cb.html (accessed on 3 April 2021).
- Attitude & Heading Reference System (AHRS). Available online: https://www.vectornav.com/resources/attitude-heading-reference-system (accessed on 22 January 2021).
- A Layman’s Guide to Attitude Heading Reference Systems (AHRS). Available online: https://helicoptermaintenancemagazine.com/article/layman\T1\textquoterights-guide-attitude-heading-reference-systems-ahrs (accessed on 22 January 2021).
- Madgwick, S.O.H.; Harrison, A.J.L.; Vaidyanathan, R. Estimation of IMU and MARG orientation using a gradient descent algorithm. In Proceedings of the IEEE International Conference on Rehabilitation Robotics, Zurich, Switzerland, 29 June–1 July 2011; IEEE: Zurich, Switzerland, 2011. [Google Scholar]
- Open Source IMU and AHRS algorithms, Madgwick Internal Report. Available online: https://www.x-io.co.uk/res/doc/madgwick_internal_report.pdf (accessed on 22 January 2021).
- Mahony, R.; Hamel, T.; Pflimlin, J.-M. Nonlinear Complementary Filters on the Special Orthogonal Group. IEEE Trans. Autom. Control
**2008**, 53, 1203–1217. [Google Scholar] [CrossRef] [Green Version] - Baldwin, G.; Mahony, R.; Trumpf, J.; Hamel, T.; Cheviron, T. Complementary filter design on the Special Euclidean group SE(3). In Proceedings of the European Control Conference, Kos, Greece, 2–5 July 2007. [Google Scholar]
- Alam, F.; ZhaiHe, Z.; JiaJia, H. A Comparative Analysis of Orientation Estimation Filters using MEMS based IMU. In Proceedings of the 2nd International Conference on Research in Science, Engineering and Technology, Dubai, United Arab Emirates, 21–22 March 2014; IIE: Dubai, United Arab Emirates, 2014. [Google Scholar]
- Gui, P.; Tang, L.; Mukhopadhyay, S. MEMS based IMU for tilting measurement: Comparison of complementary and kalman filter based data fusion. In Proceedings of the 10th Conference on Industrial Electronics and Applications, Auckland, New Zealand, 15–17 June 2015; IEEE: Auckland, New Zealand, 2015. [Google Scholar]
- Teague, H. Comparison of Attitude Estimation Techniques for Low-cost Unmanned Aerial Vehicles. In Qualcomm Research; Qualcomm Technologies, Inc.: San Diego, CA, USA, 2016. [Google Scholar]
- Cavallo, A.; Cirillo, A.; Cirillo, P.; Maria, G.D.; Falco, P.; Natale, C.; Pirozzi, S. Experimental Comparison of Sensor Fusion Algorithms for Attitude Estimation. In Proceedings of the 19th World CongressThe International Federation of Automatic Control, Cape Town, South Africa, 4–29 August 2014; IEEE: Cape Town, South Africa, 2014. [Google Scholar]
- McGinnis, R.S.; Cain, S.; Davidson, S.; Vitali, R.V. Validation of Complementary Filter Based IMU Data Fusion for Tracking Torso Angle and Rifle Orientation. In Proceedings of the International Mechanical Engineering Congress and Exposition, Montreal, QC, Canada, 14–20 November 2015; ASME: Montreal, QC, Canada, 2015. [Google Scholar]
- Lin, C.; Chiu, W.; Chu, T.; Ho, Y.; Chen, F.; Hsu, C.; Hsieh, P.; Chen, C.; Lin, C.K.; Sung, P.; et al. Innovative Head-Mounted System Based on Inertial Sensors and Magnetometer for Detecting Falling Movements. Sensors
**2020**, 20, 5774. [Google Scholar] [CrossRef] - Valenti, R.G.; Dryanovski, I.; Xiao, J. Keeping a Good Attitude: A Quaternion-Based Orientation Filter for IMUs and MARGs. Sensors
**2015**, 15, 19302–19330. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Ribeiro, M.I. Kalman and Extended Kalman Filters: Concept, Derivation and Properties. Institute for Systems and Robotics; Instituto Superior Tecnico: Lisboa, Portugal, 2014. [Google Scholar]
- Wan, E. Sigma-Point Filters: An Overview with Applications to Integrated Navigation and Vision Assisted Control. In Proceedings of the IEEE Nonlinear Statistical Signal Processing Workshop, Cambridge, UK, 13–15 September 2006. [Google Scholar]
- Dam, E.B.; Koch, M.; Lillholm, M. Quaternions, Interpolation and Animation. Department of Computer Science; University of Copenhagen: Copenhagen, Denmark, 1998. [Google Scholar]
- Hemingway, E.G.; O’Reilly, O.M. Perspectives on Euler angle singularities, gimbal lock, and the orthogonality of applied forces and applied moments. Multibody Syst. Dyn.
**2018**, 44, 31–56. [Google Scholar] [CrossRef] - Goldberg, D. What Every Computer Scientist Should Know About Floating-Point Arithmetic. ACM Comput. Surv.
**1991**, 23, 5–48. [Google Scholar] [CrossRef] - Oberstar, E.L. Fixed-Point Representation & Fractional Math. 1.2 Oberstar Consult. Rev.
**2007**. [Google Scholar] - Smart Sensor: BMF055. Available online: https://www.bosch-sensortec.com/products/smart-sensors/bmf055.html (accessed on 26 January 2021).
- BMI055 Data Sheet. Available online: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmi055-ds000.pdf (accessed on 27 January 2021).
- BMA280 Data Sheet. Available online: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bma280-ds000.pdf (accessed on 27 January 2021).
- BMM150 Data Sheet. Available online: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmm150-ds001.pdf (accessed on 27 January 2021).
- Gis, D.; Büscher, N.; Haubelt, C. Advanced Debugging Architecture for Smart Inertial Sensors using Sensor-in-the-Loop. In Proceedings of the International Workshop of Rapid System Prototyping (RSP), Hamburg, Deutschland, 24–25 September 2020. [Google Scholar]
- Middendorf, L.; Dorsch, R.; Bichler, R.; Strohrmann, C.; Haubelt, C. A Mobile Camera-Based Evaluation Method of Inertial Measurement Units on Smartphones. In Proceedings of the IoT360: Second International Internet of Things Summit, Rome, Italy, 27–29 October 2015; pp. 362–372. [Google Scholar]
- Büscher, N.; Middendorf, L.; Haubelt, C.; Dorsch, R.; Wegelin, F. Statistical analysis and improvement of the repeatability and reproducibility of an evaluation method for IMUs on a smartphone. In Proceedings of the 8th ACM SIGCHI Symposium on Engineering Interactive Computing Systems, Brussels, Belgium, 21–24 June 2016; EICS 2016. pp. 149–158. [Google Scholar]
- OpenCV. Available online: https://opencv.org (accessed on 24 January 2021).
- Kappele, W.D.; Raffaldi, J.D. An Introduction to Gage R&R. Quality
**2005**, 44, 13. [Google Scholar] - Gage Repeatability and Reproducibility (R&R). Available online: https://sixsigmastudyguide.com/repeatability-and-reproducibility-rr/ (accessed on 10 December 2020).
- Eigen. Available online: http://eigen.tuxfamily.org/index.php?title=Main_Page (accessed on 22 January 2021).
- The Mesa 3D Graphics Library. Available online: https://www.mesa3d.org (accessed on 5 January 2021).
- GLUT and OpenGL Utility Libraries. Available online: https://www.opengl.org/resources/libraries/ (accessed on 5 January 2021).
- Quake-III-Arena Source Code. Available online: https://github.com/id-Software/Quake-III-Arena/blob/master/code/game/q_math.c#L552 (accessed on 25 January 2021).
- Blinn, J.F. Floating-point tricks. IEEE Comput. Graph. Appl.
**1997**, 17, 5638131. [Google Scholar] [CrossRef]

**Figure 1.**Measurement setup for the assessment of the computation time of the sensor fusion algorithms.

**Figure 2.**Data flow of the measurement setup. Steps involving the camera data are colored orange. Steps involving the sensor fusion result are colored blue. The resulting error is colored in gray.

**Figure 6.**Box-Plot of the execution times for the 32-bit floating-point implementations. The boxes show the deviations from the median execution time in milliseconds.

**Figure 10.**Comparison of the fusion out of the Kalman filter for the three data formats. (

**A**) output of the Kalman filter with 32-bit floating-point data; (

**B**) output of the Kalman filter with 32-bit fixed-point data; (

**C**) output of the Kalman filter with 16-bit fixed-point data; (

**D**) output of the Mahony filter with 16-bit fixed-point data.

**Figure 11.**Estimated influence of rotation speed, external influences, and used algorithm on the result of the sensor fusion grouped by data format.

**Figure 12.**Estimated influence of data format, external influences, and used algorithm on the result of the sensor fusion grouped by rotation speed.

**Figure 14.**Comparison between accuracy with which the user conducted a predefined movement and error from the sensor fusion output.

Data Format | Kalman | Madgwick | Mahony | Complementary |
---|---|---|---|---|

32-bit Floating-Point | 3.963 ms | 1.142 ms | 0.758 ms | 0.782 ms |

32-bit Fixed-Point | 1.923 ms | 0.560 ms | 0.350 ms | 0.382 ms |

16-bit Fixed-Point | 0.621 ms | 0.166 ms | 0.121 ms | 0.123 ms |

**Table 2.**Average error in degree measured for the four sensor fusion algorithms using the three data formats.

Data Format | Kalman | Madgwick | Mahony | Complementary |
---|---|---|---|---|

32-bit Floating-Point | 1.557 | 1.657 | 1.588 | 1.489 |

32-bit Fixed-Point | 1.562 | 1.603 | 1.557 | 1.478 |

16-bit Fixed-Point | 2.429 | 1.722 | 1.626 | 1.539 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Büscher, N.; Gis, D.; Kühn, V.; Haubelt, C.
On the Functional and Extra-Functional Properties of IMU Fusion Algorithms for Body-Worn Smart Sensors. *Sensors* **2021**, *21*, 2747.
https://doi.org/10.3390/s21082747

**AMA Style**

Büscher N, Gis D, Kühn V, Haubelt C.
On the Functional and Extra-Functional Properties of IMU Fusion Algorithms for Body-Worn Smart Sensors. *Sensors*. 2021; 21(8):2747.
https://doi.org/10.3390/s21082747

**Chicago/Turabian Style**

Büscher, Nils, Daniel Gis, Volker Kühn, and Christian Haubelt.
2021. "On the Functional and Extra-Functional Properties of IMU Fusion Algorithms for Body-Worn Smart Sensors" *Sensors* 21, no. 8: 2747.
https://doi.org/10.3390/s21082747