m Simulink simulation of quadrotor UAV flight control based on PID control algorithm

Table of contents

1. Algorithm description

2. Simulation effect preview

3. MATLAB core program

4. Complete MATLAB


1. Algorithm description

  The UAV uses a common quadrotor unmanned aerial vehicle, as shown in Figure 1.

      PID controller, that is, the control method of the controller is composed of three parts : P proportional adjustment, I integral adjustment and D differential adjustment. PID controller is the most widely used control method so far. The PID controller has the advantages of simple structure, stable performance, and simple parameter setting. The PID controller is suitable for situations where various control objects cannot be measured to obtain system parameters. It performs real-time adjustment according to the output of the control object and the input difference of the reference control variable to achieve effective control of the unknown parameter control object. The PID controller is composed of three parts: proportional adjustment module, integral adjustment module and differential adjustment module, then the relationship between the input error signal e(t) and output u(t) is formula 6 :

 

       In formula 4.15 , the parameter kp represents the coefficient of the proportional adjustment module, and its function is to adjust the feedback error e(t) of the system according to the parameter  kp, so that the feedback error of the adjusted control object is reduced. When the proportional coefficient kp​​​​​​​​​takes a larger value, the adjustment speed of the controller is faster, but its jitter is also larger, which leads to system instability. When the proportional coefficient kp takes a small value, the controller adjusts the speed slowly, but the adjustment process is relatively stable.

       The parameter ki represents the coefficient of the integral adjustment module, and its function will eliminate the steady state error existing in the system. When there is a steady state error, it will be adjusted through the integral adjustment module until the steady state is completely eliminated error, and then the integral adjustment function stops working, and the integral adjustment module outputs a fixed value. When the integral modulation coefficient ki​​​​​​​​is small, the integral adjustment effect is stronger, otherwise, the integral adjustment effect is weaker, and the system adjustment speed is slower.

      The parameter kd represents the coefficient of the differential adjustment module, which mainly adjusts the rate of change of the system feedback error. It has an advanced adjustment function and can predict the rate of change of the system feedback error, so the error can be eliminated before the feedback error occurs , so by setting the differential adjustment parameters, the overshoot of the PID controller can be reduced and the adjustment speed of the system can be accelerated.

2. Simulation effect preview

The matlab2022a simulation results are as follows:

    The UAV attitude control system is modeled. The whole system mainly includes three core modules, the UAV space position control module, the UAV attitude control module and the UAV dynamics module. The simulated UAV simulation parameters are as follows:

parameter

unit

value

mass m

Kg

0.468

Half wheelbase l

m

0.225

Drag coefficient kd

N*m/rpm^2

1.5*10^-9

lift coefficient kt

N/rpm

6.11*10^-8

X-axis moment of inertia Ix

Kg*m^2

0.004856

Y-axis moment of inertia Iy

Kg*m^2

0.004856

Z-axis moment of inertia Iz

Kg*m^2

0.008801

 

 

 

 

3. MATLAB core program

        The UAV model mainly includes five parts: target input module, position control module, attitude control module, attitude conversion module and dynamics module. Among them, the core module of the UAV is modeled by 6DOF (Euler Angles). The 6DOF (Euler Angles) module fully considers the object's fixed coordinate system (Xb, Yb, Zb) relative to the earth reference system (Xe, Ye, Ze) rotation factor. The origin of the UAV's fixed coordinate system is the UAV's center of gravity, and the UAV is assumed to be rigid, an assumption that eliminates the need to consider forces between individual mass elements. A flat-Earth reference frame is considered an inertial frame and ignores the forces due to the Earth's orbital motion relative to the Sun. The model is mainly inputted with the initial Roll, Pitch, Yaw, initial p, q, r, and the moments of inertia I x, I y, and I z of the XYZ axes. Among them, the initial values ​​of Roll, Pitch, Yaw, p, q and r are all set to zero, and the moments of inertia I x, I y, and I z are set according to the parameters in Table 1.

....................................................................
m       = 0.468;
g       = 9.8;
Ixx     = 0.004856;
Iyy     = 0.004856;
Izz     = 0.008801;
L       = 0.225;
kd      = 1.5*10^-9;
kt      = 6.11*10^-8;
 
%姿态角和位置的六个PID控制器未训练的参数
%PID x
kpx     = 0.8;
kix     = 1e-4;
kdx     = 1.3;
%PID y
kpy     = 0.8;
kiy     = 3e-4;
kdy     = 1.3;
%PID z
kpz     = 1.2;
kiz     = 1e-6;
kdz     = 2;
%PID phi
kpphi   = 2000;
kiphi   = 0;
kdphi   = 4000;
%PID theta
kptheta = 2000;
kitheta = 0;
kdtheta = 4000;
%PID psi
kppsi   = 800;
kipsi   = 0;
kdpsi   = 400;
05_065_m

4. Complete MATLAB

V

Guess you like

Origin blog.csdn.net/hlayumi1234567/article/details/128678545