# 高环路速率调参

通常情况下, PID 控制器在**显示( LOOP)**,主循环速度和噪声过滤速度为半循环速率. 这意味着PID速率错误校正只能以1/loop速率发生. 对于400赫兹,这是2.5ms。 在ArduCopter 4.7以及后来,可以运行PID姿态率接近陀螺仪提供测量速度,测量速度可达4KHz,导致2.5uS率实际上是校正. 陶宁比较敏感和复杂,但对于对惯性比(非常敏捷)有较大推力的机体进行气压应用,可以产生更精确和反应更敏捷的控制.

<div class="callout info" id="bkmrk-%E8%AF%B4%E6%98%8E%EF%BC%9A%E4%BB%8D%E5%9C%A8%E8%BF%9B%E8%A1%8C%E5%A4%A7%E9%87%8F%E8%AE%A1%E7%AE%97%2C%E5%AF%BC%E8%87%B4cpu%E8%B4%9F%E8%BD%BD%E5%A2%9E">**说明**：

仍在进行大量计算,导致CPU负载增加。 H冉基以何种方式进行自动驾驶是可以接受的,但F4基自动驾驶可能无法维持这种增加的负载.

</div>设置运行 PID 速率循环,更接近于更高的陀螺仪采样率,而不是**显示( LOOP)**:

## 配置

仅有两个新的设置可以让快速率姿态出现,但这些设置对其他几个设置有影响:

- <dl class="first docutils"><dt>**可实施的战略**:</dt><dd>
    - 0: 页:1
    - 1:启用动态快速速率. 在高的CPU加载时(由主循环为慢或陀螺仪样本队列填充决定),速率会降低到陀螺仪数据速率的整数二维器,直到CPU稳定. 这是尝试支持的最安全的方法.
    - 当我们开始战斗时, 当我们开始时, 注意, 您必须确定您有足够的 CPU 来启用此选项或控制会被在这一方面损坏 。
    - 3: Enable fixed fast rate. This is useful for testing but not usually used.
    
    </dd></dl>
- **FSTRATE\_DIV**: this defaults to 1 and represents the minimum fast rate gyro divisor. So a value of 2 will yield a rate loop of gyro rate / 2 (**INS\_GYRO\_RATE** / 2). This allows a fixed fast rate that is lower than the gyro rate. This parameter is can be modified in-flight.

The easiest way to try this feature is to set **FSTRATE\_ENABLE** = 1 (Dynamic rate). If your flight controller is struggling it will reduce the attitude loop rate until normality is restored. **FSTRATE\_ENABLE** = 2 (Fixed Rate) is not recommended until you have seen reasonable performance with dynamic rates.

One way to gain more CPU is to switch off additional IMUs using **INS\_ENABLE\_MASK** or reduce **INS\_GYRO\_RATE**. The main CPU load is from the INS and attitude control threads.

When this feature is enabled, several other settings are affected:

- **SERVO\_DSHOT\_RATE** - this represents a multiplier of the main loop rate to output to the motors. When the fast rate loop is enabled this is normally set to 1, however if the calculated rate will not exceed the gyro rate, higher values are allowed. For instance if **INS\_GYRO\_RATE** = 2(4KHz) and **FSTRATE\_DIV** = 4 (1KHz)then values of **SERVO\_DSHOT\_RATE** up to 4(4x loop rate) are allowed.
- Fast attitude and PID logging enabled in **LOG\_BITMASK** - setting these bits usually logs at the main loop rate, however if fast attitude is enabled these will be logged at the minimum of the fast attitude rate and 1kHz
- **SCHED\_LOOP\_RATE** - since all the heavy lifting of attitude control is being done in a separate thread, **SCHED\_LOOP\_RATE** can be run at normal values - for instance 400Hz or even less.

## Tuning Setup

Its extremely important that the **Notch filtering \*\* be setup as well as the \*\*tuning-process-instructions** be followed before tuning with this feature enabled.

- **INS\_GYRO\_FILTER** - as high as you can get without cooking your motors. Often copters have resonance around 120Hz so it is hard to get higher than this without notching out frame resonance.
- each axis' `ATC_RAT_xxx_FLTD` should be **INS\_GYRO\_FILTER**/2 on roll and pitch and **INS\_GYRO\_FILTER**/4 on yaw. This is because D is more active, lets more noise through and is more likely to cook your motors. Setting it above 0.75 \* **INS\_GYRO\_FILTER** is not recommended.
- each axis' `ATC_RAT_xxx_FLTT` should be at the highest rate you want the EKF or your fingers to control the copter. Values of 30Hz should be fine, but higher has diminishing returns but does not affect the tune.

*【本页后半部分仍为英文原文摘录，补译中。】*

---

*译自 ArduPilot Copter「Aggressive Rate Loop Tuning」· [查看原文](https://ardupilot.org/copter/docs/high-loop-rate-tuning.html) · CC BY-SA 3.0*