Auto-tuning (Fixed-Wing)
Автоналаштування автоматизує процес налаштування контролерів швидкості та ставлення PX4, які є найважливішими контролерами для стабільного та реактивного польоту (інші налаштування є більш "необов'язковими").
Tuning only needs to be done once, and is recommended unless you're using a vehicle that has already been tuned by the manufacturer (and not modified since).
WARNING
Auto-tuning is performed while flying. The airframe must fly well enough to handle moderate disturbances, and should be closely attended:
- Test that your vehicle is stable enough for autotuning.
- Be ready to abort the autotuning process. You can do this by changing flight modesor using an auto-tune enable/disable switch (if configured).
- Перевірте, що автомобіль добре літає після налаштування.
Попереднє налаштування тесту
Транспортний засіб повинен бути здатний літати і належним чином стабілізувати себе перед запуском автоматичного налаштування. Цей тест дозволяє забезпечити безпечний польот транспортного засобу в режимах управління положенням.
Переконайтеся, що транспортний засіб достатньо стабільний для автоналаштування:
Виконайте звичайний контрольний перелік безпеки перед польотом, щоб переконатися, що зона польоту чиста і має достатньо місця.
Take off and
fly at cruise speed in Position mode or Altitude mode.Use the RC transmitter roll stick to perform the following maneuver, tilting the vehicle just a few degrees: roll left > roll right > center (The whole maneuver should take about 3 seconds). Транспортний засіб повинен стабілізуватися протягом 2 коливань.
Повторіть маневр, нахиляючись з більшими амплітудами при кожної спроби. Якщо транспортний засіб може стабілізуватися протягом 2 коливань під кутом близько 20 градусів, перейдіть до наступного кроку.
Повторіть ті ж маніпуляції, але по осі поля. Як вище, почніть з невеликих кутів і підтвердіть, що транспортний засіб може стабілізуватися самостійно протягом 2 коливань, перш ніж збільшувати нахил.
If the drone can stabilize itself within 2 oscillations it is ready for the auto-tuning procedure.
WARNING
If the drone cannot stabilize itself sufficiently, follow the instructions in the troubleshooting section. These explain the minimal manual tuning to prepare the vehicle for auto-tuning.
Процедура автоналагодження
The auto-tuning sequence must be performed in a safe flight zone, with enough space. It takes about 40 seconds (between 19 and 68 seconds). Для найкращих результатів ми рекомендуємо проводити тестування в спокійні погодні умови.
The recommended mode for autotuning is
, but any other flight mode can be used. The RC sticks cannot be used during autotuning (moving the sticks will stop the autotune operation).Кроки наступні:
Perform the pre-tuning test.
Takeoff using RC control
Once flying at cruise speed, activate Hold mode. This will guide the plane to fly in circle at constant altitude and speed.Enable autotune.
TIP
If an Enable/Disable Autotune Switch is configured you can just toggle the switch to the "enabled" position.
- In QGroundControl, open the menu Vehicle setup > PID Tuning:

Select either the Rate Controller or Attitude Controller tabs.
Ensure that the Autotune enabled button is enabled (this will display the Autotune button and remove the manual tuning selectors).
Read the warning popup and click on OK to start tuning.
Дрон спочатку почне виконувати швидкі рухи кочення, а потім рухи тангажу та рухи курсу. The progress is shown in the progress bar, next to the Autotune button.
- The tuning will be immediately/automatically be applied and tested in flight (by default). PX4 will then run a 4 second test and revert the new tuning if a problem is detected.
WARNING
If any strong oscillations occur, land immediately and follow the instructions in the Troubleshooting section below.
Additional notes:
- Autotuning can also be run in Altitude mode or Position mode. However running the test while flying straight requires a larger safe area for tuning, and does not give a significantly better tuning result.
- Whether tuning is applied while flying or after landing can be configured using parameters.
Усунення проблем
Drone oscillates when performing the pre-tuning test
Slow oscillations (1 oscillation per second or slower): this often occurs on large platforms and means that the attitude loop is too fast compared to the rate loop.
Fast oscillations (more than 1 oscillation per second): this is because the gain of the rate loop is too high.
Послідовність автоматичної настройки не вдається
Якщо безпілотник не рухався достатньо під час автоматичного налаштування, алгоритм ідентифікації системи може мати проблеми з визначенням правильних коефіцієнтів.
Increase the
parameter by steps of 1 and trigger the auto-tune again.The drone oscillates after auto-tuning
Due to effects not included in the mathematical model such as delays, saturation, slew-rate, airframe flexibility, the loop gain can be too high. To fix this, follow the same steps described when the drone oscillates in the pre-tuning test.
Я все ще не можу зрозуміти, як це працює
Attempt manual tuning using the guides listed in See also below.
Необов'язкова Конфігурація
Apply Tuning when In-Air/Landed
By default fixed wing tuning the parameters are applied while flying, and then PX4 runs a test to confirm that the controllers work properly. This behaviour can be configured using the FW_AT_APPLY parameter:
0
: the gains are not applied. Це використовується для тестування, якщо користувач хоче перевірити результати автоналаштування алгоритму без прямого їх використання.1
: apply the gains after disarm (default for multirotors). Оператор може перевірити нове налаштування під час обережного зльоту.2
: apply immediately (default for fixed-wings). Нове налаштування застосовується, перешкоди надсилаються контролеру, а стабільність контролюється протягом наступних 4 секунд. Якщо керуюче коло нестійке, керуючі коефіцієнти негайно повертаються до свого попереднього значення. If the test passes, the pilot can then use the new tuning.
Enable/Disable Autotune Switch
A remote control switch can be configured to enable/disable autotune (in any mode) using an RC AUX channel (note, this is only supported on fixed-wing vehicles).
To map a switch:
- Select an RC channel on your controller to use for the autotune enable/disable switch.
- Set RC_MAP_AUX1 to match the RC channel for your switch (you can use any of
RC_MAP_AUX1
toRC_MAP_AUX6
). - Set FW_AT_MAN_AUX to the selected channel (i.e.
1: Aux 1
if you mappedRC_MAP_AUX1
).
The auto tuner will be disabled when the switch is below 0.5
(on the manual control setpoint range of of [-1, 1]
) and enabled when the switch channel is above 0.5
.
If using an RC AUX switch to enable autotuning, make sure to select the tuning axes before flight.
Select Tuning Axis
Fixed-wing vehicles (only) can select which axes are tuned using the FW_AT_AXES bitmask parameter:
- bit
0
: roll (default) - bit
1
: pitch (default) - bit
2
: yaw
Розробники/SDKs
Autotuning is started using MAV_CMD_DO_AUTOTUNE_ENABLE MAVLink command.
At time of writing the message is resent at regular intervals to poll PX4 for progress: the COMMAND_ACK
includes result that the operation is in progress, and also the progress as a percentage. Операція завершується, коли прогрес досягає 100% або транспортний засіб приземляється і роззброюється.
INFO
This is not a MAVLink-compliant implementation of a command protocol long running command. PX4 повинен транслювати прогрес, оскільки протокол не дозволяє опитування.
Функція ще не підтримується MAVSDK.
Background/Detail
PX4 uses PID controllers (rate, attitude, velocity, and position) to calculate the outputs required to move a vehicle from its current estimated state to match a desired setpoint. Контролери повинні бути добре налаштовані, щоб отримати найкращу продуктивність з автомобіля. Зокрема, погано налаштований регулятор швидкості призводить до менш стабільного польоту у всіх режимах і потребує більше часу на відновлення після перешкод.
Generally if you use a frame configuration that is similar to your vehicle then the vehicle will be able to fly. Однак, якщо конфігурація точно не відповідає вашому обладнанню, вам слід налаштувати регулятори швидкості та кута нахилу. Налаштування контролерів швидкості та позиції менш важливе, оскільки вони менше піддаються динаміці транспортного засобу, і типова конфігурація налаштування для схожого аеродинамічного корпусу часто є достатньою.
Автоналаштування забезпечує автоматичний механізм для налаштування регуляторів швидкості та кута нахилу. It can be used to tune fixed-wing and multicopter vehicles, and VTOL vehicles when flying as a multicopter or as a fixed-wing (transition between modes must be manually tuned). Теоретично це повинно працювати для інших типів транспортних засобів, які мають регулятор швидкості, але наразі підтримуються лише вищезазначені типи.
Automatic tuning works well for the multicopter and fixed-wing vehicle configurations supported by PX4, provided the frame is not too flexible (see below for more information).
The vehicle must be flying in an altitude-stabilized mode (such as Altitude mode, Hold mode, or Position mode). The flight stack will apply a small disturbance to the vehicle in each axis and then attempt to calculate the new tuning parameters. For fixed-wing vehicles the new tuning is applied in-air by default, after which the vehicle tests the new settings and reverts the tuning if the controllers are not stable. For multicopter, the vehicle lands and applies the new tuning parameters after disarming; the pilot is expected to then take off carefully and test the tuning.
The tuning process takes about 40 seconds (between 19 and 70 seconds). The default behaviour can be configured using parameters.
Часто Запитувані Питання
Які типи кадрів підтримуються?
Autotuning is enabled for multicopter, fixed-wing, and hybrid VTOL fixed-wing vehicles.
While it is not yet enabled for other frame types, in theory it an be used with any frame that uses a rate controller.
Чи працює автоналадка для всіх підтримуваних конструкцій?
The mathematical model used by autotuning to estimate the dynamics of the drone assumes this it is a linear system with no coupling between the axes (SISO), and with a limited complexity (2 poles and 2 zeros). If the real drone is too far from those conditions, the model will not be able to represent the real dynamics of the drone.
In practise, autotuning generally works well for fixed-wing and multicopter, provided the frame is not too flexible.
Як довго триває автоналагодження?
Tuning takes 5s-20s per axis (aborted if tuning could not be established in 20s) + 2s pause between each axis + 4s of testing if the new gains are applied in air.
Мультикоптер повинен налаштовувати всі три осі, і за замовчуванням не перевіряє нові виграші у повітрі. Tuning will therefore take between 19s (5 + 2 + 5 + 2 + 5
) and 64s (20x3 + 2x2
).
За замовчуванням літак налагоджує всі три осі, а потім перевіряє нові коефіцієнти в повітрі. The range is therefore between 25s (5 + 2 + 5 + 2 + 5 + 2 + 4
) and 70s (20x3 + 3x2 + 4
).
Зверніть увагу, що вищезазначені налаштування є значеннями за замовчуванням. Мультикоптер може вибрати проведення тестів в повітрі, а планер може вибрати не робити цього. Додатково, літак з фіксованим крилом може вибрати налаштувати менше вісей.
Anecdotally, it usually takes around 40s for either vehicle.
Дивись також
- Fixed-Wing PID Tuning Guide
- Parameters > Autotuning (prefixed with
FW_AT_
).