Control method of four-axis unmanned aerial vehicle
Technical Field
The invention relates to the technical field of unmanned aerial vehicle control, in particular to a control method of a four-axis unmanned aerial vehicle.
Background
An Unmanned Aerial Vehicle (UAV), also called an Unmanned Aerial Vehicle for short, is an Unmanned Aerial Vehicle that is controlled by a radio remote control and an onboard program controller, unlike a conventional manned aircraft. It appeared in the 20 th century for the first time, and was only used as a target in military training, and gradually turned to various multipurpose fields such as detection and attack after the development of the last hundred years. Compared with a manned airplane, the unmanned airplane has the advantages of low cost, strong viability, no casualty risk, convenient use and the like, so that the unmanned airplane can play an important role in military affairs and has wide application prospect in the civil field.
Classify according to unmanned aerial vehicle's overall structure, can divide unmanned aerial vehicle into these three kinds of mainstream structures of fixed wing unmanned aerial vehicle, helicopter unmanned aerial vehicle and many rotor unmanned aerial vehicle, in addition, there are less numerous unmanned aerial vehicle structures such as umbrella wing unmanned aerial vehicle, flapping wing unmanned aerial vehicle and unmanned airship, but practical application is less. Wherein many rotor unmanned aerial vehicle possess 4 or more rotors and provide power, compare fixed wing unmanned aerial vehicle, can realize nimble maneuver such as in-situ VTOL and hover in the air, and mechanical structure is simpler again than helicopter unmanned aerial vehicle, and the price is cheaper, and environmental adaptation ability is stronger, can be used to part for military use and most civilian, consumption field, and development prospect receives the most attention. Among the multi-rotor drones, the simplest and most common is a quad-rotor drone (Quadrotor UAV), also known as a quad-rotor drone, whose flight power is provided by driving a propeller by four rotor-type flight engines, respectively, and stable flight can be achieved by adjusting the engine speed to change the lift and torque generated by the rotation of the four rotors.
According to the classification of unmanned aerial vehicle size, most four-axis unmanned aerial vehicles on the market at present basically belong to microminiature unmanned aerial vehicle's category, and microminiature four-axis unmanned aerial vehicle comprises frame, motor, screw, battery, remote controller, motor drive ware and flight control panel. Because microminiature four-axis unmanned aerial vehicle has flight gesture flexibility, mobility is strong, mechanical structure is comparatively simple, easy to detach maintains, characteristics such as sexual valence are higher for it has comparatively extensive platform adaptability, can be applied to low-altitude military reconnaissance, power line and patrol and examine, mountain and forest disaster condition search and rescue, amusement movie & TV are taken photo by plane multiple different fields.
However, the microminiature four-axis unmanned aerial vehicle has smaller size, lighter weight and lower flying speed, so that an aerodynamic model is difficult to accurately establish, and in addition, the load and the inertia of the microminiature four-axis unmanned aerial vehicle are both smaller, and the microminiature four-axis unmanned aerial vehicle is very easy to be influenced by airflow during low-speed flying, so that the microminiature four-axis unmanned aerial vehicle has higher requirements on the control precision and the flexibility of a flying controller.
Therefore, in order to solve the above technical problem, it is necessary to provide a control method for a four-axis drone.
Disclosure of Invention
In view of this, the present invention provides a control method for a four-axis drone.
In order to achieve the above purpose, the technical solutions provided by the embodiments of the present invention are as follows:
a control method of a four-axis unmanned aerial vehicle, the control method comprising:
s1, acquiring attitude data of an attitude sensor in the four-axis unmanned aerial vehicle, and performing filtering fusion to obtain current attitude information, wherein the attitude data comprises a current attitude angle and an angular velocity corresponding to the attitude angle;
and S2, controlling the four-axis unmanned aerial vehicle by a cascade double-ring PID control method, taking the deviation value of the current attitude information and the target attitude information as the input quantity of the angle PID controller, inputting the angular velocity PID controller according to the difference value of the current angular velocity and the output quantity of the angle PID controller, and outputting a control motor by the angular velocity PID controller until the four-axis unmanned aerial vehicle reaches the target attitude.
As a further improvement of the invention, the attitude angle comprises a pitch angle, a roll angle and a course angle.
As a further improvement of the present invention, the attitude information in step S1 is represented by one of euler angles, quaternions, matrices, and axial angles.
As a further improvement of the present invention, the attitude information calculation formula in step S1 is:
wherein,respectively are attitude angles of the current four-axis unmanned aerial vehicle,theta, psi being Euler angles, omega, obtained in the last resolving periodx、ωy、ωzIs the three-axis angular velocity of the four-axis unmanned plane.
As a further improvement of the present invention, the attitude information calculation formula in step S1 is:
wherein,respectively the attitude angle, q, of the current four-axis unmanned aerial vehicle0、q1、q2、q3Quaternions derived for the previous resolution cycle.
As a further improvement of the present invention, the filtering in step S1 is fused as follows:
and performing filter fusion of the attitude data through a Mahony complementary filter algorithm.
As a further improvement of the present invention, the step S1 specifically includes:
1) calculating the initial attitude of the body in the Euler angle form through the data measured by the accelerometer and the magnetometer, and initializing the quaternion;
2) obtaining current gravity acceleration components ax, ay and az, angular velocity components gx, gy and gz and magnetic field strength components mx, my and mz of the body through an accelerometer, a gyroscope and a magnetometer, and normalizing the gravity acceleration components and the magnetic field strength components to obtain a unit value;
3) calculating the estimated values of the gravity acceleration component and the magnetic field intensity component under the current body coordinate system by using the quaternion obtained in the previous resolving period according to the relationship between the quaternion and the Euler angle;
4) vector cross multiplication is carried out on the measured values of the gravity vector and the earth magnetic field and an estimated value calculated by utilizing the last attitude calculation result to obtain an error between the measured values and the earth magnetic field, and the error is accumulated;
5) correcting drift errors of the gyroscope in a PI (proportional-integral) adjustment mode by using accumulated errors obtained by vector cross multiplication;
6) and finally, solving a differential equation set of the quaternion, updating the quaternion and unitizing the quaternion.
As a further improvement of the present invention, the PID control method in step S2 specifically includes:
and calculating the proportion P, the integral I and the differential D of the error between the current attitude information and the target attitude information, and superposing and outputting the proportions.
As a further improvement of the present invention, the output of the PID control method in the step S2Wherein:
output P of proportional controlout=Kpe(t),KpIs a parameter of proportional control, e is an input error signal;
output of integral controlKiIs a parameter of proportional control, e is an input error signal;
output of differential controlKdFor the parameter of the proportional control, e is the input error signal.
The invention has the beneficial effects that:
resolving the surrounding unmanned aerial vehicle attitude can be realized only by acquiring the three-axis angular velocity of the body, and meanwhile, the measurement data is subjected to auxiliary correction through filtering fusion, so that more accurate measurement data can be obtained, and the accuracy of the attitude data is improved;
by using cascade dual-ring PID control, the anti-interference performance of the system is enhanced, so that the four-axis unmanned aerial vehicle has stronger adaptability.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a control method of a four-axis unmanned aerial vehicle according to the present invention;
FIG. 2 is a power model diagram of a four-axis unmanned aerial vehicle according to the present invention;
FIG. 3 is a schematic view of a four-axis unmanned aerial vehicle flight motion mode according to the present invention;
FIG. 4 is a schematic diagram of a geographic coordinate system of the present invention;
FIG. 5 is a schematic diagram illustrating Euler angles of Pitch, Roll, and Yaw in accordance with an embodiment of the present invention;
FIG. 6 is a schematic flow chart of prior art angular single loop PID control;
fig. 7 is a schematic flow chart of cascade dual-loop PID control according to an embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, the invention discloses a control method of a four-axis unmanned aerial vehicle, comprising the following steps:
s1, acquiring attitude data of an attitude sensor in the four-axis unmanned aerial vehicle, and performing filtering fusion to obtain current attitude information, wherein the attitude data comprises a current attitude angle and an angular velocity corresponding to the attitude angle;
and S2, controlling the four-axis unmanned aerial vehicle by a cascade double-ring PID control method, taking the deviation value of the current attitude information and the target attitude information as the input quantity of the angle PID controller, inputting the angular velocity PID controller according to the difference value of the current angular velocity and the output quantity of the angle PID controller, and outputting a control motor by the angular velocity PID controller until the four-axis unmanned aerial vehicle reaches the target attitude.
The present invention will be further described with reference to the following embodiments.
The 'four-axis' in the microminiature four-axis unmanned aerial vehicle means that the power of the aircraft is provided by four rotor wing type flight engines driving propellers, and the power model of the aircraft is shown in figure 2. The four rotors are divided into two groups, respectively located at the cantilever ends of the cross-symmetric airframe, and two rotors located at opposite corners are used as one group. The rotary directions of the rotors in the same group are the same, and the rotary directions of the rotors in different groups are opposite. Under the condition of the same rotating speed, due to the symmetry of the structure, the torques generated by the rotation of the four rotors can be mutually offset, so that the fuselage can be kept stable on a horizontal plane.
The adjustment of the flight attitude of the four-axis unmanned aerial vehicle can be realized by adjusting the rotating speeds of the four rotors, so that the four-axis unmanned aerial vehicle can complete basic movements such as pitching, rolling, yawing, lifting and the like. The four basic movement modes are shown in fig. 3, the four-axis drone in fig. 3 works in a "+" mode, the head of the drone faces the positive direction of the X axis, the motors 1 and 3 are in one group and rotate in the counterclockwise direction, the motors 2 and 4 are in one group and rotate in the clockwise direction, the upward arrow indicates the increase of the rotation speed, and the downward arrow indicates the decrease of the rotation speed. The flying motion mode comprises the following steps:
1) pitching motion: the movement mode is as shown in fig. 3a, the rotation speeds of motors No. 2 and 4 are kept unchanged, the rotation speeds of motors No. 1 and 3 are changed, and the trend of the change of the rotation speeds is opposite, so that the four-axis unmanned aerial vehicle can rotate around the Y axis by a certain angle to perform pitching motion, and the angle of rotation around the Y axis is also called a Pitch angle (Pitch); the front and back lifting forces of the unmanned aerial vehicle body are inconsistent due to different rotating speeds of the motors No. 1 and No. 3, so that the unmanned aerial vehicle body moves back and forth in the X-axis direction of the horizontal plane, and the forward and backward movement of the four-axis unmanned aerial vehicle is realized;
2) and (3) rolling movement: the movement mode is as shown in fig. 3b, opposite to the pitching movement, the rotation speed of the motors 1 and 3 is kept unchanged, the rotation speed of the motors 2 and 4 is changed, and the trend of the change of the rotation speed is opposite, so that the four-axis unmanned aerial vehicle rotates around the X axis by a certain angle to perform a rolling movement, and the angle of the rotation around the X axis is also called a rolling angle (Roll); 2. the difference of left and right lifting forces of the unmanned aerial vehicle body is caused by the difference of the rotating speeds of the No. 4 motor, so that the unmanned aerial vehicle body moves left and right in the Y-axis direction of the horizontal plane, and the left movement and the right movement of the four-axis unmanned aerial vehicle are realized;
3) yaw movement: the motion mode is as shown in fig. 3c, keeps the rotational speed of diagonal motors consistent, changes the rotational speed of two sets of diagonal motors with opposite trend respectively, can make four-axis unmanned aerial vehicle rotate certain angle around the Z axle, accomplishes the yaw motion, and then changes the orientation of aircraft nose. The angle of rotation about the Z axis is also known as Yaw angle (Yaw);
4) lifting movement: the motion mode is as shown in fig. 3d, it makes four-axis unmanned aerial vehicle can keep steady to keep four motor rotational speeds the same, then promotes or reduces their rotational speed simultaneously, just can realize the displacement of four-axis unmanned aerial vehicle in the Z axle direction, lifting motion promptly.
The analysis on the flying principle of the micro-miniature four-axis unmanned aerial vehicle shows that the control on the flying motion mode of the micro-miniature four-axis unmanned aerial vehicle not only controls the flying attitude, namely three attitude angles of a Pitch angle Pitch, a Roll angle Roll and a Yaw angle Yaw, but also finally converts the control into the control on the rotating speed of a corresponding motor. In order to quantitatively realize such a control mode, a closed-loop control mode of 'observation- > control- > re-observation- > re-control' circulation is generally adopted, that is, the current attitude angle of the machine body is continuously observed and calculated through a sensor device, then a certain control algorithm is used, the rotating speed of the motor is controlled to make the machine body change towards the target attitude, and the process is continuously repeated until the machine body reaches the target attitude.
In the above control mode, the step of "observation" is also called attitude resolution, and is responsible for fusing data of attitude sensors such as accelerometers, gyroscopes and magnetometers and outputting current attitude information; the control part adopts a PID control algorithm and is responsible for converting the target attitude into the control of the rotating speed of the motor. The present embodiment will be specifically described below in terms of both the attitude calculation method and the PID control method.
First, attitude solution
The flight attitude of a four-axis drone describes in practice the angular relationship between the coordinate system in which the airframe is located and the geographic coordinate system. The geographic coordinate system is established with the earth as a reference, and the true east, true north and true up directions are used as X, Y and Z axes of the coordinate system, which is shown in FIG. 4. The body coordinate system is shown in fig. 2, the geometric center of the body is used as the origin, the axis perpendicular to the plane of the four motors is used as the Z axis, the X, Y axes are located on the plane of the motors and are perpendicular to each other, and the specific direction is determined by the flight mode used. Under low altitude and near ground conditions, it is considered that both the gravity acceleration vector and the geomagnetic vector in the geographic coordinate system are fixed, and the posture of the body can be determined by using this feature, using sensors such as an accelerometer and a magnetometer.
The relation between the body coordinate system and the geographic coordinate system can be expressed by euler angles, quaternions, matrixes, shaft angles and the like, wherein the euler angle expression and quaternion expression are most commonly used.
1) Euler angle representation
The euler angles are used to describe the orientation of one coordinate system relative to another in three-dimensional euler space. Here we use the fixed geographic coordinate system as the reference coordinate system, and any orientation of the coordinate system of the body in the same space can be obtained by using the reference coordinate system to make three rotations around some coordinate axis of the reference coordinate system in a certain order, and the angle of each rotation is called euler angle.
The representation of the Euler angles is different according to the rotation sequence and the selection of the rotation axis, and the representation of Tait-Bryan angle is adopted to obtain the Euler angles as shown in FIG. 5Theta, psi. The geographic coordinate system referenced by O-xyz in FIG. 5 is first rotated by an angle ψ about the z-axis to obtain O-x 'y' z ', then rotated by an angle θ about the y' axis to obtain O-x "y" z ", and finally rotated about the x" axisAngle to obtain O-XYZ body coordinate system with Euler angleAnd theta and psi respectively correspond to Pitch, Roll and Yaw.
Using the Euler angles obtained from the last solution cycle when using the Euler angles to represent attitudeTheta, psi, plus the triaxial angular velocity omega in the body coordinate system measured by the gyroscopex、ωy、ωzThe current new attitude angle can be obtained through Euler angle kinematics differential equationThe formula is as follows:
through the method, the values of Pitch, Roll and Yaw can be directly solved, the values are relatively easy to understand, but when theta reaches 90 degrees, the problem of gimbal deadlock called GimbalLock is generated, and the full-attitude solution cannot be realized.
2) Quaternion representation
Quaternions are understood to be hypercomplexes consisting of a real number and a three-dimensional vector, which are expressed as follows:
a unit quaternion can be conveniently used to represent a rotation in three-dimensional space, where the vector part is used to represent the axis of rotation and the real part is used to represent the angle of rotation about the axis of rotation.
When the posture is expressed by using the quaternion, it is necessary to add the quaternion to the body first when the body is stationaryCalculating Euler angle of body at the moment by data measured by speedometer and magnetometerθ0、ψ0Then, the initial quaternion q is obtained by the following formula0’、q1’、q2’、q3’:
Then, the differential equation set of the quaternion can be solved through a first-order Picard algorithm, and the posture updating formula of the quaternion is obtained as follows:
in equation 4, the equation left side is the updated quaternion, q on the right side of the equation0、q1、q2、q3Quaternions derived for the previous resolution cycle. Compared with the Euler angle algorithm, the algorithm reduces the calculation of the trigonometric function, improves the attitude calculation speed, does not have the problem of universal joint deadlock in the Euler angle algorithm, and can be used for calculating the full attitude.
Although the attitude of the aircraft is easy to calculate, the quaternion mode is not intuitive enough, so after the attitude is solved, the updated quaternion needs to be converted into an Euler angle and provided for a subsequent attitude control algorithm, and the formula is shown as follows:
as can be seen from formulas 3, 4 and 5, under the condition of knowing the initial attitude of the body, the body attitude can be resolved theoretically only by the three-axis angular velocity of the body acquired by the gyroscope. However, due to the existence of error noise and the like, the data measured by the gyroscope can only keep relative accuracy in a short time, and especially after the gyroscope is operated for a period of time, the accumulation of the integral error can cause the obtained attitude to be far from the actual attitude, so that a large drift is generated, and other sensors are necessary to perform auxiliary correction on the measured data of the gyroscope. This process of combining different sensor measurements to obtain more accurate measurements is called filtering fusion of sensor data.
Common filtering fusion algorithms in the four-axis unmanned aerial vehicle include a complementary filtering algorithm, a Kalman filtering algorithm and the like. The complementary filtering algorithm is based on the idea that more accurate output data is obtained by utilizing complementary characteristics of different sensor output data on a frequency domain and adopting ways such as weighted fusion and the like; the kalman filtering algorithm is an algorithm for performing optimal estimation on a system state by inputting and outputting observation data through a system using a linear system state equation, and the optimal estimation can also be regarded as a filtering process because the observation data includes the influence of noise and interference in the system.
Kalman filtering is better than complementary filtering in response speed, but the Kalman filtering has higher requirement on the accuracy of target modeling, is relatively complex to realize and has relatively large calculated amount; the calculation amount of complementary filtering is relatively small, the implementation difficulty is low, the difference between the overall filtering effect and Kalman filtering is not very large, and the attitude calculation for the four-axis unmanned aerial vehicle is enough.
In the present embodiment, an algorithm called Mahony complementary filtering is used to perform the filtering fusion of the attitude sensor data. The algorithm is based on the idea of complementary filtering, the drift of the gyroscope is corrected by using acceleration data which has more high-frequency noise, more stable low-frequency long-term signals and no long-term drift, and magnetometer data are added to correct the Yaw angle Yaw aiming at the characteristic that the accelerometer cannot measure the rotation motion on the gravity axis.
In the embodiment, quaternion is adopted to solve the attitude, a Mahony complementary filtering algorithm is used to filter the attitude data, and a quaternion-based complementary filtering attitude calculation algorithm is mutually combined, and the execution flow is as follows:
1) when the algorithm is executed for the first time, the initial attitude (euler angle form) of the body is calculated from the data measured by the accelerometer and the magnetometer, and the quaternion is initialized by equation 3.
2) Obtaining the current gravity acceleration component a of the body through an accelerometer, a gyroscope and a magnetometerx、ay、azComponent of angular velocity gx、gy、gzAnd a magnetic field strength component mx、my、mz. And the gravitational acceleration component and the magnetic field strength component are normalized (each component is divided by the modulus of the vector) to obtain their unit values.
3) Through the relation between quaternion and Euler angle, the quaternion (obtained by integrating the gyroscope) obtained in the last resolving period is used for calculating the estimated values of the gravity acceleration component and the magnetic field strength component in the current body coordinate system, and the related algorithm is as follows:
hx=2.0f*(mx*(0.5f-q2q2-q3q3)+my*(q1q2-q0q3)+mz*(q1q3+q0q2));
hy=2.0f*(mx*(q1q2+q0q3)+my*(0.5f-q1q1-q3q3)+mz*(q2q3-q0q1));
hz=2.0f*mx*(q1q3-q0q2)+2.0f*my*(q2q3+q0q1)+2.0f*mz*(0.5f-q1q1-q2q2);
bx=sqrt(hx*hx+hy*hy);
bz=hz;
v/estimated magnetic field orientation Using last attitude solution
halfwx=bx*(0.5f-q2q2-q3q3)+bz*(q1q3-q0q2);
halfwy=bx*(q1q2-q0q3)+bz*(q0q1+q2q3);
halfwz=bx*(q0q2+q1q3)+bz*(0.5f-q1q1-q2q2);
Estimating gravity field direction using last attitude solution
halfvx=q1q3-q0q2;
halfvy=q0q1+q2q3;
halfvz=q0q0-0.5f+q3q3;
4) And carrying out vector cross multiplication on the measured values of the gravity vector and the earth magnetic field and an estimated value obtained by using the last attitude calculation result to obtain an error between the measured values and the estimated value, and accumulating the error, wherein a correlation algorithm is as follows:
v/calculating and accumulating the error between the estimated and the measured direction of the magnetic field
halfex+=(my*halfwz-mz*halfwy);
halfey+=(mz*halfwx-mx*halfwz);
halfez+=(mx*halfwy-my*halfwx);
halfvz=q0q0-0.5f+q3q3;
V/calculating and accumulating errors between the gravity estimated direction and the measured direction
halfex+=ay*halfvz-az*halfvy;
halfey+=az*halfvx-ax*halfvz;
halfez+=ax*halfvy-ay*halfvx;
5) The drift error of the gyroscope is corrected by using the accumulated error obtained by vector cross multiplication in a PI regulation mode, and a related algorithm is as follows, wherein two parameters Kp and Ki are used for controlling the correction speed of the accelerometer and the magnetometer on the integral attitude of the gyroscope.
// error integral
gyro_bias[0]+=twoKi*halfex*dt;
gyro_bias[1]+=twoKi*halfey*dt;
gyro_bias[2]+=twoKi*halfez*dt;
// drift correction
gx+=(twoKp*halfex+gyro_bias[0]);
gy+=(twoKp*halfey+gyro_bias[1]);
gz+=(twoKp*halfez+gyro_bias[2]);
6) And finally, solving a differential equation set of the quaternion by using the formula 4, updating the quaternion, unitizing the quaternion so as to facilitate the calculation of the next resolving period, wherein a related algorithm is as follows:
dq0=0.5f*(-q1*gx-q2*gy-q3*gz);
dq1=0.5f*(q0*gx+q2*gz-q3*gy);
dq2=0.5f*(q0*gy-q1*gz+q3*gx);
dq3=0.5f*(q0*gz+q1*gy-q2*gx);
q0+=dt*dq0;
q1+=dt*dq1;
q2+=dt*dq2;
q3+=dt*dq3;
v/unitizing quaternions
recipNorm=invSqrt(q0*q0+q1*q1+q2*q2+q3*q3);
q0*=recipNorm;
q1*=recipNorm;
q2*=recipNorm;
q3*=recipNorm;
Therefore, resolving of the four-axis unmanned aerial vehicle attitude is completed, and the current attitude of the body is obtained.
Second, PID control method
After the current flight attitude of the four-axis unmanned aerial vehicle is obtained, the rotating speed of the corresponding motor needs to be controlled in a certain control mode, so that the four-axis unmanned aerial vehicle reaches the target attitude. Some Control methods proposed so far include PID Control (Proportional-Integral-Derivative Control), BackStepping Control (BackStepping Control), Sliding Mode Control (Sliding Mode Control), and Linear quadratic modulator (Linear quadratic regulator). The PID control method is relatively the most traditional, but because of low requirements on system models, simple coding implementation and strong adaptability of the control method, the PID control method is widely applied to engineering practice. The invention adopts a cascade double-ring PID algorithm to realize the control of the attitude angle of the four-axis unmanned aerial vehicle.
The PID control algorithm is the most common and widely applied negative feedback automatic control algorithm. The method utilizes the proportion (P, Proport), Integral (I, Integral) and Derivative (D) of the error between the observed value and the target value to carry out corresponding calculation and superposition output, thereby realizing the control of the target. Wherein:
ratio control (P): the proportional control is to control and output the input error signal according to a certain proportion. When only proportional control is available, the system output will have a steady-state error, i.e., the output will deviate from the target value when stable. Output P of proportional controloutAs shown in formula 6, wherein KpFor the parameter of the proportional control, e is the input error signal.
Pout=Kpe (t) (formula 6)
As can be seen from equation 6, the coefficient KpThe larger the value of (a), the larger the proportional control output, the quicker the error is corrected, but the system stability is also reduced.
Integral control (I): the integral control introduces the integral of an error signal to time, and the output of the controller is in a direct proportion relation with the integral term. Since the integral term increases with time, combining it with proportional control to form PI control eliminates steady-state errors in proportional control, but the output suffers some time lag. The integral term output is expressed by equation 7, whereKiFor the parameter of the proportional control, e is the input error signal.
Differential control (D): in differential control, the output of the controller is proportional to the differential of the error signal over time. The differential regulation is to control the change rate of the error, can realize the advanced control of the controlled quantity, increase the damping coefficient of the system and increase the stability of the system. The output equation of the derivative term is shown in equation 8, where Kd is a parameter for proportional control, and e is the input error signal.
P, I, D, the combination of the three regulation modes becomes PID control, and the mathematical expression is as follows:
by adjusting K in PID controllersp、KiAnd KdThe three parameters can realize stable, quick and accurate control on the controlled object.
In the prior art, for a four-axis unmanned aerial vehicle system, after the current three attitude angles of a vehicle body are calculated, the deviation values between the current three attitude angles and a target attitude angle can be used as input quantities, and a corresponding PID controller is designed to realize the control of a pitch angle, a roll angle and a course angle, wherein the control flow is shown in fig. 6.
The angle single-ring PID control algorithm only uses attitude angle information of the four-axis unmanned aerial vehicle, in order to increase the stability and control quality of control, the control on the angular speed of the four-axis unmanned aerial vehicle is further added in the embodiment, and a cascade double-ring PID control algorithm consisting of an angle ring and an angular speed ring is formed.
In this embodiment, the four-axis drone is controlled by a cascade dual-loop PID control method, a deviation value between current attitude information and target attitude information is used as an input quantity of an angle PID controller, the angular velocity PID controller is input according to a difference value between the current angular velocity and an output quantity of the angle PID controller, and the angular velocity PID controller outputs a control motor until the four-axis drone reaches a target attitude.
Specifically, the composition structure of the outer ring angular velocity ring is similar to that shown in fig. 6, except that the control output thereof is no longer directly supplied to the motor for rotation speed adjustment, but is taken as the desired value of the inner ring angular velocity ring; the angular velocity data measured by the gyroscope is matched to obtain the difference value of the two angular velocity data, the difference value is input into an inner ring angular velocity PID controller, the output of the inner ring angular velocity PID controller is used for controlling a motor, and the control flow is shown in figure 7.
According to the technical scheme, the invention has the following beneficial effects:
resolving the surrounding unmanned aerial vehicle attitude can be realized only by acquiring the three-axis angular velocity of the body, and meanwhile, the measurement data is subjected to auxiliary correction through filtering fusion, so that more accurate measurement data can be obtained, and the accuracy of the attitude data is improved;
by using cascade dual-ring PID control, the anti-interference performance of the system is enhanced, so that the four-axis unmanned aerial vehicle has stronger adaptability.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.
Furthermore, it should be understood that although the present description refers to embodiments, not every embodiment may contain only a single embodiment, and such description is for clarity only, and those skilled in the art should integrate the description, and the embodiments may be combined as appropriate to form other embodiments understood by those skilled in the art.