Performance Evaluation of a Sliding Mode Control-Kalman Filter- Based Mathematical Model for Altitude and Attitude Control in Quadcopters

This study presents an evaluation of a mathematical model designed for altitude and attitude control in quadcopters, employing Sliding Mode Control (SMC) in conjunction with the Kalman Filter algorithm. The developed mathematical model focuses on controlling the quadcopter’s height along the z-axis and its attitude, encompassing roll, pitch, and yaw. Simulation results demonstrate that the quadcopter achieves stable control within a time span of 2 to 4 seconds. The designed control system has been simulated, implemented on a miniquadcopter, and tested for the occurrence of chattering events. The incorporation of the SMC-Kalman Filter control system effectively mitigates chattering, resulting in enhanced stability for the quadcopter. This work show cases the potential of the proposed mathematical model in achieving precise and stable control in quadcopters, thus expanding the applicability of such systems in various applications.


Introduction
The growth and application of UAV (Unmanned Aerial Vehicle) technology has not only changed the direction of industrial development, but also brought market and economic benefits [1]. UAVs are applied not only in various civil and military fields such as air patrols, exploration of natural resources, as well as tracking victims of natural disasters, mapping areas, monitoring natural disasters, but also in detecting humans and assisting in search and rescue scenarios [2][3][4]. One type of UAV currently being researched is the quadcopter [5]. Due to its various advantages over other unmanned aerial vehicles (UAVs), including the capacity to take off and land vertically, high levels of agility and maneuverability [6], small size, and low cost [7], quadcopter UAVs are gaining popularity in recent years [8]. This popularity has become the main attraction for researchers to develop a control system for quadcopters [9]. Several control systems on quadcopters have been extensively studied to track trajectories according to predetermined patterns. The design of the tracking system with Sliding Mode Controller and Fuzzy Type-2 has succeeded in tracking the required track and significantly reducing the chatter generated by the SMC. Quadcopter is divided into two subsystems, namely, attitude and position [10][11][12]. In addition to directing movement based on the trajectory, a quadcopter control system has also developed a moving target tracking system, and the research was carried out using a camera based on the Fuzzy-PI control system [13]. The Attitude control system with Auto Tuner has been developed for the trajectory tracking system on quadcopters. The results obtained are in accordance with the bias results using the Self-Tuner, which can be in accordance with the specified trajectory [14]. Recent research has been carried out through numerical simulations, the effectiveness of Sliding Mode Control (SMC) together with backpropagation neural network (NN) as the main control of the quadrotor dynamic system was tested on various paths and situations [15].
Some of the research above regarding trajectory tracking has been widely developed, for control systems are widely applied using a sliding mode controller algorithm. However, since the shift mode controller is a high-speed switching feedback control, engineers may encounter unfavorable oscillations with limited frequency and amplitude, or "chattering", in practical application of shift mode control [16]. Position and attitude control with integrated SMC https://doi.org/10.56578/jisc020202 is adaptive for inner (position) and outer (attitude) loops. Various control systems have been studied to overcome the chattering problem in Sliding Mode Control, one of which uses the Kalman Filter. The main function of the Kalman Filter is not to filter or filter the incoming signal, but to estimate according to the given input, therefore, the signal results after going through the Kalman Filter process appear to be filtered [17,18]. Previous studies that have been carried out have succeeded in making numerical simulations that can be tested in various trajectories [15]. However, the quadcopter must go through several phases of flight. The flight phase of the movement on the quadcopter is divided into 3 main phases, namely taking off, hovering and landing [19]. Altitude and attitude control on the quadcopter is key so that the quadcopter can take off and hover in a stable manner. Several studies have been conducted to create an altitude and attitude control system using the SMC [20]. Control system development continues to be carried out to reduce chattering resulting from the SMC method [21]. Altitude and attitude control on a quadcopter has not been studied previously. Therefore, the Sliding Mode Control and Kalman Filter control systems to reduce the chattering phenomenon will be discussed for the altitude and attitude control system on the quadcopter. In this paper, a comparison of the altitude and attitude control systems on a quadcopter with SMC and SMC-Kalman Filter will be made. In addition, wind disturbances that occur to the quadcopter outdoors will be considered. The design of a mathematical model for controlling altitude and attitude systems on a quadcopter based on the SMC-Kalman Filter will be tested directly on the quadcopter to see the performance of the quadcopter with the application of the mathematical model that has been made.

Quadcopter Mathematical Modelling
The model adopts basic quadrotor structure with the Euler angles of roll, pitch, and yaw, a body coordinate frame b, and a global coordinate frame G [22]. The rotational and translational motions of the quadcopter are formed based on basic structure in Figure 1. Any orientation of a rigid body can be achieved by the combination of the three basic Euler angles. The rotation matrix for each Euler angle is given by Eq. (1): with s x = sinx and c x = cosx, the following describes how the global and body coordinate frames are transformed.
Under assumption that the quadcopter has a symmetric structure with the four arms aligned with the body xand y-axes, it means that the quadcopter is designed in a way that the four arms are evenly distributed around the central point of the quadcopter's body, forming a symmetric pattern. This design feature can help ensure that the quadcopter is stable and balanced during flight. By aligning the arms with the body x-and y-axes, it is easier to control the quadcopter's movements along those axes. This can make it easier to perform tasks such as hovering in a fixed position, flying forward or backward in a straight line, or turning left or right.
The quadcopter's translation motions, which are represented in the body frame according to Newton's second law, are acquired by taking into account its forces F, which are described in the global frame by: To relate the two frames, ω is used to describe the angular rotation of the body fixed frame with respect to the global fixed frame.
where, ω is the angular velocity vector and Eq. (5) is the non-linear translational motion.
J x , J y , and J z are the moments of inertia about the principal axes in the body frame, and J x y= J x z =J y x =J y z =J z x =J z y = 0, since the quadcopter structure is symmetric. Nonlinear dynamics of quadrotor can be expressed as follows:φ From the equations above, J r is rotor moment of inertia; p, q, r are roll, pitch and yaw rate along in x b , y b , z b ; l is length of arm; K T is thrust coefficient; K d is drag torque propotionality constant; ω is rate of angular velocities; F b T is total force of thrust in the global coordinate frame; X G , Y G , Z G are velocity in the global coordinat frame.
The four rotors' speeds can each be changed individually to control the quadrotor.

Control System Design
The control system is designed with a combination of the Sliding Mode Control (SMC) algorithm and the Kalman Filter. The design of the SMC and Kalman Filter control systems will be integrated into the quadcopter dynamic equations to control each motor on the quadcopter. Sliding Mode Control (SMC) and Kalman Filter are two techniques that can be used together to control the quadcopter effectively and efficiently [22].

Sliding Mode Control (SMC)
Sliding Mode Control (SMC) is a nonlinear control strategy that is designed to ensure the stability and robustness of a control system in the presence of disturbances or uncertainties. It works by forcing the system to slide along a predetermined sliding surface, which is a hyperplane in the state space that separates the system dynamics into two regions: the sliding mode and the reaching mode. SMC has many advantages, including its exceptionally resilient nature and ability to perform effectively on nonlinear systems with model or parameter uncertainty. The following features and conditions are connected to the SMC design: where, s is the sliding variable, λ is the determined gain and e is the error.
x d is desired state vector, x is for ϕ, θ, ψ, x, y, z. λ is a sliding surface slope with a positive constant value given to the SMC control system. The Lyapunov function was chosen: The sliding control law contains two terms as follows: where, u e q(t) indicates the corresponding control, which may be used to predict how the system behave once an ideal sliding regime has been established and u D (t) is a discontinuous function calculated by checking the condition of the attractiveness.
To reduce chattering from the results of the response issued by the SMC, the Kalman Filter is offered as an enhancement mechanism for chattering handling and suppression.

Kalman Filter
Kalman Filter estimates a process using a form of iterative feedback control. The equation on the Kalman Filter is divided into two stages, namely, the time update equation and the measurement update equation [23]. Kalman Filter equation for the prediction stages are presented in Eqns. (34) -(39).
where, xk is a vector prediction, Pk is the predictive covariance matrix and K k is kalman gain. Next predictions are updated with measurements z k :xk Then the error covariance is updated: The state variable that has been updated will be used for predictions on the next condition. The process of these stages will be carried out repeatedly as much as the required time discretization.

Testing and Result
In this section, SMC -Kalman Filter is proposed to control the Quadrotor's altitude and attitude implemented and results analysis are carried out.

Testing
The quadcopter mathematical model along with the SMC and Kalman controls that have been designed, is then tested on the quadcopter with the following parameters: The SMC-Kalam Filter control system mathematical model will be simulated using a mini quadcopter based on the parameters of Table 1, showing the results of the positional response resulting from the use of SMC and SMC-Kalman Filter (Figure 2).
After the simulation is carried out, the control system will be applied to the mini quadcopter. From testing on the quadcopter, it can be seen that there is a reduction in chattering caused by the data received from the sensor being processed first through the Kalman Filter.

Result
The mathematical model of the quadcopter and the SMC -Kalman Filter control system that has been designed, is simulated. The response results are obtained from the output signal that has been received by the quadcopter and has been processed by the SMC control -Kalman Filter. The following is the output of the quadcopter position in the x, y and z positions. The output response results obtained by using the mathematical model in Eqns. (32)-(33) can control the position of the quadcopter. The resulting graph in Figure 3 was obtained from the quadcopter during the take-off to landing state. The x and y positions are obtained from 0 meter to 1 meter, namely when the quadcopter takes off until it stabilizes in a hovering position. The quadcopter altitude input control resulting from Eq. (28) is shown in Figure 4.
The resulting control on U 1 in Figure 4 shows a difference in the delay generated with the SMC-Kalman Filter which is greater, this is because it takes time for the Kalman Filter to predict updates. In addition, the gain value used from the SMC control is very influential in the control system performance. However, the results measured in Figure 5 produce more stable results on the SMC-Kalman Filter control system, chattering can be reduced with graphic results which are shown to be smoother and more stable.      The attitude control produced by U 2 , U 3 , U 4 shows that there is a large chattering at the beginning of the input response resulting from the SMC algorithm. In SMC, sliding surfaces often experience chattering caused by uncertainty or noise in the system. In Figure 6, the results of the input control produced by the roll become smoother and chattering can be alleviated, so that the results shown in Figure 7 become more stable even though there is still noise, which causes the response to not reach a steady state. Likewise, the input controls shown in Figure 8 and Figure 9 on pitch and yaw, the SMC-Kalman Filter control system produces smoother input control even though there is a delay caused by the gain of the SMC and the noise obtained from the system. However, the results measured on pitch and yaw in Figure 10 and Figure 11 are clearly more stable and the chattering caused by the SMC can be reduced with the Kalman Filter. The input control generated by the SMC-Kalman Filter is still unstable from the start of the response, but this occurs because the dynamic system on a very complex quadcopter can affect the performance of the system response. In SMC, chattering occurs due to uncertainty and disturbance in the system, which makes the sliding surface vibrate or vibrate around the set point. Chattering on the SMC can cause several problems, such as increasing wear on the mechanical components of the control system and worsening the quality of the control signal. It is clear from the results above that poor signal quality occurs in the first 2 to 4 seconds. The response generated from the mathematical model of the SMC-Kalman Filter control system is faster to produce a steady state on the quadcopter. Previous research using the SMC-Neural Network [19] method has succeeded in controlling the height and attitude of the quadcopter, however, the response of the quadcopter to reach a steady state takes about 5 to 10 seconds.
The results of the control response using the SMC-Kalman Filter show that chattering events have decreased. This is due to the signal received by the sensor. In practice, the value of each noise v k , w k at each stage is unknown. This noise come from a variety of sources, such as vibrations or disturbances in the sensor, vibrations in the model system, or environmental factors that affect measurements. The independent noise assumption also makes it possible to take into account the effect of noise on each observation or measurement separately, so that estimates can be made more accurately. This is evidenced by the simulation results of Figure 2, the SMC -Kalman Filter is able to produce the desired trajectory. This is important in system control, where errors in measurements or estimates can impact overall system performance. In practice, the noise covariance matrix may change with each measurement, but in this case the noise is assumed to be constant. From the prediction stage, the data from the initial measurements will be used to predict the state variables. Furthermore, the state variables obtained previously will be updated or repaired. The following is the result of chattering reducing as seen from the capture of the signal obtained by the quadcopter sensor and processed using the SMC-Kalman Filter.

Figure 12. Chattering reduction
It can be seen that the results of the chattering reducing on the signal captured by the sensor without going through the Kalman Filter are shown in blue, resulting in very serious chatter. After adding system control using the Kalman Filter algorithm, the resulting signal can be reduced. Graphical display of Figure 12 shows that the results of the real response shown in the height control and attitude above are not so clear. This is because the data obtained by the sensor is very large. In order to see the results of reducing chatter more clearly, some data is used as a sample, so that the response results are obtained in Figure 10.

Conclusions
In this paper, a mathematical model has been proposed for the altitude and attitude control system on a quadcopter. First, a quadcopter mathematical model is prepared to obtain a dynamic modeling of the quadcopter system. Second, a mathematical model of the control system that will be used is designed. The SMC control mathematical model is used through combining with the Kalman Filter algorithm. The mathematical model for altitude and attitude control (U 1 , U 2 , U 3 , U 4 , U x , U y ) is implemented by applying a quadcopter dynamic system. The resulting SMC-Kalman Filter control system mathematical model is simulated in response to the quadcopter position. The response results on the height controller for the resulting attitude take 2 to 4 seconds to be in a steady state. The SMC-Kalman Filter control system is also proven to be able to reduce chattering caused by noise from the signal and caused by SMC. In the future work on a mathematical model of the SMC-Kalman Filter system needs to be done to control the navigation system on the quadcopter. The combination of the SMC-Kalman Filter control system allows for a deeper analysis to perform state estimation with other types of Kalman filters.

Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.