Nonlinear Kalman Filter For Gyroscopic and Accelerometer Noise Rejection of An Unmanned Aerial Vehicle Control Strategy
Nonlinear Kalman Filter For Gyroscopic and Accelerometer Noise Rejection of An Unmanned Aerial Vehicle Control Strategy
Corresponding Author:
Wassim Arfa
Department of Electrical Engineering, Ecole Nationale d’Ingénieurs de Carthage, University of Carthage
Tunis, Tunisia
Email: [email protected]
1. INTRODUCTION
Quadcopters, essential for high-risk tasks, utilize proportional-integral-derivative (PID) controllers
for precise angle control [1]–[4]. This study proposes integrating a Kalman filter [5] before PID controllers to
address noise and state estimation challenges drawing inspiration from prior research [6]–[8], it examines a
6-DOF quadcopter model, dynamic response, and PID control algorithm. Three PID controllers are dedicated
to specific angles, offering a comparative analysis against single or dual controllers. Evaluation includes
stability, accuracy, and disturbance avoidance, utilizing simulations and comparative techniques like genetic
algorithms (GA) [9], crow search algorithm (CSA) [10], particle swarm optimization (PSO) [11], Ziegler-
Nichols (ZN) [12], harmony search algorithm [13], and water cycle algorithm [14]. The integration of
Kalman filter improves the control system performance and allows a more effective utilization in applications
requiring precise angle control.
The paper proceeds as follows: Section 2 delves into the mathematical model based on Newton-
Euler. Section 3 gives an overview of the Kalman filter characters and applications. Section 4 investigates the
three applied control methods that respectively integrate the Kalman filter. Section 5 draws on the simulation
and optimization of the PID gains in the drone. The main findings and discussion are presented in Section 6.
The study mainly finds out that precise tuning of the PID controller parameters is highly important to achieve
optimal performance in terms of stability, responsiveness, and control accuracy. Indeed, the inclusion of three
adaptive PID controllers, complemented by a Kalman filter, results in superior speed, accuracy, and stability
compared to previous approaches, offering valuable insights for optimizing drones across various applications
that demand precise angle control.
The equations of forces applied to the quadcopter and the moments acting on the quadrotor using the
Newton-Euler formulation and the dynamic system model are shown in (1) [18],
𝜁̇ = 𝑣
𝑚𝜁 ̈ = 𝐹𝑓 + 𝐹𝑡 + 𝐹𝑔
(1)
̇
𝑅 = 𝑅𝑆(𝛺)
{ 𝐽𝛺 = −𝛺𝛬𝐽𝛺 ̇ + 𝑀𝑓 − 𝑀𝑎 − 𝑀𝑔ℎ
where
𝜁 : The vector representing the position of the quadrotor
m : The total mass of the quadrotor
Ω : The angular velocity expressed in the fixed reference frame
R : The rotation matrix
Λ : The vector product
𝑚𝜁 ̈ = 𝐹𝑡 + 𝐹𝑓 + 𝐹𝑔 (2)
Nonlinear Kalman filter for gyroscopic and accelerometer noise rejection … (Wassim Arfa)
196 ISSN: 2722-2586
We obtain the differential equations as (4) that define the translational coefficients.
1 𝐾𝑓𝑡𝑥
𝑥̈ = (cos𝜙cos𝜓sin𝜃 + sin𝜙sin𝜓)(∑41 𝐹𝑖 ) − 𝑥̇
𝑚 𝑚
1 𝐾𝑓𝑡𝑦
𝑦̈ = (cos𝜙sin𝜓cos𝜃 + sin𝜙cos𝜓)(∑41 𝐹𝑖 ) − 𝑦̇ (4)
𝑚 𝑚
1 4 𝐾𝑓𝑡𝑧
{ 𝑧̈ = 𝑚 (cos𝜙cos𝜃)(∑1 𝐹𝑖 ) − 𝑚
𝑧̇ − g
We then obtain the differential equations defining the rotational motion as in (7).
with
𝐼 −𝐼 𝐽𝑟 𝐾 𝑙𝑏
𝜙̈ = −𝜃̇𝜓̇ 𝑧 𝑦 − 𝛺̅𝑟 𝜃̇ − 𝑓𝑎𝑥 𝜙̇ 2 + (𝑤42 − 𝑤22 )
𝐼𝑥 𝐼𝑥 𝐼𝑥 𝐼𝑥
𝐼 −𝐼 𝐽𝑟 𝐾 𝑙𝑏
𝜃̈ = 𝜙̇𝜓̇ 𝑧 𝑥 − 𝛺̅𝑟 𝜃̇ − 𝑓𝑎𝑦 𝜃̇ 2 + (𝑤32 − 𝑤12 )
𝐼𝑦 𝐼𝑦 𝐼𝑦 𝐼𝑦
𝐼𝑦 −𝐼𝑥 𝐾𝑓𝑎𝑧 𝑙𝑑
𝜓̈ = 𝜙̇𝜃̇ − 𝜓̇ 2 + (𝑤12 − 𝑤22 + 𝑤32 − 𝑤42 )
𝐼𝑧 𝐼𝑧 𝐼𝑧 (8)
1 𝐾𝑓𝑡𝑥
𝑥̈ = (cos𝜙cos𝜓sin𝜃 + sin𝜙sin𝜓)(∑41 𝐹𝑖 ) − 𝑥̇
m m
1 𝐾𝑓𝑡𝑦
𝑦̈ = (cos𝜙sin𝜓cos𝜃 + sin𝜙cos𝜓)(∑41 𝐹𝑖 ) − 𝑦̇
m m
1 4 𝐾𝑓𝑡𝑧
{ 𝑧̈ = m (cos𝜙cos𝜃)(∑1 𝐹𝑖 ) − m
𝑧̇ − g
3. KALMAN FILTER
The Kalman filter, named after Rudolf E. Kálmán, is a powerful tool in estimation and signal
processing and is widely used in navigation, robotics, and finance [5]. It optimizes predictions by estimating
a system's hidden state amidst noise and uncertainties, enhancing accuracy through current measurements
and error correction. Particularly effective in linear equations and real-time estimation, it filters out noisy
information and improves state estimates. In challenging scenarios like adjusting PID controller parameters,
the Kalman filter removes noise and extracts true signals for feedback. Its versatility extends to offering
unbiased estimation for multi-input, non-stationary, and time-varying systems. Its recursive algorithm is
well-suited for computer implementation, utilizing state equations and initial values for accurate estimation
of real signal values.
In the formulation of the Kalman filter, the state equation represents the system's state vector,
denoted as 𝑥(𝑡), where A is the system transition matrix, 𝑢(𝑡) is the input vector, 𝐵 is the control distribution
matrix, and w(t) is the random Gaussian noise vector (representing system noise) characterized by a zero
IAES Int J Rob & Autom, Vol. 13, No. 2, June 2024: 194-204
IAES Int J Rob & Autom ISSN: 2722-2586 197
mean and a known covariance structure, with 𝑀 being the transition matrix for the system noise. In the
measurement equation, 𝑦(𝑡) signifies the measurement vector, 𝐶 is the measurement matrix, and
𝑣(𝑡) represents the measurement noise vector, which also follows a Gaussian distribution with a zero mean
and known covariance structure. It is essential to note that there is no correlation between the system noise
𝑤(𝑡) and the measurement noise 𝑣(𝑡). The core objective of the Kalman filter is to estimate the true signal
from a disturbed signal exhibiting a Gaussian distribution, aiming to minimize the discrepancy between the
two signals.
d
𝑢(𝑡) = K p 𝑒(𝑡) + K i ∫ 𝑒(𝑡)𝑑𝑡 + K d 𝑒(𝑡) (10)
𝑑𝑡
with 𝐾𝑝 the proportional gain, 𝐾𝑖 the integral gain, and 𝐾𝑑 the derivative gain, 𝑒(𝑡) can be formulated as a
function of the error:
where 𝑠𝑝 is the setpoint or desired position and 𝑝𝑣 (𝑡) is the process variable at the instantaneous moment
according to 𝑠𝑝 [21]–[23].
The integration of a Kalman filter within the single PID controller approach for regulating all three
angles of the drone serves as a crucial preprocessing step. By filtering disturbances to gyroscopes and
accelerometers, it enhances estimation of the drone's state variables, addressing challenges associated with
sensor measurements. This effectively mitigates noise and uncertainties, improving the control system's
robustness and precision. With reduced noise influence on sensor measurements, the Kalman filter enables
more accurate error computation by the PID controller. This refined error calculation leads to more reliable
and stable output commands for coordinated orientation control. Thus, integrating the Kalman filter aligns
with the goal of simplifying the control system while enhancing accuracy and responsiveness.
5. SIMULATION MODEL
This section presents simulation and experimental results evaluating the performance of the
proposed PID controller design. The subsequent part includes a simulation of our control approach applied to
the quadcopter dynamic model. The chosen model aims to stabilize the drone by reaching an equilibrium
state with constant or zero translation coordinates and orientation angles. To achieve this purpose, PID
IAES Int J Rob & Autom, Vol. 13, No. 2, June 2024: 194-204
IAES Int J Rob & Autom ISSN: 2722-2586 199
control is employed as the primary control technique, determining control parameters for each coordinate.
Considering the digital control of the quadcopter, we opted for designing a discrete controller using
MATLAB, based on the system's non-linearity. The previous and current sections offer insights into the
discretization of the system performed during PID controller design based on simplified assumptions.
Table 1 lists the different parameters applied in the simulations. The physical parameters of the
quadcopter are used for the simulation tests as initial conditions in the quadcopter's dynamic model. Besides,
an adaptive control is developed to regulate the quadcopter's rotational dynamics.
Several flight simulations were conducted to evaluate the performance of our control approach. In
the first test, a single PID controller was generated for pitch, roll, and yaw angles, with carefully selected
gains. The evolution of (X ⃗ , ⃗Y, Z
⃗ ) according to desired trajectories was examined to assess performance. In the
second test, the drone was simulated with two PID controllers: one for pitch and roll, and another for yaw.
Complex trajectories, including those with non-zero derivatives, were tracked to validate performance.
Finally, a third PID controller dedicated to the theta angle was added to test robustness. Various performance
metrics such as tracking errors, settling time, and stability were analyzed to evaluate the effectiveness and
reliability of our control approach. Table 2 lists the initial conditions used for the simulations, including
initial linear and angular positions. Table 3 shows the lists of parameters used in the simulation tests.
Table 2. The initial conditions for simulations Table 3. The parameters used in the simulation tests
Angles Scenario 1 Scenario 2 Scenario 3 Parameter Value
X 0 𝜋 0 Simulation time 10 seconds
2 Trajectory type Third-order polynomial
Y 0 0 0
𝜋 Initial conditions Positions, velocities, accelerations
Z 0 0
2 Added noise With white Gaussian noise
Nonlinear Kalman filter for gyroscopic and accelerometer noise rejection … (Wassim Arfa)
200 ISSN: 2722-2586
Figures 6 to 8 illustrate the tracking of the desired trajectory by the quadrotor during the flight
simulation. Despite slight initial errors on all three axes due to noise, the quadrotor accurately follows the
trajectory. Conclusions regarding pitch, roll, and yaw angles remain consistent: perturbation is minimal with
three controllers, increases with two controllers, and becomes more significant with one PID controller.
These observations underscore the importance of multiple PID controllers in improving stability, reducing
disturbances, and minimizing angle errors in different directions. These figures highlight the benefits of
employing a distributed control system capable of effectively managing multiple angles while mitigating
noise effects through Kalman filtering, thereby reducing errors for each angle.
Figure 5. 1 PID controller with Kalman filter integration for Euler angle stabilization for scenario 1
Figure 6. 2 PID controllers with Kalman filter integration for Euler angle stabilization for scenario 1
Figure 7. 3 PID controllers with Kalman filter integration for Euler angle stabilization for scenario1
IAES Int J Rob & Autom, Vol. 13, No. 2, June 2024: 194-204
IAES Int J Rob & Autom ISSN: 2722-2586 201
Figure 9. 1 PID controllers with Kalman filter integration for Euler angle stabilization for scenario2
Figure 10. 2 PID controllers with Kalman filter integration for Euler angle stabilization for scenario2
Figure 11. 3 PID controllers with Kalman filter integration for Euler angle stabilization for scenario2
Nonlinear Kalman filter for gyroscopic and accelerometer noise rejection … (Wassim Arfa)
202 ISSN: 2722-2586
Figures 12 to 14 depict the flying robot's tracking of the desired trajectory in three-dimensional
space during flight. The observations reveal the varying performances of PID controllers for desired angles.
A single controller somewhat reduces noise disturbances for pitch, roll, or yaw angles. The reduction in
errors becomes more significant with two controllers, and disturbances are nearly eliminated with three
controllers. Thus, employing multiple PID controllers effectively enhances stability and greatly diminishes
disturbance impacts on these angles. Additionally, integrating a Kalman filter can further reduce errors
associated with gyroscopes and accelerometers for each angle in the presence of noise.
Figure 8. 1 PID controllers with Kalman filter integration for Euler angle stabilization for scenario3
Figure 9. 2 PID controllers with Kalman filter integration for Euler angle stabilization for scenario3
Figure 10. 3 PID controllers with Kalman filter integration for Euler angle stabilization for scenario3
IAES Int J Rob & Autom, Vol. 13, No. 2, June 2024: 194-204
IAES Int J Rob & Autom ISSN: 2722-2586 203
Through detailed analysis, we compared techniques used in each approach, noting differences that
influence the stabilization time. Our manual PID gain tuning resulted in shorter stabilization times, ensuring
improved responsiveness and agility. Additionally, our approach demonstrated robust stability under various
conditions, unlike others that showed sensitivity to disturbances, leading to longer stabilization times [25], [26].
7. CONCLUSION
This study proposes enhancing drone control by employing a three PID controller for each angle,
along with a Kalman filter as a preprocessing step. This integration improves stability, accuracy, and speed
by filtering disturbances and refining control tuning. Comparative analysis demonstrates the effectiveness of
the three PID controller approaches, providing better control adaptation to each angle's characteristics and
improving trajectory tracking accuracy. Additionally, the Kalman filter significantly reduces noise
disturbances, enabling more precise error calculation for the PID controller, particularly within the three PID
controller framework. While proving to be effective, further research is warranted to optimize controller
performance, potentially through refining the Kalman filter and exploring the active disturbance rejection
controller for enhanced stability.
ACKNOWLEDGMENTS
The authors would like to thank all participants who took part in this research and made this study
possible. Special thanks go to the University of Carthage for supporting this research.
REFERENCES
[1] H. Batti, C. Ben Jabeur, and H. Seddik, “Autonomous smart robot for path predicting and finding in maze based on fuzzy and
neuro‐Fuzzy approaches,” Asian Journal of Control, vol. 23, no. 1, pp. 3–12, May 2020, doi: 10.1002/asjc.2345.
[2] C. Ben Jabeur and H. Seddik, “Neural networks on-line optimized PID controller with wind gust rejection for a quad-rotor,”
International Review of Applied Sciences and Engineering, vol. 13, no. 2, pp. 133–147, Jun. 2022, doi: 10.1556/1848.2021.00325.
[3] R. Syam and Mustari, “Simulation and experimental works of quadcopter model for simple maneuver,” International Journal on
Smart Material and Mechatronics, vol. 1, no. 1, pp. 29–33, Nov. 2014, doi: 10.20342/ijsmm.2.1.33.
[4] A. Safaei and M. N. Mahyuddin, “Lyapunov-based nonlinear controller for quadrotor position and attitude tracking with GA
optimization,” Nov. 2016. doi: 10.1109/ieacon.2016.8067402.
[5] K. Rapp and P.-O. Nyman, “Optimization of extended kalman filter for improved thresholding performance,” IFAC Proceedings
Volumes, vol. 36, no. 18, pp. 119–124, Sep. 2003, doi: 10.1016/s1474-6670(17)34655-4.
[6] K. Khuwaja, N.-Z. Lighari, I. C. Tarca, and R. C. Tarca, “PID controller tuning optimization with genetic algorithms for a
quadcopter,” Recent Innovations in Mechatronics, vol. 5, no. 1., Apr. 2018, doi: 10.17667/riim.2018.1/11.
[7] J. Li and Y. Li, “Dynamic analysis and PID control for a quadrotor,” Aug. 2011. doi: 10.1109/icma.2011.5985724.
[8] R. Fessi and S. Bouallègue, “LQG controller design for a quadrotor UAV based on particle swarm optimisation,” International
Journal of Automation and Control, vol. 13, no. 5, p. 569, 2019, doi: 10.1504/IJAAC.2019.101910.
[9] V. Gomez, N. Gomez, J. Rodas, E. Paiva, M. Saad, and R. Gregor, “Pareto optimal PID tuning for px4-based unmanned aerial
vehicles by using a multi-objective particle swarm optimization algorithm,” Aerospace, vol. 7, no. 6, p. 71, Jun. 2020, doi:
10.3390/aerospace7060071.
[10] A. Sheta, M. S. Braik, and S. Aljahdali, “Genetic Algorithms: A tool for image segmentation,” May 2012. doi:
10.1109/icmcs.2012.6320144.
[11] A. Askarzadeh, “A novel metaheuristic method for solving constrained engineering optimization problems: Crow search
algorithm,” Computers & Structures, vol. 169, pp. 1–12, Jun. 2016, doi: 10.1016/j.compstruc.2016.03.001.
[12] V. V. Patel, “Ziegler-nichols tuning method: Understanding the PID controller,” Resonance, vol. 25, no. 10, pp. 1385–1397, Oct.
2020, doi: 10.1007/s12045-020-1058-z.
[13] M. Dubey, V. Kumar, M. Kaur, and T.-P. Dao, “A systematic review on harmony search algorithm: Theory, literature, and
applications,” Mathematical Problems in Engineering, vol. 2021, pp. 1–22, Apr. 2021, doi: 10.1155/2021/5594267.
[14] A. Sadollah, H. Eskandar, H. M. Lee, D. G. Yoo, and J. H. Kim, “Water cycle algorithm: A detailed standard code,” SoftwareX,
vol. 5, pp. 37–43, 2016, doi: 10.1016/j.softx.2016.03.001.
[15] M. Elhesasy et al., “Non-linear model predictive control using CasADi package for trajectory tracking of quadrotor,” Energies,
vol. 16, no. 5, p. 2143, Feb. 2023, doi: 10.3390/en16052143.
[16] S. Bouabdallah, A. Noth, and R. Siegwart, “PID vs LQ control techniques applied to an indoor micro quadrotor,” 2004. doi:
10.1109/iros.2004.1389776.
[17] Tilki Umut, Higher order sliding mode control of four rotor unmanned aerial vehicle. 2019.
[18] P. Jaiswal, “Demystifying drone dynamics!. components although most of us are… | by percy jaiswal | towards data science,”
Towards Data Science, 2018.
[19] M. Najm, A. Younis, and F. Majeed, “Mathematical modelling and PID controller implementation to control linear and nonlinear
quarter car active suspension,” Al-Rafidain Engineering Journal (AREJ), vol. 28, no. 2, pp. 113–121, Sep. 2023, doi:
Nonlinear Kalman filter for gyroscopic and accelerometer noise rejection … (Wassim Arfa)
204 ISSN: 2722-2586
10.33899/rengj.2023.137327.1216.
[20] A. Sarhan and S. Qin, “Adaptive PID control of UAV altitude dynamics based on parameter optimization with fuzzy inference,”
International Journal of Modeling and Optimization, vol. 6, no. 4, pp. 246–251, Aug. 2016, doi: 10.7763/ijmo.2016.v6.534.
[21] S. Zouaoui, E. Mohamed, and B. Kouider, “Easy tracking of UAV using PID controller,” Periodica Polytechnica Transportation
Engineering, vol. 47, no. 3, pp. 171–177, Mar. 2018, doi: 10.3311/pptr.10838.
[22] S. Khatoon, M. Shahid, Ibraheem, and H. Chaudhary, “Dynamic modeling and stabilization of quadrotor using PID controller,”
Sep. 2014. doi: 10.1109/icacci.2014.6968383.
[23] Y. F. Chan, M. Moallem, and W. Wang, “Efficient implementation of PID control algorithm using FPGA technology,” 2004. doi:
10.1109/cdc.2004.1429572.
[24] A. Sheta, M. Braik, D. R. Maddi, A. Mahdy, S. Aljahdali, and H. Turabieh, “Optimization of PID controller to stabilize
quadcopter movements using meta-heuristic search algorithms,” Applied Sciences, vol. 11, no. 14, p. 6492, Jul. 2021, doi:
10.3390/app11146492.
[25] I. Ullah, M. Fayaz, and D. Kim, “Improving accuracy of the kalman filter algorithm in dynamic conditions using ANN-based
learning module,” Symmetry, vol. 11, no. 1, p. 94, Jan. 2019, doi: 10.3390/sym11010094.
[26] Y. Du, P. Huang, Y. Cheng, Y. Fan, and Y. Yuan, “Fault tolerant control of a quadrotor unmanned aerial vehicle based on active
disturbance rejection control and two-stage kalman filter,” IEEE Access, vol. 11, pp. 67556–67566, 2023, doi:
10.1109/access.2023.3291409.
BIOGRAPHIES OF AUTHORS
Chiraz Ben Jabeur holds a master’s degree (2002) and a PhD degree in
Electrical Engineering (2007). Now she is an assistant professor at the Higher Institute of
Informatics (ISI) in the Department of Electrical Engineering and Computer Science. She is a
member of the research laboratory: RIFTSI at the ENSIT University of Tunis. Her current
research deals with systems control and artificial intelligence such as neural networks, fuzzy
logic, and genetic algorithms related to mobile robots' domain. She can be contacted at
[email protected].
IAES Int J Rob & Autom, Vol. 13, No. 2, June 2024: 194-204