QuikTune¶
The Rover QuikTune Lua script simplifies the process of finding good gains for a vehicle’s steering and speed controllers.
The script should be run while the vehicle is circling in Circle mode. It records the steering and throttle outputs and the resulting response (e.g. vehicle’s turn rate and speed) for at least 10 seconds in order to calculate the feed-forward gains. The P and I gains are then set to a ratio of the feed-forward’s. Once complete the gains are saved automatically.
By default the gains will be tuned in this order:
ATC_STR_RAT_FF, then ATC_STR_RAT_P and I are set to ratios of the FF
CRUISE_SPEED and CRUISE_THROTTLE, then ATC_SPEED_P and I are set to ratios of the FF
The script will also adjust filter settings:
ATC_STR_RAT_FLTD and FLTT will be set to half of the INS_GYRO_FILTER value
Installing the Script¶
Set SCR_ENABLE = 1 to enable scripting and then reboot the autopilot
Download rover-quicktune.lua to your PC
Copy the script to your autopilot’s SD card’s APM/scripts directory. If using MP it may be easiest to use the Config, MAVFtp screen
Reboot the autopilot and set RTUN_ENABLE = 1
If an RC switch will be used to start/stop the tune set RCx_OPTION = 300 where “x” is the RC input channel number. Alternatively set one of Mission Planner’s Aux Function tab’s rows to “Scripting1”
Running QuikTune¶
Go to an open area with good GPS reception
Connect with a ground station (e.g Mission Planner or QGC) and ensure that the Messages tab can be seen. 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
Optionally set CIRC_SPEED to about half the vehicle’s maximum speed
Arm the vehicle, drive to an open area and switch to Circle mode
Begin the tune by moving the RC switch to the middle position OR push MP’s Aux Function’s “Mid” button
Monitor the progress of the tune using the GCS’s Messages tab
If the RC steering and throttle sticks are moved from their center position the tuning will be paused until a few seconds after they are moved back 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 the new gains will be saved automatically
Drive the vehicle home and disarm
Advanced Configuration¶
The full list of available parameter settings are here