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).
- Verify that the vehicle flies well after tuning.
사전 튜닝 테스트
The vehicle must be able to fly and adequately stabilize itself before running auto-tune. This test ensures that the vehicle can fly safely in position controlled modes.
To make sure the vehicle is stable enough for auto-tuning:
비행 구역이 깨끗하고 공간이 충분한 지 확인하기 위하여, 일반적인 비행 전 안전 점검을 실시합니다.
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번의 진동 이내에서 안정화되어야 합니다.
각각의 시도에서 더 큰 진폭으로 기울이면서 기동을 반복합니다. 기체가 ~20도에서 2번의 진동 내에서 안정화될 수 있으면 다음 단계로 이동합니다.
피치 축에서 동일한 동작을 반복합니다. As above, start with small angles and confirm that the vehicle can stabilise itself within 2 oscillations before increasing the tilt.
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.
Auto-tuning Procedure
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). For best results, we recommend running the test in calm weather conditions.
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).The test steps are:
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.
The test steps are:
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.
- 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.
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.
The auto-tuning sequence fails
If the drone was not moving enough during auto-tuning, the system identification algorithm might have issues to find the correct coefficients.
Increase the
parameter by steps of 1 and trigger the auto-tune again.The auto-tuning sequence fails
If the drone was not moving enough during auto-tuning, the system identification algorithm might have issues to find the correct coefficients.
Increase the
parameter by steps of 1 and trigger the auto-tune again.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. This is used for testing purposes if the user wants to inspect results of the auto-tuning algorithm without using them directly.1
: apply the gains after disarm (default for multirotors). The operator can then test the new tuning while taking-off carefully.2
: apply immediately (default for fixed-wings). The new tuning is applied, disturbances are sent to the controller and the stability is monitored during the next 4 seconds. If the control loop is unstable, the control gains are immediately reverted back to their previous value. If the test passes, the pilot can then use the new tuning.
Attempt manual tuning using the guides listed in See also below.
Optional Configuration
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. This is used for testing purposes if the user wants to inspect results of the auto-tuning algorithm without using them directly.1
: apply the gains after disarm (default for multirotors). The operator can then test the new tuning while taking-off carefully.2
: apply immediately (default for fixed-wings). The new tuning is applied, disturbances are sent to the controller and the stability is monitored during the next 4 seconds. If the control loop is unstable, the control gains are immediately reverted back to their previous value. 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
Developers/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. The operation completes when the progress is 100% or the vehicle lands and disarms.
INFO
This is not a MAVLink-compliant implementation of a command protocol long running command. PX4 should stream progress as the protocol does not allow polling.
The feature is not yet supported by 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. The controllers must be well tuned in order to get the best performance out of a vehicle. In particular, a poorly tuned rate controller results in less stable flight in all modes, and takes longer to recover from disturbances.
Generally if you use a frame configuration that is similar to your vehicle then the vehicle will be able to fly. However unless the configuration precisely matches your hardware you should tune the rate and attitude controllers. Tuning the velocity and position controllers is less important because they are less affected by vehicle dynamics, and the default tuning configuration for a similar airframe is often sufficient.
Autotuning provides an automatic mechanism to tune the rate and attitude controllers. 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). In theory it should work for other vehicle types that have a rate controller, but currently only the above types are supported.
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.
자주 묻는 질문
What frames types are supported?
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.
Does autotuning work for all supported airframes?
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.
See also
- Fixed-Wing PID Tuning Guide
- Parameters > Autotuning (prefixed with
FW_AT_
).