# The Influence of Temporal Disturbances in EKF Calculations on the Achieved Parameters of Flight Control and Stabilization of UAVs

^{1}

^{2}

^{3}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Materials and Methods

#### 2.1. Problem Statement

#### 2.2. EKF Model

- the quaternion defining rotation from the North-East-Down (NED) local earth frame to the Front-Right-Down (FRD) body frame,
- velocity at the IMU in the NED frame,
- position at the IMU in the NED frame,
- IMU gyroscope bias estimates in the FRD body frame,
- IMU accelerometer bias estimates in the FRD body frame,
- Earth Magnetic field components in the NED local frame,
- vehicle body frame magnetic field bias in the FRD body frame,
- wind velocity estimate in the NE frame.

#### 2.3. Profiling of a Real-Time Operating System

- Ready—task is ready to be given CPU time,
- Running—task currently running on CPU, it can be preempt by higher priority task and put back to “Ready” state,
- Blocked—task waiting for blocking event to end,
- Suspended—task manually suspended.

#### 2.4. Experiment Methodology

## 3. Results

#### 3.1. Temporal Disturbances

- “icm20948”—task for collecting and converting the reading from the IMU sensor,
- “flc_angl”—FC angle stabilization controller process,
- “ekf”—task running the PX4-ECL version of EKF,
- “flc_pos”—FC position stabilization controller process.

- reading of data from the IMU sensor (preparation for data transfer, transfer, conversion of received data, sending to other tasks),
- EKF receives IMU data and performs the prediction step,
- EKF sends attitude data to FC,
- FC receives data and creates adequate control outputs for motors,
- EKF performs the correction step, if any new measurements from other sensors are available for fusion,
- if EKF is ready, it publishes position data for FC position control,
- FC receives position data and creates adequate controls.

#### 3.2. Effect of Temporal Disturbances on Flight of UAV

## 4. Discussion

## 5. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## References

- Gietzelt, M.; Wolf, K.H.; Marschollek, M.; Haux, R. Performance comparison of accelerometer calibration algorithms based on 3D-ellipsoid fitting methods. Comput. Methods Programs Biomed.
**2013**, 111, 62–71. [Google Scholar] [CrossRef] [PubMed] - Markovic, L.; Kovac, M.; Milijas, R.; Car, M.; Bogdan, S. Error State Extended Kalman Filter Multi-Sensor Fusion for Unmanned Aerial Vehicle Localization in GPS and Magnetometer Denied Indoor Environments. arXiv
**2021**, arXiv:2109.04908. [Google Scholar] [CrossRef] - Valenti, R.; 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] - Mahony, R.; Hamel, T.; Pflimlin, J.M. Complementary filter design on the special orthogonal group SO(3). In Proceedings of the 44th IEEE Conference on Decision and Control, Seville, Spain, 15 December 2005; pp. 1477–1484. [Google Scholar] [CrossRef]
- Wu, J.; Zhou, Z.; Chen, J.; Fourati, H.; Li, R. Fast Complementary Filter for Attitude Estimation Using Low-Cost MARG Sensors. IEEE Sens. J.
**2016**, 16, 6997–7007. [Google Scholar] [CrossRef] - Meyer, J.; Padayachee, K.; Broughton, B.A. A Robust Complementary Filter Approach forAttitude Estimation of Unmanned AerialVehicles using AHRS. In Proceedings of the 2019 CEAS EuroGNC Conference, Milano, Italy, 3–5 April 2019. [Google Scholar]
- Narkhede, P.; Poddar, S.; Walambe, R.; Ghinea, G.; Kotecha, K. Cascaded Complementary Filter Architecture for Sensor Fusion in Attitude Estimation. Sensors
**2021**, 21, 1937. [Google Scholar] [CrossRef] - Blachuta, M.; Grygiel, R.; Czyba, R.; Szafrański, G. Attitude and heading reference system based on 3D complementary filter. In Proceedings of the 19th International Conference on Methods and Models in Automation and Robotics (MMAR), Miedzyzdroje, Poland, 2–5 September 2014; pp. 851–856. [Google Scholar] [CrossRef]
- Mahony, R.; Hamel, T.; Pflimlin, J.M. Nonlinear Complementary Filters on the Special Orthogonal Group. IEEE Trans. Autom. Control
**2008**, 53, 1203–1218. [Google Scholar] [CrossRef] - Euston, M.; Coote, P.; Mahony, R.; Kim, J.; Hamel, T. A complementary filter for attitude estimation of a fixed-wing UAV. In Proceedings of the 2008 IEEE/RSJ International Conference on Intelligent Robots and Systems, Nice, France, 22–26 September 2008; pp. 340–345. [Google Scholar] [CrossRef]
- Solà, J. Quaternion kinematics for the error-state Kalman filter. arXiv
**2017**, arXiv:1711.02508. [Google Scholar] [CrossRef] - Gośliński, J.; Giernacki, W.; Królikowski, A. A Nonlinear Filter for Efficient Attitude Estimation of Unmanned Aerial Vehicle (UAV). J. Intell. Robot. Syst. Theory Appl.
**2019**, 95, 1079–1095. [Google Scholar] [CrossRef] - Alonzo, K. A 3D State Space Formulation of a Navigation Kalman Filter for Autonomous Vehicles; Technical Report; Defence Technical Information Center: Fort Belvoir, VA, USA, 1994. [Google Scholar]
- Choukroun, D.; Bar-itzhack, I.; Oshman, Y. Novel quaternion Kalman filter. IEEE Trans. Aerosp. Electron. Syst.
**2006**, 42, 174–190. [Google Scholar] [CrossRef] - Sabatini, A. Quaternion-Based Extended Kalman Filter for Determining Orientation by Inertial and Magnetic Sensing. IEEE Trans. Biomed. Eng.
**2006**, 53, 1346–1356. [Google Scholar] [CrossRef] - Jing, X.; Cui, J.; He, H.; Zhang, B.; Ding, D.; Yang, Y. Attitude estimation for UAV using extended Kalman filter. In Proceedings of the 2017 29th Chinese Control And Decision Conference (CCDC), Chongqing, China, 28–30 May 2017; pp. 3307–3312. [Google Scholar] [CrossRef]
- Driessen, S.; Janssen, N.; Wang, L.; Palmer, J.; Nijmeijer, H. Experimentally Validated Extended Kalman Filter for UAV State Estimation Using Low-Cost Sensors. IFAC-PapersOnLine
**2018**, 51, 43–48. [Google Scholar] [CrossRef] - Suh, Y.S. Orientation Estimation Using a Quaternion-Based Indirect Kalman Filter with Adaptive Estimation of External Acceleration. IEEE Trans. Instrum. Meas.
**2010**, 59, 3296–3305. [Google Scholar] [CrossRef] - Mueller, M.W.; Hamer, M.; D’Andrea, R. Fusing ultra-wideband range measurements with accelerometers and rate gyroscopes for quadrocopter state estimation. In Proceedings of the 2015 IEEE International Conference on Robotics and Automation (ICRA), Seattle, WA, USA, 26–30 May 2015; pp. 1730–1736. [Google Scholar] [CrossRef]
- Fossen, T.I. Feedback error-state Kalman filter with time-delay compensation for hydroacoustic-aided inertial navigation of underwater vehicles. Control Eng. Pract.
**2023**, 138, 105603. [Google Scholar] [CrossRef] - Zamani, M.; Trumpf, J.; Mahony, R. Nonlinear Attitude Filtering: A Comparison Study. arXiv
**2015**, arXiv:1502.03990. [Google Scholar] [CrossRef] - Gao, N.; Wang, M.; Zhao, L. A novel robust Kalman filter on AHRS in the magnetic distortion environment. Adv. Space Res.
**2017**, 60, 2630–2636. [Google Scholar] [CrossRef] - Bréda, R.; Andoga, R.; Schrötter, M.; Polakovič, A. Comparison of Parameters of Inertial Measurement Units Suitable for Unmanned Aerial Vehicle Control. In Proceedings of the 2024 New Trends in Civil Aviation (NTCA), Prague, Czech Republic, 25–26 April 2024; pp. 159–164. [Google Scholar] [CrossRef]
- Guo, S.; Wu, J.; Wang, Z.; Qian, J. Novel MARG-Sensor Orientation Estimation Algorithm Using Fast Kalman Filter. J. Sens.
**2017**, 2017, 8542153. [Google Scholar] [CrossRef] - Barrau, A.; Bonnabel, S. Invariant Kalman Filtering. Annu. Rev. Control Robot. Auton. Syst.
**2018**, 1, 237–257. [Google Scholar] [CrossRef] - Bonnabel, S.; Martin, P.; Salaun, E. Invariant Extended Kalman Filter: Theory and application to a velocity-aided attitude estimation problem. In Proceedings of the 48h IEEE Conference on Decision and Control (CDC) Held Jointly with 2009 28th Chinese Control Conference, Shanghai, China, 15–18 December 2009; pp. 1297–1304. [Google Scholar] [CrossRef]
- PX4-ECL GitHub Library. Available online: https://github.com/PX4/PX4-ECL (accessed on 10 March 2024).
- Greiff, M. Modelling and Control of the Crazyflie Quadrotor for Aggressive and Autonomous Flight by Optical Flow Driven State Estimation. Ph.D. Thesis, Lund University, Lund, Sweden, 2017. [Google Scholar]
- Justa, J.; Šmídl, V.; Hamáček, A. Fast AHRS Filter for Accelerometer, Magnetometer, and Gyroscope Combination with Separated Sensor Corrections. Sensors
**2020**, 20, 3824. [Google Scholar] [CrossRef] [PubMed] - Rehbinder, H.; Hu, X. Drift-free attitude estimation for accelerated rigid bodies. Automatica
**2004**, 40, 653–659. [Google Scholar] [CrossRef] - Lim, C.H.; Ong, L.Y.; Lim, T.S.; Koo, V.C. Kalman Filtering and Its Real-Time Applications. In Real-Time Systems; Jian, K., Ed.; InTech: Houston, TX, USA, 2016. [Google Scholar] [CrossRef]
- Salwa, M.; Krzysztofik, I. Application of Filters to Improve Flight Stability of Rotary Unmanned Aerial Objects. Sensors
**2022**, 22, 1677. [Google Scholar] [CrossRef] - Jang, J.T.; Santamaria-Navarro, A.; Lopez, B.T.; Agha-mohammadi, A.A. Analysis of State Estimation Drift on a MAV Using PX4 Autopilot and MEMS IMU During Dead-reckoning. In Proceedings of the 2020 IEEE Aerospace Conference, Big Sky, MT, USA, 7–14 March 2020; pp. 1–11. [Google Scholar] [CrossRef]
- Scaramuzza, D.; Achtelik, M.C.; Doitsidis, L.; Friedrich, F.; Kosmatopoulos, E.; Martinelli, A.; Achtelik, M.W.; Chli, M.; Chatzichristofis, S.; Kneip, L.; et al. Vision-Controlled Micro Flying Robots: From System Design to Autonomous Navigation and Mapping in GPS-Denied Environments. IEEE Robot. Autom. Mag.
**2014**, 21, 26–40. [Google Scholar] [CrossRef] - Wang, Z.; Li, X.; Zhang, X.; Bai, Y.; Zheng, C. An Attitude Estimation Method Based on Monocular Vision and Inertial Sensor Fusion for Indoor Navigation. IEEE Sens. J.
**2021**, 21, 27051–27061. [Google Scholar] [CrossRef] - PX4 Open Source Autopilot. Available online: https://px4.io/ (accessed on 16 March 2024).
- ArduPilot Software. Available online: https://ardupilot.org/ (accessed on 16 March 2024).
- Percepio Tracealyzer. Available online: https://percepio.com/tracealyzer/ (accessed on 15 March 2024).

**Figure 2.**PX4-ECL EKF flow diagram [27].

**Figure 4.**Percepio Tracealyzer profiling example [38].

**Figure 10.**System view of Gantt graph of delay in computation in EKF, lost IMU sample, and influence on the entire system.

**Figure 11.**Comparison of measured roll and pitch angles and setpoints from operator (

**top**) plotted against time difference between consecutive EKF estimates (

**bottom**).

**Figure 12.**Plot of measured roll and pitch angles, setpoints from operator (top) and time difference between consecutive EKF estimates (bottom).

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

© 2024 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**

Szczepaniak, J.; Szlachetko, B.; Lower, M.
The Influence of Temporal Disturbances in EKF Calculations on the Achieved Parameters of Flight Control and Stabilization of UAVs. *Sensors* **2024**, *24*, 3826.
https://doi.org/10.3390/s24123826

**AMA Style**

Szczepaniak J, Szlachetko B, Lower M.
The Influence of Temporal Disturbances in EKF Calculations on the Achieved Parameters of Flight Control and Stabilization of UAVs. *Sensors*. 2024; 24(12):3826.
https://doi.org/10.3390/s24123826

**Chicago/Turabian Style**

Szczepaniak, Jędrzej, Bogusław Szlachetko, and Michał Lower.
2024. "The Influence of Temporal Disturbances in EKF Calculations on the Achieved Parameters of Flight Control and Stabilization of UAVs" *Sensors* 24, no. 12: 3826.
https://doi.org/10.3390/s24123826