# 콘트롤러 다이어그램

이 섹션에는 PX4 컨트롤러에 대한 주요 다이어그램들이 있습니다.

다이어그램은 표준 PX4 표기법을 사용합니다(각각 주석이 달린 범례가 있음).

# 멀티콥터 제어 아키텍처

멀티콥터 콘트롤러 다이어그램

  • 이것은 표준 계단식 제어 아키텍처입니다.
  • 컨트롤러는 P 및 PID 컨트롤러를 혼합한 것입니다.
  • 추정치는 EKF2를 사용합니다.
  • 모드에 따라 외부(위치) 루프는 바이패스됩니다(외부 루프 뒤에 멀티플렉서로 표시됨). 위치 루프는 위치를 유지하거나, 축에서 요청한 속도가 null인 경우에만 사용됩니다.

# Multicopter 각속도 컨트롤러

멀티콥터 레이트 콘트롤 다이어그램

  • K-PID 컨트롤러. 자세한 내용은 속도 컨트롤러를 참고하십시오.
  • 통합 권한은 종료를 방지를 위하여 제한됩니다.
  • The outputs are limited (in the control allocation module), usually at -1 and 1.
  • 저역 통과 필터(LPF)는 파생 경로에 사용되어 노이즈를 줄입니다(자이로 드라이버는 컨트롤러에 필터링된 파생물을 제공함).

Note

The IMU pipeline is: gyro data > apply calibration parameters > remove estimated bias > notch filter (IMU_GYRO_NF0_BW and IMU_GYRO_NF0_FRQ) > low-pass filter (IMU_GYRO_CUTOFF) > vehicle_angular_velocity (filtered angular rate used by the P and I controllers) > derivative -> low-pass filter (IMU_DGYRO_CUTOFF) > vehicle_angular_acceleration (filtered angular acceleration used by the D controller)

IMU 파이프라인

# 멀티콥터 자세 컨트롤러

멀티콥터 각도 콘트롤 다이어그램

# Multicopter Acceleration to Thrust and Attitude Setpoint Conversion

  • The acceleration setpoints generated by the velocity controller will be converted to thrust and attitude setpoints.
  • Converted acceleration setpoints will be saturated and prioritized in vertical and horizontal thrust.
  • Thrust saturation is done after computing the corresponding thrust:
    1. Compute required vertical thrust (thrust_z)
    2. Saturate thrust_z with MPC_THR_MAX
    3. Saturate thrust_xy with (MPC_THR_MAX^2 - thrust_z^2)^0.5

Implementation details can be found in PositionControl.cpp and ControlMath.cpp.

# 멀티콥터 속도 컨트롤러

멀티콥터 속도 콘트롤 다이어그램

  • 속도를 안정화하는 PID 컨트롤러. 가속을 명령합니다.
  • 적분기는 클램핑 방식을 사용하는 ARW(Anti-Reset Windup)를 포함합니다.
  • The commanded acceleration is NOT saturated - a saturation will be applied to the converted thrust setpoints in combination with the maximum tilt angle.
  • Horizontal gains set via parameter MPC_XY_VEL_P_ACC, MPC_XY_VEL_I_ACC and MPC_XY_VEL_D_ACC.
  • Vertical gains set via parameter MPC_Z_VEL_P_ACC, MPC_Z_VEL_I_ACC and MPC_Z_VEL_D_ACC.

# 멀티콥터 위치 콘트롤러

멀티콥터 위치  콘트롤 다이어그램

  • 속도를 명령하는 간단한 P 컨트롤러.
  • 명령된 속도는 특정 한계에서 속도를 유지하기 위해 포화됩니다. See parameter MPC_XY_VEL_MAX. This parameter sets the maximum possible horizontal velocity. This differs from the maximum desired speed MPC_XY_CRUISE (autonomous modes) and MPC_VEL_MANUAL (manual position control mode).
  • Horizontal P gain set via parameter MPC_XY_P.
  • Vertical P gain set via parameter MPC_Z_P.

# 결합된 위치 및 속도 컨트롤러 다이어그램

멀티콥터 위치  콘트롤 다이어그램

  • Mode dependent feedforwards (ff) - e.g. Mission mode trajectory generator (jerk-limited trajectory) computes position, velocity and acceleration setpoints.
  • Acceleration setpoints (inertial frame) will be transformed (with yaw setpoint) into attitude setpoints (quaternion) and collective thrust setpoint.

# 고정익 위치 콘트롤러

# 총 에너지 제어 시스템(TECS)

The PX4 implementation of the Total Energy Control System (TECS) enables simultaneous control of true airspeed and altitude of a fixed-wing aircraft. The code is implemented as a library which is used in the fixed-wing position control module.

TECS

위의 다이어그램과 같이 TECS는 대기 속도와 고도 설정값을 입력하여 스로틀 및 피치 각도 설정값을 출력합니다. These two outputs are sent to the fixed-wing attitude controller which implements the attitude control solution. However, the throttle setpoint is passed through if it is finite and if no engine failure was detected. It's therefore important to understand that the performance of TECS is directly affected by the performance of the pitch control loop. A poor tracking of airspeed and altitude is often caused by a poor tracking of the aircraft pitch angle.

Note

TECS를 조정하기 전에 자세 컨트롤러를 조정하여야 합니다.

실제 속도와 높이를 동시에 제어하는 것은 쉽지 않습니다. 항공기 피치 각도를 높이면 높이가 증가하지만 속도도 감소합니다. 스로틀을 높이면 속도가 증가하지만, 양력 증가로 인하여 높이도 증가합니다. 따라서 제어 문제를 어렵게 만드는 두 개의 출력(대기 속도 및 고도)에 모두 영향을 미치는 두 개의 입력(피치 각도 및 스로틀)이 존재합니다.

TECS는 원래 설정이 아닌 에너지 측면에서 문제를 표현하여 솔루션을 제공합니다. 항공기의 총 에너지는 운동 에너지와 위치 에너지의 합입니다. 추력(스로틀 제어를 통해)은 항공기의 총 에너지를 증가시킵니다. 주어진 총 에너지 상태는 위치 에너지와 운동 에너지의 조합입니다. 즉, 높은 고도에서 느린 속도로 비행하는 것은 총 에너지 측면에서 낮은 고도에서 더 빠른 속도로 비행하는 것과 동일합니다. 이를 특정 에너지 균형이라고 하며, 현재 고도와 실제 속도 설정값으로 계산합니다. 특정 에너지 균형은 항공기 피치 각도를 통하여 제어됩니다. 피치 각도의 증가는 운동을 위치 에너지로 변환하고, 음의 피치 각도는 그 반대로 변환합니다. 따라서, 제어 문제를 초기 설정값을 독립적으로 제어 가능한 에너지 양으로 변환하여 분리하였습니다. 추력을 사용하여 차량의 특정 총 에너지를 조절하고, 피치는 위치(높이)와 운동(속도) 에너지 사이의 균형을 유지합니다.

# 총 에너지 제어 루프

에러지 루프

# 총 에너지 균형 제어 루프

에너지 균형 루프

항공기의 총 에너지는 운동 에너지와 위치 에너지의 합입니다.

시간에 대한 미분을 취하면 총 에너지 비율이 됩니다.

이로부터 특정 에너지율은 다음과 같습니다.

여기서 는 비행 계획 각도입니다. 작은 의 경우 다음과 같이 근사할 수 있습니다.

항공기의 동적 방정식에서 다음 관계를 얻습니다.

여기서, T와 D는 추력과 항력입니다. 수평 비행에서 초기 추력은 항력에 대해 조정되고, 추력의 변화는 다음과 같은 결과를 나타냅니다.

보시다시피 에 비례하므로, 추력 설정값을 전체 에너지 제어에 사용합니다.

반면에 엘리베이터 제어는 에너지를 보존하므로, 위치 에너지를 운동 에너지로 또는 그 반대로 전환합니다. 이를 위하여, 특정 에너지 균형 비율은 다음과 같이 정의합니다.

# 고정익 자세 콘트롤러

고정익 자세 콘트롤러 다이어그램

자세 제어기는 계단식 루프 방식을 사용합니다. 외부 루프는 자세 설정값과 추정된 자세 사이의 오차를 계산하여 이득(P 콘트롤러)을 곱하여 속도 설정값을 계산합니다. 그런 다음 내부 루프는 비율의 오류를 계산하고 PI(비례 + 적분) 콘트롤러를 사용하여 목표치 각가속도를 생성합니다.

제어 이펙터(에일러론, 엘리베이터, 방향타 등)의 각도 위치는 원하는 각도 가속도와 제어 할당(혼합이라고도 함)을 통해 시스템에 대한 사전 지식을 사용하여 계산됩니다. 또한 제어 표면은 고속에서 더 효과적이고 저속에서는 덜 효과적이기 때문에, 순항 속도에 맞게 조정된 컨트롤러는 속도 측정을 사용하여 조정됩니다(이러한 센서가 사용되는 경우).

Note

속도 센서가 사용되지 않으면 고정익 자세 콘트롤러에 대한 게인 스케줄링이 비활성화됩니다(개방형 루프). 속도 피드백을 사용하여 TECS에서 수정할 수 없습니다.

피드포워드 이득은 공기역학적 감쇠를 보상합니다. 기본적으로 항공기의 차체 축 모멘트의 두 가지 주요 구성 요소는 제어 표면(에일러론, 엘리베이터, 방향타, - 움직임 생성)과 공기역학적 감쇠(몸체 속도에 비례 - 움직임에 대응)에 의하여 생성됩니다. 일정한 속도를 유지하기 위하여, 이 댐핑은 속도 루프에서 피드포워드를 사용하여 보상할 수 있습니다.

# Turn coordination

롤 및 피치 컨트롤러는 동일한 구조를 가지며, 종방향 역학과 횡방향 역학은 독립적으로 작동하기에 충분히 분리되어 있다고 가정합니다. 그러나, 요 콘트롤러는 항공기가 미끄러질 때 생성되는 측면 가속도를 최소화하기 위해 선회 조정 제약 조건을 사용하여 요 각속도 설정점을 계산합니다. The turn coordination algorithm is based solely on coordinated turn geometry calculation.

The yaw rate controller also helps to counteract adverse yaw effects (opens new window) and to damp the Dutch roll mode (opens new window) by providing extra directional damping.

# VTOL 콘트롤러

VTOL Attitude Controller Diagram

This section gives a short overview on the control structure of Vertical Take-off and Landing (VTOL) aircraft. The VTOL flight controller consists of both the multicopter and fixed-wing controllers, either running separately in the corresponding VTOL modes, or together during transitions. The diagram above presents a simplified control diagram. Note the VTOL attitude controller block, which mainly facilitates the necessary switching and blending logic for the different VTOL modes, as well as VTOL-type-specific control actions during transitions (e.g. ramping up the pusher motor of a standard VTOL during forward transition). The inputs into this block are called "virtual" as, depending on the current VTOL mode, some are ignored by the controller.

For a standard and tilt-rotor VTOL, during transition the fixed-wing attitude controller produces the rate setpoints, which are then fed into the separate rate controllers, resulting in torque commands for the multicopter and fixed-wing actuators. For tailsitters, during transition the multicopter attitude controller is running.

The outputs of the VTOL attitude block are separate torque and force commands for the multicopter and fixed-wing actuators (two instances for vehicle_torque_setpoint and vehicle_thrust_setpoint). These are handled in an airframe-specific control allocation class.

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

# Airspeed Scaling

The objective of this section is to explain with the help of equations why and how the output of the rate PI and feedforward (FF) controllers can be scaled with airspeed to improve the control performance. We will first present the simplified linear dimensional moment equation on the roll axis, then show the influence of airspeed on the direct moment generation and finally, the influence of airspeed during a constant roll.

As shown in the fixed-wing attitude controller above, the rate controllers produce angular acceleration setpoints for the control allocator (here named "mixer"). In order to generate these desired angular accelerations, the mixer produces torques using available aerodynamic control surfaces (e.g.: a standard airplane typically has two ailerons, two elevators and a rudder). The torques generated by those control surfaces is highly influenced by the relative airspeed and the air density, or more precisely, by the dynamic pressure. If no airspeed scaling is made, a controller tightly tuned for a certain cruise airspeed will make the aircraft oscillate at higher airspeed or will give bad tracking performance at low airspeed.

The reader should be aware of the difference between the true airspeed (TAS) (opens new window) and the indicated airspeed (IAS) (opens new window) as their values are significantly different when not flying at sea level.

The definition of the dynamic pressure is

where is the air density and the true airspeed (TAS).

Taking the roll axis for the rest of this section as an example, the dimensional roll moment can be written

where is the roll moment, the wing span and the reference surface.

The nondimensional roll moment derivative can be modeled using the aileron effectiveness derivative , the roll damping derivative and the dihedral derivative

where is the sideslip angle, the body roll rate and the aileron deflection.

Assuming a symmetric () and coordinated () aircraft, the equation can be simplified using only the rollrate damping and the roll moment produced by the ailerons

This final equation is then taken as a baseline for the two next subsections to determine the airspeed scaling expression required for the PI and the FF controllers.

# 정적 토크(PI) 조종

At a zero rates condition (), the damping term vanishes and a constant - instantaneous - torque can be generated using:

Extracting gives

where the first fraction is constant and the second one depends on the air density and the true airspeed squared.

Furthermore, instead of scaling with the air density and the TAS, it can be shown that the indicated airspeed (IAS, ) is inherently adjusted by the air density since at low altitude and speed, IAS can be converted to TAS using a simple density error factor

, where is the air density as sea level, 15°C.

Squaring, rearranging and adding a 1/2 factor to both sides makes the dynamic pressure expression appear

We can now easily see that the dynamic pressure is proportional to the IAS squared:

The scaler previously containing TAS and the air density can finally be written using IAS only

# 비율(FF) 조종

The main use of the feedforward of the rate controller is to compensate for the natural rate damping. Starting again from the baseline dimensional equation but this time, during a roll at constant speed, the torque produced by the ailerons should exactly compensate for the damping such as

Rearranging to extract the ideal ailerons deflection gives

The first fraction gives the value of the ideal feedforward and we can see that the scaling is linear to the TAS. Note that the negative sign is then absorbed by the roll damping derivative which is also negative.

# 결론

The output of the rate PI controller has to be scaled with the indicated airspeed (IAS) squared and the output of the rate feedforward (FF) has to be scaled with the true airspeed (TAS)

where and are the IAS and TAS at trim conditions.

Finally, since the actuator outputs are normalized and that the mixer and the servo blocks are assumed to be linear, we can rewrite this last equation as follows:

and implement it directly in the rollrate, pitchrate and yawrate controllers.

In the case of airframes with controls performance that is not dependent directly on airspeed e.g. a rotorcraft like autogyro. There is possibility to disable airspeed scaling feature by FW_ARSP_SCALE_EN parameter.

# Tuning recommendations

The beauty of this airspeed scaling algorithm is that it does not require any specific tuning. However, the quality of the airspeed measurements directly influences its performance.

Furthermore, to get the largest stable flight envelope, one should tune the attitude controllers at an airspeed value centered between the stall speed and the maximum airspeed of the vehicle (e.g.: an airplane that can fly between 15 and 25m/s should be tuned at 20m/s). This "tuning" airspeed should be set in the FW_AIRSPD_TRIM parameter.