Use the `.bin` log from the first flight to set the parameters described on the `19_throttle_controller.param` file. Edit it with a text editor to meet your needs and in Mission Planner while connected to the vehicle [select *Compare Params*, review the changes and press *Continue* followed by *Upload Params*](https://ardupilot.org/planner/docs/mission-planner-configuration-and-tuning.html#full-parameter-list).
4. Second flight: MagFit
Now that the Harmonic Notch filter and the throttle controller are configured, the second flight will be safer.
This flight will be used to calibrate the compass during a realistic operation scenario in the air.
[Inflight MagFit calibration](https://ardupilot.org/copter/docs/common-magfit.html#using-mavexplorer-s-integrated-magfit-utility)
Follow these steps:
1. Download the `copter-magfit-helper.lua` and `advance-wp.lua` scripts from [Scripted MagFit flightpath generation](https://discuss.ardupilot.org/t/scripted-magfit-flightpath-generation/97536) and put them on the micro SDCard's `APM/scripts` folder
1. Activate MagFit by downloading the [22_inflight_magnetometer_fit_setup.param parameter file](diatone_taycan_mxc/params/22_inflight_magnetometer_fit_setup.param) to your PC, edit it with a text editor to meet your needs and in Mission Planner while connected to the vehicle [select *Compare Params*, review the changes and press *Continue* followed by *Uploadd Params*](https://ardupilot.org/planner/docs/mission-planner-configuration-and-tuning.html#full-parameter-list)
1. Perform the MagFit figure-eight flight and land
1. Download the latest `.bin` dataflash log file from the micro SDcard's `/APM/LOGS` folder
1. Load it into MAVExplorer using the command line: `MAVExplorer.py filename.bin` or into the [ArduPilot MAGFit in flight compass calibration](https://firmware.ardupilot.org/Tools/WebTools/MAGFit/) using an internet browser.
1. Select the area where the multicopter performed the Figure eight (exclude the takeoff and landing flight sections)
1. Perform the MagFit calculations. In our case, we got the [23_inflight_magnetometer_fit_results.param parameter file](diatone_taycan_mxc/params/23_inflight_magnetometer_fit_results.param)
1. Upload the tool-generated `.param` file, not ours, to the vehicle.
![MagFit results](magfit_1.png)
After that repeat the steps described in [2.12 ArduPilot Hardware Report](212-ardupilot-hardware-report).
The report should now look like this:
![Hardware-Report after MagFit](hardware_report_magfit.png)
5. Third flight: Evaluate the aircraft tune - part 1
Follow the first part of [evaluating the aircraft tune](https://ardupilot.org/copter/docs/evaluating-the-aircraft-tune.html#evaluating-the-aircraft-tune).
After landing take a look at the `RATE.*out` values in the `.bin` log file, they all should be below 0.1.
Download the [26_evaluate_the_aircraft_tune_ff_disable.param parameter file](diatone_taycan_mxc/params/26_evaluate_the_aircraft_tune_ff_disable.param), and in Mission Planner while connected to the vehicle [select *Compare Params*, review the changes and press *Continue* followed by *Upload Params*](https://ardupilot.org/planner/docs/mission-planner-configuration-and-tuning.html#full-parameter-list).
6. Fourth flight: Evaluate the aircraft tune - part 2
Follow the second part of [evaluating the aircraft tune](https://ardupilot.org/copter/docs/evaluating-the-aircraft-tune.html#evaluating-the-aircraft-tune).
After landing take a look at the `RATE.*out` values in the `.bin` log file, they all should be below 0.1.
Download the [27_evaluate_the_aircraft_tune_ff_enable.param parameter file](diatone_taycan_mxc/params/27_evaluate_the_aircraft_tune_ff_enable.param), and in Mission Planner while connected to the vehicle [select *Compare Params*, review the changes and press *Continue* followed by *Upload Params*](https://ardupilot.org/planner/docs/mission-planner-configuration-and-tuning.html#full-parameter-list).
7. [Autotune flight(s)](https://ardupilot.org/copter/docs/autotune.html)
The Autotune is an automated iterative process:
1. It changes the parameter values of the attitude PID controllers
1. Tests the [overshoot and settling-time](https://aleksandarhaber.com/transient-response-specifications-peak-time-settling-time-rise-time-and-percent-overshoot/) of the control loop using the new PID values
1. If they are within the desired requirements, the process is over. If not, it gets repeated from the beginning
If the battery gets depleted before you can complete the Autotune flight(s), download the latest `.bin` log file from the micro SDCard directory `/APM/LOGS`.
Take a look at the `ATUN` messages.
They show how the PID values change over time.
You should use the latest PID values from the `ATUN` messages to set the starting point of your next PID Autotune with a fresh battery.
But be careful, **these new PID values might be unstable and cause your vehicle to crash**.
To be on the safe side perform the third and fourth flights again according to the instructions above.
This way, the Autotune will restart from the partially optimal values it found before the battery got depleted, instead of starting from scratch.
An example of the relevant `ATUN` message data of an interrupted yaw Autotune `.bin` dataflash log is depicted below:
![interrupted yaw Autotune ATUN messages](mp_autotune_yaw1.png)
The correspondence between the PIDs' initial values and the `ATUN` message fields is shown in the respective tables for each of the four Autotune axes in the sections below.
The tune of the vehicle must be done in the vehicle's most agile configuration.
That is, the vehicle will be at its minimum take-off weight with fully charged batteries.
This is why we will do Autotune with multiple flights, one axis per flight.
Typically the [quality of the Autotune results for each axis is proportional to the value](https://www.youtube.com/watch?v=1sCskKQIdeg) of the `ATC_ANG_RLL_P`, `ATC_ANG_PIT_P`, and `ATC_ANG_YAW_P` parameters for their respective axis.
Also the higher the values, the tighter the tune.
If you get low values, improve the hardware and revisit the previous sections to further reduce the vibrations.
Autotuning in low-wind conditions is desirable, but if that is not possible you can increase the `AUTOTUNE_AGGR` parameter value to 0.110 or even 0.120.
That is a workaround and will not produce as good results as low-wind conditions autotune.
We set up the autotune as a flight mode, and as such it will use the underlying `ALTHOLD` flight mode.
If you want to use the `LOITER` flight mode as the underlying mode during autotune you need to [set an RC channel function switch to autotune](https://ardupilot.org/copter/docs/autotune.html#setup-before-flying-in-autotune-mode).
Roll axis
1. Download the [28_autotune_roll_setup.param parameter file](diatone_taycan_mxc/params/28_autotune_roll_setup.param) to your PC and upload it to the flight controller.
It will activate the roll axis Autotune.
1. Outdoors on a non-windy day (or indoors in a big warehouse like we at IAV do) take off and fly in either [`AltHold`](https://ardupilot.org/copter/docs/altholdmode.html) or `Loiter` flight mode.
1. At about 2 meters high, select `Autotune` flight mode in the RC transmitter to engage Autotune.
1. Use the RC transmitter sticks to correct the vehicle position if it gets too high, too low or too close to obstacles.
1. Once the Autotune is completed, land and disarm the vehicle without changing the flight mode.
You should get something like the [29_autotune_roll_results.param parameter file](diatone_taycan_mxc/params/29_autotune_roll_results.param)
The autotune might have found a poor solution, here are some indicators of a poor tune: