1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-13 03:19:58 +03:00
inav/docs/Looptime.md
Pawel Spychalski (DzikuVx) a4f1f67ac8 typo fix
2016-11-02 18:38:44 +01:00

2.1 KiB

Looptime / Control loop frequency

Looptime / Control loop frequency (how often PID controller is executed and data is passed to motors) in INAV depends on multiple settings.

More, with asynchronous gyro processing, not all tasks are executed in the same time. Depending on async_mode setting, there are following cases:

async_mode = NONE

Gyroscope sampling and filtering, Accelerometer sampling and filtering, Attitude computation and PID control loop are executed as single tasks and processed one after another.

gyro_sync gyro_lpf Control Loop Rate (actual looptime) [us]
OFF any looptime
ON != 256HZ 1000 * gyro_sync_denom
ON = 256HZ 125 * gyro_sync_denom

async_mode = GYRO

In this mode, gyro sampling and filtering is decoupled from PID main loop and executed separately. In this mode, gyro_sync is forced and is always ON

gyro_lpf Control Loop Rate [us] Gyro looptime [us]
!= 256HZ looptime 1000 * gyro_sync_denom
= 256HZ looptime 125 * gyro_sync_denom

async_mode = ALL

In this mode, Gyroscope sampling and filtering, Accelerometer sampling and filtering, Attitude computation and PID control loop are decoupled and run as separate tasks.

gyro_lpf Control Loop Rate [us] Gyro looptime [us] Accelerometer looptime [us] Attitude looptime [us]
!= 256HZ looptime 1000 * gyro_sync_denom 1000000 / acc_task_frequency 1000000 / attitude_task_frequency
= 256HZ looptime 125 * gyro_sync_denom 1000000 / acc_task_frequency 1000000 / attitude_task_frequency