# 控制器图解

## 多旋翼位置控制器

• Estimates come from EKF2.
• 这是一个标准的位置-速度级联控制回路。
• 在某些模式，外环(位置回路) 可能会被绕过 (图中在外环之后增加一个多路开关来表示)。 只有在位置保持模式或某轴无速度请求时，位置回路才会发挥作用。
• 内环（加速度）控制器使用箝位法对积分器做了抗饱和处理（ARW）。

## 固定翼位置控制器

### 总能量控制系统

#### Total energy balance control loop

The total energy of an aircraft is the sum of kinetic and potential energy:

,

Taking the derivative with respect to time leads to the total energy rate:

.

From this, the specific energy rate can be formed as:

where is the flight plan angle. For small we can approximate this as

.

From the dynamic equations of an aircraft we get the following relation:

,

where T and D are the thrust and drag forces. In level flight, initial thrust is trimmed against the drag and a change in thrust results thus in:

.

As can be seen, is proportional to , and thus the thrust setpoint should be used for total energy control.

Elevator control on the other hand is energy conservative, and is thus used for exchanging potentional energy for kinetic energy and vice versa. To this end, a specific energy balance rate is defined as

.

## Fixed-Wing Attitude Controller

The attitude controller works using a cascaded loop method. The outer loop computes the error between the attitude setpoint and the estimated attitude that, multiplied by a gain (P controller), generates a rate setpoint. The inner loop then computes the error in rates and uses a PI (proportional + integral) controller to generate the desired angular acceleration.

The angular position of the control effectors (ailerons, elevators, rudders, ...) is then computed using this desired angular acceleration and a priori knowledge of the system through control allocation (also known as mixing). Furthermore, since the control surfaces are more effective at high speed and less effective at low speed, the controller - tuned for cruise speed - is scaled using the airspeed measurements (if such a sensor is used).

If no airspeed sensor is used then gain scheduling for the FW attitude controller is disabled (it's open loop); no correction is/can be made in TECS using airspeed feedback.

The feedforward gain is used to compensate for aerodynamic damping. Basically, the two main components of body-axis moments on an aircraft are produced by the control surfaces (ailerons, elevators, rudders, - producing the motion) and the aerodynamic damping (proportional to the body rates - counteracting the motion). In order to keep a constant rate, this damping can be compensated using feedforward in the rate loop.

The roll and pitch controllers have the same structure and the longitudinal and lateral dynamics are assumed to be uncoupled enough to work independently. The yaw controller, however, generates its yaw rate setpoint using the turn coordination constraint in order to minimize lateral acceleration, generated when the aircraft is slipping. The yaw rate controller also helps to counteract adverse yaw effects (https://youtu.be/sNV_SDDxuWk) and to damp the Dutch roll mode by providing extra directional damping.

## VTOL 飞行控制器

VTOL姿态模块的输出是多旋翼执行器（典型的 actuator_controls_0）和固定翼（典型的 actuator_controls_1）执行器的独立的扭矩和力指令。 这些是在一个特定机型的混控器文件中处理的（参见 Mixing）。

For more information on the tuning of the transition logic inside the VTOL block, see VTOL Configuration.

,

,

,

.

.

,

,

.

.

.

.

.

,

,