

In order to enhance the control stability and anti-interference ability of quadcopter, this paper presents a quadcopter based on double-layer PID control, and designs a quadcopter with STM32 as the main controller, and simulates and verifies its control system attitude. Firstly, the nonlinear attitude mathematical model of the aircraft is established by the four-element method, and the relationship between the attitude angle and the angular velocity of the aircraft is obtained by solving, so that the measurement data of multi-attitude sensors of the four-axis aircraft can be better fused. Then, according to the deviation between the target attitude and the current attitude of the aircraft, a double-layer PID control method is proposed based on the traditional PID controller. The outer loop controls the angle of the aircraft and the inner loop controls its angular velocity to improve the adaptability and accuracy of the aircraft. At last, the attitude of quadcopter with two controllers is simulated and compared by Matlab simulation software. The simulation results show that the quadcopter with PID control has a slow response time, and the attitude stabilization time is 2.7s, while the quadcopter with double PID control has a fast response time, and the attitude stabilization time is 0.4 s, which has good control stability and strong anti-interference ability, and improves the adaptive ability and robustness of aircraft control.