Abstract
The presented study offers a comprehensive insight in design and application of the Kalman filters for improvement of control efficiency of small unmanned aerial vehicles with fixed wing. The presented control scheme of the UAV includes its model, a servo drive model, and an optimal proportional-integral-derivative (PID) controller for the selected flight speed. Subsequently, process noise and measurement noise components were introduced into the whole constructed UAV model. The process noise was formed by disturbances caused by horizontal and vertical airflow in the atmosphere. The measurement noise contained deterministic and stochastic errors of the inertial measurement unit (IMU) UAV sensors and engine noise. The obtained results showed that the designed optimal Kalman filter was able to eliminate the influence of interfering signals from the control process and increased the phase safety, controllability, and stability of UAV control as a lean design can be applied in real-time control systems like Pixhawk PX4.
1. Introduction
A large group of sensors installed in the UAV inertial measurement units is based on micro-electromechanical system (MEMS). These sensors have limited accuracy, so it is necessary to correct the sensor noise that affects measurement accuracy. The impact of positional and sensor errors requires the solution of a complex mathematical apparatus [1, 2]. The individual components of the three-axis gyroscopes and accelerometers affect the accuracy of the individual channels of the UAV control and navigation system [3]. Errors occur between individual channels due to the transformation of acceleration. The accuracy of the primary sources of the UAV’s inertial measurement unit is determined by environmental temperature changes and vibrations.
Interfering signals may affect the overall stability of UAV control. Interference consists of the noise mechanisms of the IMU UAV’s inertial measuring unit sensors, the surrounding atmosphere, the operation of the engine, and the pilot inputs to the control. The UAV contains a control unit Pixhawk, which is part of the avionic equipment used by the UAV “Skydog.” The unit provides data collection from the IMU sensors and performs calculations and processing of these data. The UAV control system operates in a closed loop that contains an IMU with sensors to determine the position of the UAV.
Disturbance signals can affect the overall stability of UAV control. Interference can be caused by noise from the sensors of the UAV’s inertial measurement unit (IMU), the surrounding atmosphere, the engine operation, and the pilot inputs into the control. The UAV used in the study contains the Pixhawk control unit, which is part of its avionic equipment. The unit ensures data collection from IMU sensors and performs calculations and processing of this data. The UAV control system operates in a closed loop, which includes IMU with sensors to determine the position of the UAV.
The internal control loop of the UAV performs its primary stabilization, while the outer loop performs tasks related to the UAV’s manoeuvring and navigation. The analysis performed, with an emphasis on the accuracy of the UAV’s IMU sensors, plays a decisive role in autonomous navigation using integration algorithms [4]. The Kalman filter in the UAV control circuit is used to estimate the state variables of the UAV system for given measurements of output signals of the system, including measurement and process noise. Static measurements of the Pixhawk PX4 IMU sensors are required to determine the measurement noise parameters. The analysis is performed for all three axes of the Pixhawk PX4 IMU accelerometers and gyroscopes using standardized procedures [5, 6]. For longitudinal UAV movement, it is primarily necessary to analyse the gyroscope data on the -axis.
The design of new UAV control algorithms can be implemented in the Matlab/Simulink simulation environment using the PX4 Autopilot Support from Embedded Coder software. The software can generate C++ (object-oriented computer language) code from the Simulink simulation environment. The code structure is compatible with the Pixhawk PX4 autopilot software. The proposed algorithms can be changed and adapted as needed or completely replace the Pixhawk PX4 control system. For control commands from the remote control (RC) transmitter, it is possible to use input blocks, which can be used to adjust the control signal. The modified signal can be used as input for the “pulse-width modulation (PWM) output” block, which represents the control servos attached to the control surfaces of the UAV. With the use of libraries in the Matlab/Simulink program, it is possible to use individual blocks of sensors that will generate data from the analysed sensors of accelerometers and gyroscopes. To implement the proposed algorithms in the Pixhawk PX4 autopilot unit, it is necessary to install the necessary “Cygwin toolchain” interface [7].
The design of a suitable control system for a small fixed wing UAV must be preceded by the creation of a mathematical simulation model to assess the optimal UAV control algorithm’s influence on its properties under the influence of disturbing signals. The mathematical simulation model is based on physical quantities obtained during experimental flights and measurements of its aerodynamic and mechanical properties. This model is used to design an optimal controller, which is analysed by changing its coefficients as the UAV’s flight speed changes. The optimal controller can be verified by the real flight of the UAV and a mathematical model with six degrees of freedom (6DoF). Using the 6DoF model of a small fixed wing UAV, inputs represent elevator deflection, and outputs that are represented by the angular velocity of pitch angle are obtained. The proposed control system for UAVs with an optimal controller is extended by a Kalman filter.
The Allan variation method can be used to analyse the sensors of the Pixhawk PX4 autopilot. The method is a possible equivalent of the power spectrum in time. Allan’s variance is a tool that graphically displays the performance of the analysed signal. It displays the signal as a function of time the averaged sensor output subparts compared to a graphical representation of the signal power as a function of frequency. The use of Allan’s variance is determined by the Institute of Electrical and Electronic Engineers (IEEE) standard, which defines not only its application but also the procedure by which the results are analysed. The result is a representation of noises in the output of the IMU sensors in terms of long-term time development. The slopes of the straight lines represent the individual types of noise represented in the output of the Pixhawk PX4 IMU sensors [6].
Atmospheric turbulence is one of the sources of UAV control errors. Turbulence is the movement of air caused by the unstable distribution of pressure and temperature in clouds near the earth and in the area of currents. Atmospheric turbulence can be defined as a stochastic process determined by velocity. Of the disturbances that affect the UAV during flight and landing, the moments are caused by horizontal and vertical airflow. Turbulent flow is characterized by the fact that the velocity at a given point varies considerably and irregularly. A sudden gust of wind acting on the UAV from below results in an increase in the angle of attack. The random component of the wind speed vector represented by the turbulence of the atmosphere affects the short-term oscillations and position angles of the UAV [8]. The pilot is one of the members of the UAV control loop, and their good training can reduce the control deviation. Other interfering signals are introduced into the UAV control process by the operation of the engine.
The control loop of the UAV includes feedback from sensors that contain various types of noise and interference in addition to the required information. These noises and disturbances are processed by control systems and therefore need to be identified [9]. The sensor error model and Alan’s variation can be used to identify sensor errors. When creating a sensor error model, it is necessary to perform a long-term static measurement from which sensor errors are identified [4]. Based on the knowledge of the sensor error model, it is possible to design an optimal linear-quadratic-Gaussian (LQG) controller for the UAV control system [10]. In the kinematic vehicle, models are used together with IMU, global navigation satellite system (GNSS), and multidirectional airspeed sensors to estimate the wind field [11]. The work focused on approaches using aircraft models that fully model the aerodynamic and kinematic behaviour of UAVs [12]. Ravi Kumar and Dr Ramamurthy, in their paper in 2015 [13], validated a model of aircraft inclination, tilt, and side slip control using an linear-quadratic regulator (LQR) controller and an LQG controller. The results of the simulation and analysis showed that the linear-quadratic regulator (LQR) controller delivered relatively better performance. The LQG controller achieved very good results with an output device with limited constant shift error, and the Kalman filter was the optimal estimator when working with Gaussian white noise. LQR control is used with a Kalman filter (KF) that estimates the real states of the system in noisy environments in state feedback servo control systems [14]. Based on [15, 16], it can be stated that PID, LQR, and LQG controllers can be used to increase the stabilization of the pitch angle. The use of one regulator will increase the stability of the UAV and reduce the impact of noise that may occur in the control process. The system’s response to the required change is shortened, and unwanted oscillations are also eliminated. According to [17], random vibrations caused by the UAV engine or external influences must also be considered in the process of estimating the optimal state of the system. Li et al. [18] improved the longitudinal static stability and dynamic properties of the UAV flying wing by designing an extended robust LQR.
Thanks to non-Gaussian methods, new concepts of approximation methodologies for optimal filtration that are more efficient than the Kalman one have been developed [19]. The most popular methods in this area are the unscented and extended Kalman filters [20] as well as methods based on particle filtering. These methods are however quite complex to develop and implement in real-time systems with limited computational power [21].
Based on the previous study, the aim of the present research was to design an optimal standard Kalman filter, which should be able to reduce interfering signals acting on Pixhawk PX4 sensors by extending the control scheme applied on a fixed wing unmanned aerial vehicle. The optimally designed standard Kalman filter is aimed at applying real-time control systems improving its phase safety, manoeuvrability, and control stability in general by application of precise analysis of disturbing signals acting on the UAV.
2. Materials and Methods
The object of observation was an unmanned aerial vehicle with a fixed wing, called “Skydog” (UAV). Due to its flight control and mechanical similarity with general aircraft, it can be used to perform experiments in the field of autonomous aircraft control. The wingspan of the UAV “Skydog” is 2.3 meters, the basic empty weight is 6.85 kilograms, and the maximum take-off weight is 8.65 kilograms. The UAV is able to carry the necessary measuring equipment or small experimental equipment.
2.1. Dynamic Modelling of UAV Flight
During the flight, several different types of forces act on the UAV, the interaction of which affects the movement and position of the UAV in space. According to the basic understanding, there are four forces: lift, thrust, aerodynamic drag, and weight (gravity). The force of weight (gravity) depends on the mass of the UAV and the gravitational acceleration. In the case of UAVs, the mass is constant during flight, and the change in gravitational acceleration due to the change in altitude is negligible. Lift and aerodynamic drag depend on the airspeed, pressure, temperature, ambient density, and aerodynamic coefficients of the aircraft.
The aerodynamic coefficients of UAVs are derived from the geometric dimensions of the UAVs. The thrust depends on the characteristics of the power unit, the shape and size of the propeller, and the environment in which it operates. The position angles are an important factor when calculating UAV forces. Using position angles can transform the individual components of forces and moments into a common system. In our case, we used the aircraft coordinate system. When describing the translational motion of UAVs, we began with the equation of aerodynamic forces. Aerodynamic forces are generated on the lifting aerofoil area and tail surfaces [22]. The calculation of aerodynamic forces is described by the following relations:
where
: Aerodynamic force acting on the aircraft -axis,
: Aerodynamic coefficient expressing the dependence of drag on angle ,
: Angle of attack,
: Aerodynamic coefficient expressing the dependence of drag on angle ,
: Wing surface,
: Total atmospheric pressure (dynamic pressure),
: Aerodynamic force acting on the aircraft -axis,
: Sideslip angle,
: Aerodynamic coefficient expressing dependence on lateral force ,
: Aerodynamic coefficient expressing dependence on lateral force ,
: Angular speed of rotation around the -axis in the plane coordinate system,
: Wing span,
: Indicated air speed,
: Aerodynamic coefficient expressing the dependence of the yaw moment,
: Vertical control surface (rudder) deflection,
: Aerodynamic force acting on the aircraft -axis,
: Aerodynamic coefficient expressing the dependence of lift on angle ,
: Aerodynamic coefficient expressing the dependence of lift on angle ,
: Aerodynamic coefficient expressing the dependence of ,
: Angular speed of rotation around the -axis in the plane coordinate system,
: Wing chord,
: Aerodynamic coefficient expressing the dependence of the pitch moment,
: Horizontal control surface (elevator) deflection.
The constants in the equations are the aerodynamic coefficients of the aircraft denoted by and the geometric dimensions of the wings as the wingspan, wing area, and center of the wing chord (, , and , respectively).
The UAV variables are angle of attack , dynamic pressure , airspeed , horizontal control surface (elevator), and vertical control surface (rudder) deviations and . All the forces are situated in the aerodynamic coordinate system. We created the change in the UAV position with moments using control surfaces.
The aerodynamic moments in the individual axes of a UAV are described by the following relations [23]:
where
: Rotation moment around -axis,
: The aerodynamic coefficient expressing the roll moment dependence on ,
: The aerodynamic coefficient expressing the roll moment dependence on ,
: Aileron deflection,
: Coefficient expressing the roll moment dependence on ,
: Coefficient expressing the roll moment dependence on ,
: Coefficient expressing the roll moment dependence on ,
: Angular speed of rotation around the -axis in the plane coordinate system,
: Rotation moment around the -axis,
: The aerodynamic coefficient expressing the pitch moment dependence on ,
: The aerodynamic coefficient expressing the pitch moment dependence on ,
: The aerodynamic coefficient expressing the pitch moment dependence on ,
: The aerodynamic coefficient expressing the pitch moment dependence on ,
: The aerodynamic coefficient expressing the pitch moment dependence on ,
: Rotation moment around the -axis,
: Aerodynamic coefficient expressing the turning moment dependence ,
: Aerodynamic coefficient expressing the turning moment dependence ,
: Aerodynamic coefficient expressing the turning moment dependence ,
: Aerodynamic coefficient expressing the turning moment dependence ,
: Aerodynamic coefficient expressing the turning moment dependence .
The longitudinal motion of UAVs is described by a set of four first-order linear differential equations with four unknowns . The equations are related to the axes of the coordinate system firmly connected to the aircraft. The longitudinal motion of UAV is described by the motion equations corresponding to the forces and and the moment . Movements that are not limited in the longitudinal plane have no effect, i.e., “”…“= 0” [24].
The following relationship is used to describe the system in the state space:
The notation of linear differential equations for the longitudinal motion of the UAV has the following form [25]:
The root shape of the characteristic equation determines the properties of the UAV’s motion. Depending on the coefficient values of the characteristic equation, which determine the aerodynamic and inertial characteristics of the UAV, it is possible to determine variants of the UAV’s motion from the graphical solution of differential equations. The longitudinal motion of the UAV is characterized by two complex associated roots, and the motion of the UAV is described by two oscillating members, the short-period and phugoid modes.
We observed the static and dynamic stability of UAVs. With static stability, when the UAV deviates from the equilibrium position, the UAV returns spontaneously to the equilibrium position without mechanical or human intervention. In the longitudinal plane with a dynamically stable UAV, the amplitude of the oscillations will decrease with external intervention until it reaches a stable value.
2.2. Modelling the Noise of UAV Sensors
In hobby-type UAVs, it is not effective to install expensive and large INS sensors. It is therefore necessary to analyse the output of the IMU sensors or take steps to increase the accuracy of the measurement. These MEMS sensors are more susceptible to the different types of noise that can be registered in the sensor.
For reliable analysis of the noise mechanisms of the IMU inertial sensors, it is necessary to perform static measurements over a long-time interval. The Allan variation method can be used for the analysis of UAV sensors [15]. The use of Allan variance for the analysis of IMU sensors is determined by the IEEE standard, which defines the procedure of steps by which the results are analysed. The result of the analysis is the representation of noise in the output of the IMU sensors in terms of long-term time development [26].
To create an Allan variance graph, it is necessary to sample a continuous time series. It is defined by the sampling frequency , which is already defined before the start of the static measurement. The total number of samples is defined by the following relation:
In equation (5), represents the time of the entire measurement series in seconds. After subsequent sampling of this continuous signal, the Allan variance calculation process is as follows:
A vector of averaged intervals in seconds is created.
For each vector , the time series is divided into clusters.
The average is then calculated for each cluster :
Using the Allan variance the output for the individual cluster averages of vectors is the averaged interval according to the following relation:
For the analysis of IMU noise in the time domain, a graph is created in a logarithmic scale, where it is an independent variable and a dependent variable .
To correctly model the error model according to the standard, it is necessary to determine the bias drift correlation time, the bias drift standard deviation, and the broadband noise standard deviation.
Bias drift is modelled as a first-order Gauss-Markov process. These parameters can be determined using the Allan variation and appropriate relationships. The standard deviation of the wideband noise is defined by the standard as a line with a slope of . Its range can be determined by the following relationship: where is the wideband noise coefficient and is the sample time.
The point in the Allan variation graph at which the curve reaches the local maximum is used to determine the bias drift correlation time. The definition of correlation time is based on the following relationship:
There is a quick direct approach for extraction of the and noise parameters that does not require least mean square estimation procedure.
To determine the bias instability of the sensors, a coefficient is used, which is calculated according to the following relation:
and represent the time on the root AVAR versus , graph where the parameters and are to be evaluated.
In analysing UAV sensor errors, it is also necessary to determine the misalignment error and the nonorthogonality error. These errors must be included in the sensor error model.
When we model bias drift as a first-order Gauss-Markov process, we can describe its behaviour as follows:
We calculate the constant according to the following relation: where is calculated as follows: where is the correlation time and the numerical value of is read from the Allan variance graph at the point of overshoot of the curve (local maximum).
For calculation, the previous sample , white noise , and constants , , and are used. Constant represents the sampling time. The value of the constant is equal to the standard deviation of the filtered signal. Constant is calculated as the inverse of the known value of correlation time .
If the first-order relationship describing the Gauss-Markov process is known, then a simulation scheme in Matlab/Simulink can be created to simulate the effect of bias drift on sensor measurements. The basis for simulating the Gauss-Markov process is a white noise generator. The model representing the sensor bias drift is shown in Figure 1. Another noise mechanism like angle random walk (ARW) affecting sensor measurement needs to be modelled. White noise generator block is used to simulate ARW noise. In the field that determines the power of the generator, we insert the square of the value obtained from the Allan graph.

To determine the sensor misalignment, we used the following relationship: where is the misalignment error, is the unit matrix, is the antisymmetric matrix of deviations in the individual axes, and is the input angular velocities of the gyroscopes in the axes (body frame) of the aircraft.
To model the nonorthogonality error, we began with the following relation: where is the error of gyroscope nonorthogonality and is the antisymmetric matrix of deviations in the individual axes (INS, body frame).
2.3. Atmospheric Disturbances Affecting UAVs
The overall stability of UAV control is influenced by the atmosphere in the environment in which the aircraft flies. The moments caused by horizontal and vertical airflow are fundamental disturbances that affect the UAVs during flight and the landing phase [27].
Turbulence denotes changes in atmospheric motion that disrupt flight, especially during take-off and landing. Turbulence can arise from changes in atmospheric pressure or hot or cold fronts. The instantaneous velocity vector changes randomly within certain limits, changing its size and direction.
Due to the complexity, simplified models were used for simulation and description of Dryden’s turbulence model. In Dryden’s turbulence model, the components of the linear and angular velocities of continuous impacts are spatially changing stochastic processes.
Noise with known spectral properties such as velocity and angular velocity deviation in individual aircraft axes is used for modelling. The noise spectrum for each of the disturbances is defined by the turbulence length , the air velocity , and the turbulence intensity .
The turbulence rate length is the length of the turbulent field expressed in the longitudinal, lateral, and vertical axes (, , and , respectively).
The turbulence intensity is the magnitude of turbulence expressed in the longitudinal, lateral, and vertical axes (, , and , respectively); it is given in ft/s or m/s.
To overcome the UAV turbulence, the time is required:
The UAV experiences a turbulent wave with a frequency of
Dryden’s turbulence model is characterized by the power spectral density as a function of frequency.
The power spectral density for the linear flow velocity components (, , and ) has the following form:
The power spectral density for the angular flow velocity components (, , and ) has the following form: where is the wingspan of the UAV.
Wind shear is defined as a change in wind speed and direction at a relatively short distance from the atmosphere. The wind, by its action, introduces an error component into the measurement of UAV sensors. A sudden gust of wind acting on the UAV from below results in an increase in the angle of attack and a change in the airspeed vector relative to the ground.
The UAV “Skydog” uses an electric noncontact AC (alternating current) motor with rotating housing and neodymium magnets for forward movement, which introduces a certain component of the error into the measurement process.
2.4. Design and Implementation of Kalman Filter
The Kalman filter method can be an effective and versatile method of combining the outputs of IMU sensors that are loaded with various noise mechanisms and disturbances to estimate the states of a system that has indeterminate dynamics. The basic parts defined by the Kalman filter are the state vector and its covariance, the system model, the measurement vector and its covariance, and the measurement model.
When used in UAV control and navigation, the state vector contains position-determining components or errors in position. The Kalman filter also contains estimates of angular position, velocities, and errors of individual IMU UAV sensors. The covariance matrix of the state vector defines the uncertainties in the state estimates of the Kalman filter and the degree of correlation between the errors of the estimates [28].
The state estimate can be considered optimal if the sum of squared errors of the estimated state variables is as small as possible at any time.
To use the UAV model with the optimal Kalman filter, it is necessary to create a state space of the UAV model in the discrete form [29].
Discrete state space is characterized by the following relationships: where is the -dimensional state vector, is the -dimensional measurement vector, is the -dimensional measurement error vector (Gaussian white noise), is the input signal, is an -dimensional Gaussian white noise with zero mean, is a system matrix of , is an excitation matrix of , is an output matrix of , is the direct feedback matrix bonds, and is the sample number.
To update the estimated state vector, we used the following relation:
To calculate the matrix gain (weight matrix), the following relation is used:
To update the covariance matrix, the following relationship is used: where is the corrected value of the estimated state vector from the previous state of the algorithm, is the discrete matrix of the dynamical system, is the predicted value of the estimated state vector, is the gain matrix, is the measurement matrix, is the covariance measurement matrix, is the current measurement vector, is the updated value of the estimated state vector, is the updated value of the estimated covariance, and is the covariance matrix of the process noise.
It is assumed that the noises and are white noises with zero mean value [29].
The mean and covariance of the random processes are described by where is the process noise vector and is the measurement noise vector, shown in Figure 2.

3. Results and Discussion
The values of the forces and moments acting on the UAV “Skydog” affected the geometric and aerodynamic coefficients. The necessary geometric coefficients for the calculation of the forces and moments of the UAV were obtained from the technical documentation and by measuring the aircraft itself. Aerodynamic coefficients for the UAV “Skydog” were obtained using the XFLR5 program. Their values are given in Table 1 [30].
Based on the obtained aerodynamic coefficients shown in Table 1, a mathematical simulation model of the dynamic movement UAV “Skydog” was created. To verify it, a longitudinal plane comparison was performed [31].
When designing an optimal regulator for the motion control of the UAV “Skydog,” a control model scheme from the UAV transfer function expressed the response of the aircraft in pitch rate to elevator deflection, PID pitch rate controller, and the actuator transfer function [29]. Based on the knowledge of the approximation polynomials, the PID controller coefficients for the selected UAV “Skydog” speed were calculated. The best PID gains obtained by tuning were , , ; and filter coefficient is [29].
The controller with these coefficients was then used to create a state space model of the Skydog airplane with the PID controller in a feedback loop. The observed state parameter represents the pitch rate .
The UAV “Skydog” model for a speed of 90 km/h in a discreet time with a sampling rate of 100 Hz has the form of matrixes (30) and (31), and the state variable represents the pitch rate . It is the observed parameter of the model; matrixes and are the same as (28) and (29):
The resulting output of this representation of the UAV in longitudinal plane of motion is the pitch rate as a response to the commanded pitch rate .
The UAV Pixhawk control unit is a programmable platform; it contains SCA3100-D04 accelerometers and IDG-500 gyroscopes for the - and -axes and an ISZ-500 gyroscope for the -axis.
For the analysis of IMU sensors, a static measurement was performed with zero effect of external forces. The Allan variation method was used to define and eliminate the noise mechanisms of the sensors. The specified velocity random walk (VRW) and angle random walk (ARW) values for the accelerometers and gyroscopes of the Pixhawk control unit are given in Table 2, for a sampling time of 0.1 seconds, N gyroscope for Y axe 2.27810-4.
Where N is the broadband noise coefficient, B is the bias instability coefficient, K is the random walk coefficient.
The determined values of the autocorrelation , correlation time , and drift bias of IMU sensors are given in Tables 3 and 4.
The Allan variation method was used to define and remove noise IMU mechanisms. Figure 3 shows graphs of the Allan variation of individual accelerometer axes and IMU gyroscopes. A sensor error model was compiled using Matlab/Simulink, which included blocks for modelling noise mechanisms, nonorthogonality errors, and IMU Pixhawk PX4 sensor misalignment errors, shown in Figure 4.


The internal structure of the error model for accelerometers and gyroscopes is the same, and the output is different only in the measured units.
Using the Allan variation, the output waveforms from the measured IMU UAV sensor data and the data from the generated IMU error model were compared, shown in Figure 5.

The IMU fault model includes the simulation of noise introduced into the measurement of sensors with the engine influence. The UAV “Skydog” uses an electric noncontact AC motor with rotating housing and AXI 5320/34 neodymium magnets for forward movement. The motor is powered and controlled by the regulator SPIN 77 opto, which serves to regulate the voltage and current to the motor depending on the required power from the pilot. The regulator is powered by FOXY G2 onboard batteries with a voltage of 18.5 V and a capacity of 5000 mAh. The effect of the motor on the IMU UAV sensors was simulated as white noise. The magnitude of the interference is proportional to the standard deviation of the noise measured during the static measurement of the motor influence on the measurement of the IMU sensors, shown in Figures 6 and 7. The standard deviation values of the noise are shown in Table 5.


To reduce the impact of the motor on the IMU UAV sensors, a filter was designed, which was implemented using the “digital filter design” block, Figure 8, in the Matlab/Simulink program environment. A low-pass Butterworth IIR filter was designed as optimal, shown in Figure 9.


The coefficients of the designed filter have the following values listed in Table 6.
For better information about the functioning of the designed filter, the basic parameters of the signal were therefore evaluated, namely, mean value, standard deviation, median, and variance. The result from the simulation is shown in Figure 10. These values for all three axes of the accelerometer are shown in Table 7.

The atmospheric impact model was based on the “Dryden wind turbulence model” block in the Matlab/Simulink environment. The inputs of this block were airplane flight speed, airplane flight altitude, and cosine control matrix (DCM). The UAV flight speed was 90 km/h, and the flight altitude was set at 50 meters. The input DCM was calculated based on the zero angles of the attack and sideslip angle. The simulation provides the necessary turbulence model, which is suitable for implementation in the filter, where it simulates the real impact of turbulence on UAV control. The turbulence simulation represents the process noise entering the control, shown in Figure 11. The low altitude area is defined by an altitude of up to 305 meters. In this area, the values of turbulence intensity and turbulence rate were defined as follows. The degree of turbulence is a function of height:

The following is the turbulence intensity: where is the wind speed at 6 m.
For weak turbulences, this value was given at a wind speed of ; for medium turbulences, it was , and for strong turbulences, it was .
The Kalman filter method can be used to combine the outputs of UAV sensors, which are loaded with various noise mechanisms and faults. The proposed Kalman filter estimates the states of a system that has indeterminate dynamics, shown in Figure 12.

The proposed optimal Kalman filter estimates the immeasurable output of the UAV pitch angle, shown in Figure 13. The Kalman filter filters out noisy signals from airspeed, angle of attack, and pitch rate sensors [25]. In the design of the KF, the covariance matrices and proved to be optimal. The diagonal elements of the matrix represent the variations of the individual sensors, and, in the simulations, they had the following values:

The optimization of the and matrices is essential for the best possible KF response to noisy sensor signals, wind gusts, and motor impact. Based on the determined values of the and matrices, the gain was calculated as follows:
Process noise is created by disturbances that affect the UAV during take-off, flight, and landing; these are moments caused by horizontal and vertical airflow. Based on these components of the process noise, the error vector of the process (Gaussian white noise with zero mean value) was determined, which has the following form:
The measurement noise was created by the UAV sensors themselves and their error models. Therefore, the definition of the measurement noise was based on the analysis of the Pixhawk PX4 IMU sensors. Based on these measurement noise components, the vector of the measurement errors (Gaussian white noise with zero mean value) was determined, which has the following form:
The process noise in the assembled model is represented by the component of the angular flow velocity from the turbulence model. The measurement noise is represented by the noise signal analysed on the -axis gyroscope. The output signal of the UAV model was affected by interference signals. The estimate of the Kalman filter has an average error of 0.002°/s as shown in Figure 14, and the estimation of the state of the optimal Kalman filter is shown in Figure 15. The suitability of the selected size of the covariance matrices and is proved by Table 8, which shows the difference in the size of the covariance error at different set values of the covariance matrices and with real input noise.


4. Conclusions
The proposed optimal Kalman filter obtained from the UAV control process eliminates the influence of interfering signals with the required controllability and stability. Because the signals outputted from the IMU sensors serve as feedback to the UAV control system, they must provide real information about position angles and angular velocities. If this information contains noise components, UAV controllability is reduced or lost. Due to this requirement, it was necessary to perform an analysis of IMU Pixhawk PX4 inertial sensors. Error models of the IMU sensors were created, and the sensor measurement outputs were compared with the real static sensor measurement outputs. The values of the biases of the IMU accelerometers and gyroscopes were used for comparison. The results of Allan’s sensor analysis are shown in Figure 5. The -axis gyroscope was given priority in the analysis of the longitudinal movement of the UAV. The accuracy of the sensor was determined by the standard deviation of the wideband noise and angular random walk (ARW) given in Table 2.
Based on the acquired knowledge, an error model of inertial sensors, a turbulence model, and a model of the longitudinal motion of the “Skydog” aircraft in a discrete state space were created. An optimal Kalman filter model was created, which estimates the state of the angular velocity of the UAV’s pitch angle. The results showed that the UAV’s longitudinal motion model was significantly disturbed after the connection of measurement noise and process noise, which made UAV control difficult. By connecting the optimal Kalman filter to the UAV control process, the influence of covariance errors on the control process was reduced, as shown in Table 8. The setting of the Kalman filter in the UAV control process was optimal, with an estimated average error of 0.002°/s. The requirements for the created UAV control system were determined by the criteria contained in the identification of the control object so that the control system was robust enough to ensure the stability of the system during various phases of the flight and state of the UAV.
The proposed system improved the phase stability of the UAV. During the entire speed range from 50 km/h to 150 km/h, it had a value of around 68 degrees, and the cut-off frequency varied at -3 dB in the range from 87 rad/s to 219 rad/s.
Data Availability
The numerical data used to support the findings of this study are available from the corresponding author upon request.
Conflicts of Interest
The authors declare that there is no conflict of interest regarding the publication of this manuscript.
Acknowledgments
This work was funded by the project Mobile Monitoring System for the Protection of Isolated and Vulnerable Population Groups against Spread of Viral Diseases, ITMS code 313011AUP1, co-funded by the European Regional Development Fund under the Operational Programme Integrated Infrastructure. This work was supported by the Scientific Grant Agency of the Ministry of Education, Science, Research and Sport of the Slovak Republic under the project VEGA 1/0701/23—Efficient control algorithms for small gas turbine engines.