RflySim | Attitude Controller Design Experiment 1

Attitude controller design experiment 1

1. Introduction to attitude control design

This article is based on the premise that the attitude of the multi-rotor, that is, the feedback signal in the controller, can be better estimated, and the feedback signal in the controller is an estimated value. However, for the sake of simplicity and according to the separation principle, we replace the feedback signal with a true value. The purpose of this article is to enable the attitude of the multi-rotor to follow our given desired attitude. The quality of the attitude controller directly determines whether the multi-rotor can fly smoothly. In the time domain, indicators that can reflect the control performance include response time, overshoot, adjustment time and steady-state error; in the frequency domain, it is the stability margin and cut-off frequency. In the basic experiment, the reader can reproduce the simulation of the multi-rotor attitude control; in the analysis experiment, the reader can adjust the PID (Proportional Integral Derivative) parameters of the attitude control to allow the multi-rotor to achieve better control performance in the time domain; in the analysis experiment, the reader can In the design experiment, readers can design the corrector based on the knowledge in automatic control principles to achieve better control performance of the multi-rotor in the frequency domain.

2. Multi-rotor bottom flight control framework

The underlying flight control of a multi-rotor is divided into four levels, namely position control, attitude control, control distribution and motor control.

Position Control:Use the desired bits to solve for the desired roll angle, desired pitch angle, and desired total pull force.

Attitude control:Use the desired attitude angle to calculate the desired moment.

Control distribution:Distribute the desired propeller speed to multiple motors to obtain the desired input force and torque.

Motor control:Use the propeller speed to calculate the desired throttle command for each motor.

picture

The closed-loop control framework is shown in the figure below. The multi-rotor is an underactuated system with 6 outputs (position and attitude) but only 4 independent inputs (total pulling force and three-axis torque). Therefore, the multi-rotor can only track 4 desired commands (desired position and yaw), and the remaining variables (roll, pitch) are determined by the desired position and yaw.

picture

When designing a multi-rotor flight controller, the inner and outer loop control strategy can be used, where the inner loop controls the attitude angle of the multi-rotor aircraft, and the outer loop controls the position of the multi-rotor aircraft. The multi-rotor aircraft's flight modes such as lifting, hovering, and side flight are controlled by the inner and outer loops. Multi-rotor attitude control is the basis of aircraft position control. Common rigid body attitude description methods are Euler angle description method and rotation matrix description method.

picture

This paper designs two attitude tracking controllers for these two different attitude representations. First, for the Euler angle representation, the PID controller is designed under the assumption of small angle. Then, for the rotation matrix representation, an attitude controller based on the attitude error matrix is ​​designed. In practice, the appropriate attitude representation and corresponding attitude controller need to be selected according to specific requirements.

2.1 Attitude control based on Euler angles

picture

picture

2.2 Attitude control based on rotation matrix

picture

3. Control distribution module design

Simply speaking, the control allocation problem can be described as: given uv (t), findδ(t), such that: a>

uv (t) =g(δ(t))

where g is the mapping from the actuator control input to the pseudo control input in the controlled system. It is often assumed that the relationship between the deflection of the control mechanism and the control torque generated is a linear function, then the linear control allocation problem can be obtained

uv (t) =Bδ(t)

 The control distribution of the x-shaped quad-rotor and the control efficiency model of the multi-rotor are as follows:

picture

The MATLAB program for the quadcopter control efficiency model is as follows:

function [M1, M2, M3, M4] = motor_mixer(Roll, Pitch, Yaw, Thrust)

%Function description:

%  Control allocation. The quadrotor type is X-configuration,

%  and the airframe is as follows:

%3↓   1↑

 %  \ /

 %  / \

 %2↑   4↓

%Input:

%  Roll, Pitch, Yaw: attitude controller output.

%  Thrust

idle_PWM = 1000;

scale = 1000;

M1 = (Thrust - Roll + Pitch + Yaw) * scale + idle_PWM;

M2 = (Thrust + Roll - Pitch + Yaw) * scale + idle_PWM;

M3 = (Thrust + Roll + Pitch - Yaw) * scale + idle_PWM;

M4 = (Thrust - Roll - Pitch - Yaw) * scale + idle_PWM;

For details on the above principles, please refer to Chapter 11 of [1].

references:

[1] Translated by Quan Quan, Du Guangxun, Zhao Zhiyao, Dai Xunhua, Ren Jinrui, and Deng Heng. Multi-rotor aircraft design and control [M], Electronic Industry Press, 2018.

[2] Quan Quan, Dai Xunhua, Wang Shuai. Design and control practice of multi-rotor aircraft [M], Electronic Industry Press, 2020.

Guess you like

Origin blog.csdn.net/FEISILAB_2022/article/details/134784335