INAV: how to setup asynchronous gyro
Together with version 1.4, INAV introduced asynchronous gyroscope processing. What is async gyro and why it is useful to have it, you can read here. In short worlds: data from gyroscope is read and filtered faster than PID controller updates motor and servo output.
When it is worth to enable asynchronous processing
In general, async gyro can be enabled when:
- Flight controller does not ave enough processing power to run control loop faster than 2000us (500Hz mode). This is the case for all SMT32F1 boards like Naze32, Flip32 or CC3D
- Flight controller is powerful enough to process PID control loop faster than ESC protocol (PWM, Oneshot125, Multishot) transfer commands to ESC and servos. This is usually true in case of all STM32F4 boards
- INAV is setup on a "racer" machine that requires the best gyro signal possible
Async gyro should not be enabled when gyro and control loop frequency are the same. For example, 1kHz gyro and 1kHz control loop would give worse results than 1kHz synchronous processing.
How to enable async processing in Configurator
Async processing can be enabled in Configuration tab of INAV Configurator. Appropriate options are available only with INAV 1.4 or newer.
Asynchronous 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.
Frequencies available in "Gyroscope task frequency" and "Flight Controller Loop Time" depends on chosen "Gyroscope LPF cutoff frequency". Gyro task frequency should be kept above Control Loop Frequency.
Asynchronous 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.
Warning Accelerometer accuracy might be lowered if task frequency is too low. Attitude task frequency should be kept below Accelerometer task frequency.
This mode is not suggested for GPS assisted UAVs. GPS assisted UAVs should use asynchronous mode None or Gyro.
Tips
- I'm not using async processing on "big" machines.
- On STM32F1 I'm using 1kHz gyro and 500Hz control loop
- On SP Racing F3 I'm using 2kHz gyro and 1kHz control loop. I2C is not fast enough to retrieve data faster than that
- All my STM32F4 birds uses 8kHz gyro and 2kHz control loop. If I do not need accelerometer (racers), I also set 250Hz accelerometer task and 100Hz attitude task. If I need accelerometer (navigation), I leave them synchronous with control loop for best performance.
I'm Paweł Spychalski and I do things. Mainly software development, FPV drones and amateur cinematography. Here are my YouTube channels: