Skip to content

Commit

Permalink
4.7:Add Quadplane QwikTune
Browse files Browse the repository at this point in the history
  • Loading branch information
Hwurzburg committed Dec 17, 2024
1 parent 11ff080 commit 0ff2b53
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 5 deletions.
3 changes: 3 additions & 0 deletions common/source/docs/common-auxiliary-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ Supported Features
+----------------------+----------------------------+----------+---------+---------+
| 180 | Autotune_test_gains | X | X | |
+----------------------+----------------------------+----------+---------+---------+
| 181 | VTOL QuickTune | | X | |
+----------------------+----------------------------+----------+---------+---------+


Intended as continuous PWM range control inputs:
Expand Down Expand Up @@ -585,6 +587,7 @@ Other functions are:
FlightMode Pause In Guided/Auto modes, pauses mission
ICEngine start / stop Controls ICE engine starter output :ref:`ICE engines<common-ice>`
Autotune_test_gains After autotune,allows selecting tune(high) or pretune gains
VTOL QuickTune Autotunes QuadPlane VTOL PIDs, see :ref:`quicktune`
ROLL Input ROLL input channel. (replaces RCMAP)
PITCH Input PITCH input channel. (replaces RCMAP)
THROTTLE Input THROTTLE input channel. (replaces RCMAP)
Expand Down
1 change: 1 addition & 0 deletions plane/source/docs/quadplane-tuning-landingpage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ QuadPlane's have independent tuning of VTOL modes stability, altitude, and posit
QuadPlane VTOL Tuning Process<quadplane-vtol-tuning-process>
Tilt Vectored Yaw Tuning <tilt-vectored-yaw-tuning>
Tailsitter Tuning <tailsitter-tuning-guide>
QUICKTUNE <quicktune>
Motor Thrust Scaling <motor-thrust-scaling>
Notch Filter Configuration <common-imu-notch-filtering>
7 changes: 4 additions & 3 deletions plane/source/docs/quadplane-vtol-tuning-process.rst
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,17 @@ Set :ref:`Q_A_RATE_FF_ENAB <Q_A_RATE_FF_ENAB>` to 1 after the tests are complete

Step 12: Autotuning
-------------------
Often, a good manual tune will be sufficient. However, autotuning can sometimes improve the tune.
Often, the default params or a good manual tune will be sufficient. However, autotuning can usually improve the tune.

If the aircraft appears stable enough to attempt autotuning and you
have sufficient battery to last through an autotuning session then you can autotune using one of two methods:

- Quick Tune LUA Applet (the preferred method if your autopilot is capable of running LUA scripts)
- QAUTOTUNE Mode (no longer the recommended method, but can be used if using LUA scripts is not possible)
- :ref:`QUICKTUNE <quicktune>`
- QAUTOTUNE Mode (no longer the recommended method, and is not compiled into most firmware).

Using the Quick VTOL Tune LUA Applet to Automate Tuning
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. note:: As of ArduPlane 4.6, this is now integrated into the firmware as code, directly.

For systems using an autopilot with sufficient memory to run :ref:`LUA scripts <common-lua-scripts>`, such as F7 and H7 based controllers, this process has been automated via a LUA Applet.

Expand Down
3 changes: 1 addition & 2 deletions plane/source/docs/quadplane-vtol-tuning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ An objective view of the overall Roll and Pitch performance can be seen
by graphing the :ref:`dataflash log's <common-downloading-and-analyzing-data-logs-in-mission-planner>` ATT message's DesRoll vs Roll and DesPit vs Pitch. The "Roll" (i.e.
actual roll) should closely follow the "DesRoll" while in stabilized modes. Pitch should similarly closely follow DesPit.

Alternatively you may wish to try tuning both the rate and angle
parameters using the :ref:`QAUTOTUNE mode <qautotune-mode>`.
Alternatively you may wish to try automatically tuning the rate parameters using the :ref:`QUICKTUNE <quicktune>`.

Yaw Tuning
==========
Expand Down
60 changes: 60 additions & 0 deletions plane/source/docs/quicktune.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
.. _quicktune:

==============
VTOL QUICKTUNE
==============

.. note: QUICKTUNE can only be used in QHOVER,QLOITER, or GUIDED VTOL modes.
ArduPlane provides a quick means of obtaining a good tune for Quadplanes in VTOL modes. The process slowly increases the relevant gains until it detects an oscillation. It then reduces the gains by 60% and moves onto the next gain. Once all the gains have been tuned the tune completes and the user can decide to save or discard the new gains.

.. note:: be sure that you have prepared the vehicle for tuning by setting up parameters discussed here: :ref:`quadplane-vtol-tuning-process` Steps 1 to 11 and then use this mechanism in Step 12. Also to assure the best tune, setup the noise notch filtering, see :ref:`common-imu-notch-filtering`. You may run QUICKTUNE without this step to obtain initial fine tune, see :ref:`ac_rollpitchtuning` if the vehicle cant do an initial hover stably. Then setup the filters and retune for best results.

The script attempts to automatically tune the P/I and D gain of each axis enabled for tuning when an two or three position RC switch, whose ``RCx_OPTION`` is "181", is moved to the "tune" position. It will, by default, also adjust some PID loop filter values based on the :ref:`INS_GYRO_FILTER<INS_GYRO_FILTER>` setting.

The advantage over QAUTOTUNE is that QUICKTUNE is safer because the vehicle does not need to move or twitch and QAUTOTUNE can occasionally result in instablity. Therefore QAUTOTUNE is not longer recommended for use, except by expects.

The disadvantage is that QUICKTUNE cannot find the vehicle's maximum rotational accelerations or tune the attitude angle outer loops from their default or pre-tune adjusted (:ref:`quadplane-vtol-tuning-process`) values. However, tuning only the inner rate loops usually will yield a stable, safe flying vehicle.

Setup
=====
- Set :ref:`QWIK_ENABLE<QWIK_ENABLE>` = "1" to enable QUICKTUNE.
- Set :ref:`QWIK_AXES<QWIK_AXES>` to which axes (Roll/Pitch/Yaw).

Activation RC Switch
--------------------
Set up a two or three position RC switch with `RCx_OPTION`` = "181". If it is a two position switch set :ref:`QWIK_OPTIONS<QWIK_OPTIONS>` bit 0 to "1", and you probably want to set the :ref:`QWIK_AUTO_SAVE<QWIK_AUTO_SAVE>` parameter to autosave the tune once completed.

With a three position switch, moving the switch to "high" (>1800us) is the "save" position which will save the current tune parameters, even if the tune is not completed yet. Moving the switch to the middle position activates the tuning process ("tune"). Moving the switch to the "low" position (<1200us), stops the tuning and reverts the parameters to their values before tuning began.

.. note:: RC AUX switches only operate on transitions of the switch. Their position at boot does nothing, so if a switch is "high" at boot, in order to get the "high" function, it must be moved to another position and then back "high".

With a two position switch, "high" is the "tune" position, and "low" stops/reverts tuning. In order to save parameters, you must have set the :ref:`QWIK_AUTO_SAVE<QWIK_AUTO_SAVE>` parameter or use a GCS AUX switch facility.

Tuning Flight
=============
- Wait for a calm day and go to an open area with good GPS reception
- Use an OSD, TX OSD (using :ref:`Yaapu <common-frsky-yaapu>`), or GCS. This is where output from the tune will appear
- Move the RC switch to the low position OR push MP's Aux Function's "Low" button
- Arm and takeoff in Loiter mode and climb to a height of about 3m
- Begin the tune by moving the RC switch to the "tune" position OR push MP's Aux Function's "Mid" button
- Monitor the progress of the tune using the GCS's Messages tab
- If necessary reposition the vehicle using the RC transmitter. This will temporarily pause tuning and restore the original gains. Tuning will resume a few seconds after the RC sticks are returned to their center position
- If the vehicle begins oscillating violently cancel the tune by moving the RC switch to the low position OR push MP's Aux Function's "Low" button
- Once the tune has completed accept the new gains by moving the RC aux switch to the "save" position, wait for the :ref:`QWIK_AUTO_SAVE<QWIK_AUTO_SAVE>` timeout, OR push MP's Aux Function's "High" button
- Land and disarm the vehicle

Advanced Configuration
======================
Additional advanced parameters are shown below, but normally do not need to be changed and, then only by experienced users:

- :ref:`QWIK_AUTO_FILTER<QWIK_AUTO_FILTER>`
- :ref:`QWIK_DOUBLE_TIME<QWIK_DOUBLE_TIME>`
- :ref:`QWIK_GAIN_MARGIN<QWIK_GAIN_MARGIN>`
- :ref:`QWIK_OSC_SMAX<QWIK_OSC_SMAX>`
- :ref:`QWIK_YAW_P_MAX<QWIK_YAW_P_MAX>`
- :ref:`QWIK_YAW_D_MAX<QWIK_YAW_D_MAX>`
- :ref:`QWIK_RP_PI_RATIO<QWIK_RP_PI_RATIO>`
- :ref:`QWIK_Y_PI_RATIO<QWIK_Y_PI_RATIO>`
- :ref:`QWIK_REDUCE_MAX<QWIK_REDUCE_MAX>`
- :ref:`QWIK_ANGLE_MAX<QWIK_ANGLE_MAX>`

0 comments on commit 0ff2b53

Please sign in to comment.