For illustrative purposes, we will use the small 3’’ multicopter depicted above, but the tuning sequence we developed at IAV GmbH will work on almost any other multicopter. Parts of Section 1 and Sections 2 to 6 apply to all ArduPilot vehicles: ArduPlane, ArduRover, ArduBoat, ArduSub, ArduBlimp …
This method uses the latest available ArduPilot WebTools, some of the new features of ArduCopter 4.3 and above and best practices from the ArduPilot Community.
We will detail the firmware parameters to change, the sequence of how to change them, help you to find the value for each parameter, explain which test flights to conduct and the order in which to conduct them and help you document all your steps for traceability. This applies industry-proven software configuration management (SCM) techniques to tuning an ArduCopter vehicle. You will be able to tune multiple vehicles (think production line) using this method and still have individual traceability of each parameter change on each vehicle.
While choosing an Autopilot and other hardware components avoid these components
Use tools like ecalc for multirotor to find a suitable set of components to meet your needs.
To demonstrate how to methodically tune a ArduCopter vehicle we selected a small copter that we could fly and tune indoors. It uses the following components:
Type | Part |
---|---|
Frame | Diatone Taycan MX-C |
Flight Controller | Matek H743 SLIM V3 |
ESC | Mamba System F45_128k 4in1 ESC |
Motors | 4x T-Motor 15507 3800kv |
Propeller | 4x CineWhoop 3", 8-Blade |
BEC with voltage/current monitor | Holybro PM02 V3 |
Battery | SLS X-Cube 4S 1800mAh 40C/80C |
GNSS Receiver | Holybro H-RTK F9P Helical |
SDCard | Any FAT32 or exFAT formated fast Micro-SDCard > 8 GiB |
RC Receiver | TBS Crossfire Nano RX se |
RC Transmitter | Radiomaster TX16S with EdgeTx and Yaapu scripts |
Remote ID transmitter | Holybro Remote ID transmitter |
Your vehicle will be different as your application will have different requirements.
To configure and operate your vehicle you need at least these software:
Use Mission Planner to flash the latest stable ArduCopter, ArduPlane, ArduRover, ArduSub or ArduBlimp firmware for your flight controller.
The table bellow summarizes the software used in this guide. Download and install them as you progress in the guide.
Software | Version | Description |
---|---|---|
Mission Planner | latest beta | Ground control station (PC software) used for configuring and operating the vehicle |
ArduPilot Methodic Configurator | latest | A clear ArduPilot configuration sequence |
ArduCopter | 4.4.4 or 4.5.5 | Flight controller firmware |
BLHeliSuite32 | 32.9.06 | PC software to flash and configure ESCs with BLHeli_32 ARM firmware |
BLHeli_32 ARM | 32.8 | ESC firmware with Bidir Dshot support |
EdgeTx companion | 2.9.2 | PC software for configuring and updating EdgeTX based RC transmitters |
EdgeTx | 2.9.2 | Radiomaster TX16S firmware with touch screen support |
Yaapu scripts | 2023-11-08 | Display vehicle telemetry on the Radiomaster TX16S |
Simple text editor: Notepad++, nano or code | any | Allows editing plain text files without undesired text changes. Do not use microsoft word! |
MAVExplorer | latest | Analyze dataflash (.bin ) log files |
Scripted MagFit flightpath generation | latest | Lua script to generate a MagFit flight path |
ecalc for multirotor | online | Finds a suitable set of components that meet your needs |
ArduPilot Hardware Report | online | Provides an overview of connected hardware from a .bin log and visualization of sensor position offsets. |
ArduPilot Filter Review Tool | online | Aid in configuring and validating the Harmonic Notch filters |
ArduPilot Filter Analysis | online | Bode plot tool to give insight into gyro low-pass and notch filter attenuation and phase lag |
ArduPilot PID Review Tool | online | Review PID tune in the frequency domain. Step response estimate is generated. |
ArduPilot MAGFit in flight compass calibration | online | Do compass calibration using a flight log |
Ardupilot Log Viewer | online | Log viewer, analyzer and plotter. Can also do MagFit |
Add grid to image | online | Add a grid overlay to any image |
SketchAndCalc | online | Calculate areas |
The ArduPilot Methodic Configurator needs to know which components you used/plan to use and how you connected/plan to connect them to the flight controller (autopilot). It uses this information to automatically pre-select configuration settings relevant to your specific vehicle.
So, start the ArduPilot Methodic Configurator and input select a vehicle that resembles yours and input vehicle components and component connections information into the ArduPilot Methodic Configurator component editor window:
Create vehicle configuration directory from template
Save data and start configuration
button on the bottomIMU temperature calibration reduces the probability of Accel inconsistent and Gyro inconsistent errors and reduces the time required to arm the vehicle. IMU temperature calibration requires lowering the temperature of the autopilot (flight controller) to circa -20°C. That is harder to do once the autopilot is assembled inside the vehicle, hence it is done now.
02_imu_temperature_calibration_setup.param
on the Current intermediate parameter file: Combobox if not already selected.02_imu_temperature_calibration_setup.param
parameters’ New Value
and Change Reason
using the ArduPilot Methodic Configurator parameter editor and press Upload selected params to FC, and advance to next file
.No
and close the program.INS_TCALn_ENABLE
parameters. On completion, the INS_TCALn_ENABLE
parameters will change to 1 (enable) for each calibrated IMU..bin
log file in the micro SDcard from /APM/LOGS
to your PCYes
and point it to the .bin
file that you just downloaded.Upload selected params to FC, and advance to next file
.The graphic below depicts the accelerometer drift versus time and the board temperature versus time. The temperature curve, depicted in black, is logarithmic as expected. The other curves are smooth, proving that the flight controller was not moved in the process and the calibration is valid. As can be seen, before the calibration temperature changes caused a big change in accelerometer/gyro drift. After the calibration, temperature changes will cause no significant accelerometer/gyro drift changes.
Now that the optional IMU temperature calibration is done we must assemble and connect all components except the propellers.
Read the Multicopter hardware best-practices section again before assembling the vehicle.
If you changed the way the components are connected to the flight controller (FC), re-enter the updated information into ArduPilot Methodic Configurator component editor window.
Always connect the vehicle battery before connecting the USB cable (if you are using one) between the PC and the flight controller. Always disconnect the USB cable (if you are using one) between the PC and the flight controller before disconnecting the vehicle battery.
We connected the components as depicted below. The figure excludes the LiPo battery and the PM02 BEC with a voltage/current monitor.
Component | Flight controller connections |
---|---|
T-Motor F45 4in1 ESC V2 | G , G , Vbat , not Connected, S4 , S3 , S2 , S1 , Cur , Rx8 (SERIAL5) |
Holybro PM02 V3 | not connected, G , Vbat2 , Curr2 , not Connected, not Connected |
Holybro H-RTK F9P Helical | 5V , Tx2 , Rx2 , CL1 , DA1 , not connected, not connected, 3V3 , Buzz , G |
TBS Crossfire Nano RX se | G , 5V , Rx6 , Tx6 |
Follow mounting the autopilot documentation to determine the correct value of the AHRS_ORIENTATION parameter.
04_board_orientation.param
other steps will use other parameter files
04_board_orientation.param
on the Current intermediate parameter file: Combobox.04_board_orientation.param documentation
New Value
and Change Reason
to suit your requirements.
The Change Reason
field is extremely important because:
Upload selected params to FC, and advance to next file
button.In our setup, we use EdgeTX firmware on the RC transmitter.
Download and install EdgeTX Companion to your PC. Start it and configure it as depicted below.
After that, use a micro SDcard to update the firmware on the Radiomaster TX16S and copy the yaapu scripts to the /WIDGETS/yaapu
directory on the micro SDcard.
Once the RC transmitter is running EdgeTx you can load the Taycan MX-C EdgeTX configuration file into EdgeTX companion and upload it to the radio. Or simply copy only the settings that you require, EdgeTX companion is very flexible.
In our setup, we used an advanced RC receiver that cannot be fully configured using Mission Planner’s SETUP >> Mandatory Hardware >> Radio Calibration
menu.
Repeat the steps from Section 6.1.1 to edit and upload the 05_remote_controller.param
file
After that test the RC failsafe
The RC transmitter we used has a big color display where telemetry data is displayed, nevertheless, we use telemetry data for real-time flight monitoring with Mission Planner or QGroundControl.
Repeat the steps from Section 6.1.1 to edit and upload the 06_telemetry.param
file
Once this is operating we no longer need the USB connection to the vehicle. We can now use the telemetry connection instead.
In our setup, we used a Bi-directional Dshot ESC that cannot be fully configured using Mission Planner’s SETUP >> Mandatory Hardware >> Servo Output
menu.
Repeat the steps from Section 6.1.1 to edit and upload the 07_esc.param
file
The step above configured ESC communication pass-thru. In our vehicle, we use BLHeli_32 ARM ESC firmware. So we use BLHeliSuite32 Version 32.9.0.6 to configure the ESCs. Flash the Firmware version described in the table above. Configure the parameters to match the figures below.
https://youtu.be/7WeHTb7aBrE?si=gW9YbcQkZYK3DoNE
In our setup, the battery voltage is measured directly at the flight controller Vbat
pin and the current is measured at the 4-in1 ESC Curr
pin.
Repeat the steps from Section 6.1.1 to edit and upload the 08_batt1.param
file
To be on the safe side we used a Holybro PM02 as a redundant secondary voltage and current monitor. One other option would be the CBU 2-8s DroneCAN Battery Monitor and Current Sensor.
Repeat the steps from Section 6.1.1 to edit and upload the 09_batt2.param
file
GNSS receivers very often contain a magnetometer (compass) sensor. So they need to be configured before proceeding to the next step.
Repeat the steps from Section 6.1.1 to edit and upload the 10_gnss.param
file
Propeller size has a big influence on the vehicle dynamics, this adapts controller response to it.
Repeat the steps from Section 6.1.1 to edit and upload the 11_initial_atc.param
file
When asked Should the FC values now be copied to the 12_mp_setup_mandatory_hardware.param file? select No
and close the ArduPilot Methodic Configurator software.
Open Mission Planner, connect to the flight controller and select SETUP >> Mandatory Hardware
and work yourself through all the submenus as described below. DO NOT SKIP ANY STEP.
This relates to the FRAME_CLASS
and FRAME_TYPE
parameters.
Answer the questions that Mission Planner asks, select Add suggested settings for 4.0 and up (Battery failsafe and Fence) and upload the calculated parameters to the flight controller by pressing Upload to FC
.
Follow the ArduPilot wiki instructions and calibrate the accelerometers. For small vehicles use:
For very large vehicles:
Follow the ArduPilot wiki instructions and calibrate the compass(es). Disable internal compasses if the battery or power wires are close to the flight controller. Do not select Automatically learn offsets it makes little sense on a multicopter. And we will do in-flight MagFit later
If you have a large vehicle you might want to use large vehicle MagCal instead.
Follow the ArduPilot wiki instructions and calibrate the Remote Control. Turn on your RC Transmitter and move the sticks around. Make sure all transmitter channels move across their entire range.
Change the parameters according to your requirements.
Do not make changes here, these parameters will be set later on the Motor/Propeller order and direction test section
Define the flight modes you plan to use.
Do not use POSHOLD
, use LOITER
instead.
Both only work outdoors because they require a good GNSS signal quality with low variance.
If that is not possible, GPS glitches will occur and ALTHOLD
flight mode is recommended instead.
These are very important and can save your vehicle in case of failure.
Configure at least Radio Failsafe
, Battery Failsafe
and Geofence
This is just informational. No need to change anything.
Change the parameters according to your requirements.
The changes you did in the steps above have been stored in your vehicle. Most of the changed parameters are vehicle-instance specific and can not be reused between two vehicles, no matter how similar they are. Close Mission Planner.
Now do some general configuration
Yes
13_general_configuration.param
on the Current intermediate parameter file: Combobox.13_general_configuration.param documentation
New Value
and Change Reason
to suit your requirementsUpload selected params to FC, and advance to next file
button.For this test, you need to:
.bin
file you got in the previous section.It should look like the following picture. If it doesn’t, go back and perform the missing calibration(s).
Repeat the steps from Section 6.1.1 to edit and upload the 13_Logging.param
file
The table below explains which bit is responsible for which .bin
dataflash log message(s):
Message | description | Log rate | LOG_BITMASK | ||
---|---|---|---|---|---|
field name | bit | value | |||
SIDD | System ID data | SCHED_LOOP_RATE / 1 | ATTITUDE_FAST and ATTITUDE_MED | 1 and 0 | 3 |
SCHED_LOOP_RATE / 2 | ATTITUDE_FAST | 0 | 2 | ||
SCHED_LOOP_RATE / 4 | ATTITUDE_MED | 0 | 1 | ||
SCHED_LOOP_RATE / 8 | - | - | 0 | ||
SIDS | System ID settings | SCHED_LOOP_RATE / 1 | ATTITUDE_FAST and ATTITUDE_MED | 1 and 0 | 3 |
SCHED_LOOP_RATE / 2 | ATTITUDE_FAST | 0 | 2 | ||
SCHED_LOOP_RATE / 4 | ATTITUDE_MED | 0 | 1 | ||
SCHED_LOOP_RATE / 8 | - | - | 0 | ||
RATE | Desired and achieved vehicle attitude rates | SCHED_LOOP_RATE / 1 | ATTITUDE_FAST and ATTITUDE_MED | 1 and 0 | 3 |
SCHED_LOOP_RATE / 2 | ATTITUDE_FAST | 0 | 2 | ||
SCHED_LOOP_RATE / 4 | ATTITUDE_MED | 0 | 1 | ||
SCHED_LOOP_RATE / 8 | - | - | 0 | ||
ATSC | Scale factors for attitude controller | SCHED_LOOP_RATE / 1 | ATTITUDE_FAST and ATTITUDE_MED | 1 and 0 | 3 |
SCHED_LOOP_RATE / 2 | ATTITUDE_FAST | 0 | 2 | ||
SCHED_LOOP_RATE / 4 | ATTITUDE_MED | 0 | 1 | ||
SCHED_LOOP_RATE / 8 | - | - | 0 | ||
ATT | Canonical vehicle attitude | SCHED_LOOP_RATE | ATTITUDE_FAST | 0 | 1 |
10 Hz | ATTITUDE_MED | 1 | 2 | ||
IMU | Inertial Measurement Unit data | SCHED_LOOP_RATE | IMU_FAST and ATTITUDE_FAST | 18 and 0 | 262145 |
25 Hz | IMU | 7 | 128 | ||
GPS | Information received from GNSS systems attached to the autopilot | ~ 5 Hz | GPS | 2 | 4 |
GPA | GPS accuracy information | ||||
UBX1 | uBlox-specific GPS information (part 1) | ||||
UBX2 | uBlox-specific GPS information (part 2) | ||||
GRAW | Raw uBlox datas | ||||
GRXH | Raw uBlox data - header | ||||
GRXS | Raw uBlox data - space-vehicle data | ||||
TERR | Terrain database information | ||||
PM | autopilot system performance and general data dumping ground | 1 Hz | PM | 3 | 8 |
XKF0 | EKF3 beacon sensor diagnostics | 25Hz if ATTITUDE_FAST is set, else 10Hz | - | - | - |
XKF1 | EKF3 estimator outputs | ||||
XKF2 | EKF3 estimator secondary outputs | ||||
XKF3 | EKF3 innovations | ||||
XKF4 | EKF3 variances | ||||
XKF5 | EKF3 Sensor innovations (primary core) and general dumping ground | ||||
XKFS | EKF3 sensor selection | ||||
XKQ | EKF3 quaternion defining the rotation from NED to XYZ (autopilot) axes | ||||
XKV1 | EKF3 State variances (primary core) | ||||
XKV2 | more EKF3 State Variances (primary core) | ||||
XKT | EKF3 timing information | ||||
AHR2 | Backup AHRS data | ||||
POS | Canonical vehicle position | ||||
CTRL | Attitude Control oscillation monitor diagnostics | 10Hz | CTUN | 4 | 16 |
RFND | Rangefinder sensor information | ||||
PRX | Proximity Filtered sensor data | ||||
PRXR | Proximity Raw sensor data | ||||
BCN | Beacon information | ||||
CTUN | Control Tuning information | 100Hz | |||
PSCN | Position Control North | 10Hz | NTUN | 5 | 32 |
PSCD | Position Control Down | ||||
PSCE | Position Control East | ||||
RCIN | RC input channels to vehicle | 10Hz | RCIN | 6 | 64 |
RCI2 | (More) RC input channels to vehicle | ||||
RSSI | Received Signal Strength Indicator for RC receiver | ||||
VIBE | Processed (acceleration) vibration information | 10Hz | IMU or IMU_FAST or IMU_RAW | 19 or 18 or 7 | - |
CMD | Executed mission command information | on event | CMD | 8 | 256 |
MAVC | MAVLink command we have just executed | ||||
BAT | Gathered battery data | ?? | CURRENT | 9 | 512 |
BCL | Battery cell voltage information | ||||
MCU | MCU voltage and temperature monitoring | ||||
POWR | System power information | ||||
RCOU | Servo channel output values 1 to 14 | 10Hz | RCOUT | 10 | 1024 |
RCO2 | Servo channel output values 15 to 18 | ||||
RCO3 | Servo channel output values 19 to 32 | ||||
OF | Optical flow sensor data | ?? | OPTFLOW | 11 | 2048 |
PIDN | Proportional/Integral/Derivative gain values for North | SCHED_LOOP_RATE if ATTITUDE_FAST is set else 10Hz | NTUN and PID | 12 and 5 | 4128 |
PIDE | Proportional/Integral/Derivative gain values for East | ||||
PIDR | Proportional/Integral/Derivative gain values for Roll | SCHED_LOOP_RATE if ATTITUDE_FAST is set else 10Hz | PID | 12 | 4096 |
PIDP | Proportional/Integral/Derivative gain values for Pitch | ||||
PIDY | Proportional/Integral/Derivative gain values for Yaw | ||||
PIDA | Proportional/Integral/Derivative gain values for Altitude | ||||
MAG | Information received from compasses | ?? | COMPASS | 13 | 8192 |
CAM | Camera shutter information | on event | CAMERA | 15 | 32768 |
TRIG | Camera shutter information | ||||
MOTB | Motor mixer information | 10Hz | MOTBAT | 17 | 131072 |
ACC | IMU accelerometer data | SCHED_LOOP_RATE | IMU_RAW | 19 | 524288 |
GYR | IMU gyroscope data | ||||
VSTB | Motor mixer information | SCHED_LOOP_RATE | VIDEO_STABILISATION | 20 | 1048576 |
FTN | Filter Tuning Message - per motor | SCHED_LOOP_RATE | FTN_FAST | 21 | 2097152 |
FTNS | Filter Tuning Message | ||||
FTN1 | FFT Filter Tuning | 25 Hz | |||
WINC | Winch | 10Hz | Any | any | any |
Start by checking the motor numbering with the Mission Planner Motor test without propellers. Remember the correct order is A, B, C, D and not 1, 2, 3, 4.
Make sure the MOT_SPIN_ARM
is high enough so that all motors spin reliably.
Make sure the MOT_SPIN_MIN
is at least 0.03 higher than MOT_SPIN_ARM
.
!!! If you get this test wrong or skip it, you might destroy your vehicle and endanger yourself !!!
Do not try to test the attitude controller without propellers, it will not work, such tests are inconclusive and meaningless. Do not try to test the attitude controller with the vehicle tied down on the ground, it will not work, such tests are inconclusive and meaningless. At this point, the vehicle does not react to roll, pitch, yaw or thrust inputs.
Now mount the propellers on the vehicle.
After that, follow the setting Motor Range to adjust the motor demand by the flight controller to the limitations of the ESC.
These three parameters linearize (correct) the non-linear thrust vs. PWM response of the propulsion system (battery, ESC, motors, propellers). They are crucial for the stability of the vehicle. If this is set too high we see an increase in gain at the lower end of the thrust range and a decrease in gain at the upper end.
Therefore when set too high you can see instability at low throttle and if set too low you can see instability at high throttle.
The automation on SETUP >> Mandatory Hardware >> Initial Tune Parameters
gave you a good starting point on their values.
But we recommend using a Trust Stand or Olliw method or ArduPilot DIY Thrust Stand to determine their value.
At the time of writing Automatic MOT_THST_EXPO
estimation lua script is not yet ready for production use.
We used an oversized test stand to test the motors. Since the test stand was too big for a single motor we tested all four motors at once. This was our setup:
![motor_test_stand_with_drone_cropped | 316x499](/MethodicConfigurator/images/blog/motor_test_stand_with_drone_cropped.jpg) |
We fixed and updated Cell G8 as well as the plot’s Data range of the original ArduPilot Wiki Spreadsheet creating this corrected version
We imported the data into the spreadsheet and created this graph:
![motor_thrust_chart | 690x389](/MethodicConfigurator/images/blog/motor_thrust_chart.PNG) |
Repeat the steps from Section 6.1.1 to edit and upload the 15_motor.param
file
If you have a very small, or a very large vehicle that requires non-default PID values for a safe flight. Usually, smaller vehicles require lower than default PID rate values. Larger vehicles usually require higher than default PID rate values.
Repeat the steps from Section 6.1.1 to edit and upload the 16_pid_adjustment.param
file
Read and follow ArduPilot’s Remote ID setup instructions. You might have to build OpenDroneID firmware for production.
Repeat the steps from Section 6.1.1 to edit and upload the 17_remote_id.param
file
Configure the gyro noise reduction notch filters with an estimation of the operation parameters. The estimation will be improved after the first flight.
Repeat the steps from Section 6.1.1 to edit and upload the 18_notch_filter_setup.param
file
When asked Should the FC values now be copied to the 19_notch_filter_results.param file? select No
and close the ArduPilot Methodic Configurator software.
Assemble the propellors in the vehicle ensuring that they are balanced in order to reduce vibrations. High vibrations will cause your vehicle to behave eradicaly endangering people and property.
Now that all mandatory configuration steps are done and the props are on you can perform the first flight.
For more detailed information visit the First flight
Test the initial setup on the ground in stabilize flight mode by using as little RC transmitter throttle as possible without taking off. At this sweet spot, inspect all axes (roll, pitch and yaw) by providing small RC transmitter stick inputs. If the multicopter behaves correspondingly, the setup is good to go.
After some careful test maneuvers switch to ALTHOLD
and hover for 30 to 40 seconds one to two meters above the ground. Land and disarm.
Immediately check for hot motors.
If the motors are too hot, check the .bin
dataflash log, high or oscillating RATE.*out
values indicate which PID gain you should reduce to remove the output oscillations causing the motors to heat up.
These are the very minimum tuning steps required for a stable flight:
Load the .bin
log from the first flight onto the online Ardupilot Filter Review tool
Follow the instructions from Peter Hall on his Blog Post to configure the Harmonic Notch filter(s).
The graph below is a bode diagram of the gyro signals before and after the low-pass and Harmonic Notch filters.
As you can see, the filters remove most of the vibration noise from the gyro sensors.
Below is the configuration we used.
19_notch_filter_results.param
on the Current intermediate parameter file: Combobox.No
.19_notch_filter_results.param documentation
New Value
and Change Reason
to suit your requirementsUpload selected params to FC, and advance to next file
button.Load the .bin
log from the first flight onto the online Ardupilot Log Viewer or into Mission Planner.
Take a look at the VIBE.VibeX
, VIBE.VibeY
, VIBE.VibeZ
graphs they all should be below 15
According to common ArduPilot forum knowledge, and quoting @xfacta:
Now upload the .bin
log to the Hardware-Report Tool once again to check CPU load and loop times, which in our case look like this:
Use the .bin
log from the first flight to set the parameters described on the 20_throttle_controller.param
file.
In some situations you will need to configure the expected noise levels of the altitude sources.
And the weight that EKF should use for each source on the 23_ekf_config.param
file.
If your flight controller can run lua scripts perform a PID lua VTOL-Quicktune. If you have an STM32 F4 or F7 processor that can not run lua scripts perform a manual PID tune instead.
Setup the lua script using:
22_quicktune_setup.param
on the Current intermediate parameter file: Combobox.22_quicktune_setup.param documentation
New Value
and Change Reason
to suit your requirementsUpload selected params to FC, and advance to next file
button.Perform the flight and afterward:
23_quicktune_results.param
on the Current intermediate parameter file: Combobox.Yes
.Upload selected params to FC, and advance to next file
button.If you are impatient and do not want a fully optimized flight controller jump to Section 13 Productive configuration
These are the standard tuning steps required for an optimized flight:
Now that the Harmonic Notch filter, the throttle controller and PIDs are configured, the third flight will be safer. This flight will be used to calibrate the compass during a realistic operation scenario in the air.
Follow these steps before the flight:
advance-wp.lua
scripts from ardupilot github repository, follow Scripted MagFit flightpath generation and put it on the micro SDCard’s APM/scripts
folder.24_inflight_magnetometer_fit_setup.param
on the Current intermediate parameter file: Combobox.24_inflight_magnetometer_fit_setup.param documentation
New Value
and Change Reason
to suit your requirementsUpload selected params to FC, and advance to next file
button.No
.Perform the MagFit figure-eight flight and land
.bin
dataflash log file from the micro SDcard’s /APM/LOGS
folderMAVExplorer.py filename.bin
or into the ArduPilot MAGFit in flight compass calibration using an internet browser.25_inflight_magnetometer_fit_results.param
in your vehicle’s intermediate parameter file directory.25_inflight_magnetometer_fit_results.param
on the Current intermediate parameter file: Combobox.Yes
.Upload selected params to FC, and advance to next file
button.After that repeat the steps described in Section 6.11 ArduPilot Hardware Report.
The report should now look like this:
If your flight controller can run lua scripts perform a PID lua VTOL-Quicktune. If you have an STM32 F4 or F7 processor that can not run lua scripts perform a manual PID tune instead.
Setup the lua script using:
24_quicktune_setup.param
on the Current intermediate parameter file: Combobox.24_quicktune_setup.param documentation
New Value
and Change Reason
to suit your requirementsUpload selected params to FC, and advance to next file
button.No
.Perform the flight and afterward:
25_quicktune_results.param
on the Current intermediate parameter file: Combobox.Yes
.Upload selected params to FC, and advance to next file
button.If you are impatient and do not want a fully optimized flight controller jump to Section 13 Productive configuration
Follow the first part of evaluating the aircraft tune.
28_evaluate_the_aircraft_tune_ff_disable.param
on the Current intermediate parameter file: Combobox.28_evaluate_the_aircraft_tune_ff_disable.param documentation
Upload selected params to FC, and advance to next file
button.After landing take a look at the RATE.*out
values in the .bin
log file, they all should be below 0.1.
If the vehicle is not behaving well, perform a manual PID tune or a lua Quicktune before proceeding.
Follow the second part of evaluating the aircraft tune.
29_evaluate_the_aircraft_tune_ff_enable.param
on the Current intermediate parameter file: Combobox.29_evaluate_the_aircraft_tune_ff_enable.param documentation
Upload selected params to FC, and advance to next file
button.After landing take a look at the RATE.*out
values in the .bin
log file, they all should be below 0.1.
The Autotune is an automated iterative process:
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:
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 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.
Follow the sequence below for tuning each axis as that particular order improves the results.
30_autotune_roll_setup.param
and upload it to the FC. It will activate the roll axis Autotune.No
.AltHold
or Loiter
flight mode.Autotune
flight mode in the RC transmitter to engage Autotune.31_autotune_roll_results.param
.Yes
.The autotune might have found a poor solution, here are some indicators of a poor tune:
ATC_ANG_RLL_P
parameter value is smaller than 4.5ATC_RAT_RLL_D
parameter value is equal to the AUTOTUNE_MIN_D
parameter valueIf the battery got depleted before Autotune completion, change the initial PID parameters as shown in the table below:
PID parameter name | PID parameter value based on the ATUN field |
---|---|
- | ATUN.Axis=0 |
ATC_RAT_RLL_P | ATUN.RP |
ATC_RAT_RLL_I | ATUN.RP |
ATC_RAT_RLL_D | ATUN.RD |
ATC_ANG_RLL_P | ATUN.SP |
ATC_ACCEL_R_MAX | ATUN.ddt |
32_autotune_pitch_setup.param
and upload it to the FC. It will activate the pitch axis Autotune.No
.AltHold
or Loiter
flight mode.Autotune
flight mode in the RC Transmitter to engage Autotune.33_autotune_pitch_results.param
.Yes
.The autotune might have found a poor solution, here are some indicators of a poor tune:
ATC_ANG_PIT_P
parameter value is smaller than 4.5ATC_RAT_PIT_D
parameter value is equal to the AUTOTUNE_MIN_D
parameter valueIf the battery got depleted before Autotune completion, change the initial PID parameters as shown in the table below:
PID parameter name | PID parameter value based on the ATUN field |
---|---|
- | ATUN.Axis=1 |
ATC_RAT_PIT_P | ATUN.RP |
ATC_RAT_PIT_I | ATUN.RP |
ATC_RAT_PIT_D | ATUN.RD |
ATC_ANG_PIT_P | ATUN.SP |
ATC_ACCEL_P_MAX | ATUN.ddt |
34_autotune_yaw_setup.param
file to the FC. It will activate the yaw axis Autotune.AltHold
or Loiter
flight mode.Autotune
flight mode in the RC transmitter to engage Autotune.You should get something like the 35_autotune_yaw_results.param
file.
The autotune might have found a poor solution, here are some indicators of a poor tune:
ATC_ANG_YAW_P
parameter value is smaller than 4.5If the battery got depleted before Autotune completion, change the initial PID parameters as shown in the table below:
PID parameter name | PID parameter value based on the ATUN field |
---|---|
- | ATUN.Axis=2 |
ATC_RAT_YAW_P | ATUN.RP |
ATC_RAT_YAW_I | ATUN.RP * 0.1 |
ATC_RAT_YAW_FLTE | ATUN.RD |
ATC_ANG_YAW_P | ATUN.SP |
ATC_ACCEL_Y_MAX | ATUN.ddt |
This particular YawD
Autotune axis is only relevant for small, agile vehicles.
36_autotune_yawd_setup.param
file to the FC.AltHold
or Loiter
flight mode.Autotune
flight mode in the RC transmitter to engage Autotune.You should get something like the 37_autotune_yawd_results.param
file.
Make sure that your resulting ATC_RAT_YAW_D
parameter value is different from AUTOTUNE_MIN_D
value.
If that is not the case then the autotune failed to find a proper ATC_RAT_YAW_D
.
The cause is probably too high noise values at the input of the Yaw D controller.
If the battery got depleted before Autotune completion, change the initial PID parameters as shown in the table below:
PID parameter name | PID parameter value based on the ATUN field |
---|---|
- | ATUN.Axis=3 |
ATC_RAT_YAW_P | ATUN.RP |
ATC_RAT_YAW_I | ATUN.RP * 0.1 |
ATC_RAT_YAW_D | ATUN.RD |
ATC_ANG_YAW_P | ATUN.SP |
ATC_ACCEL_Y_MAX | ATUN.ddt |
Now that the yaw axis is tuned, the autotune should be able to improve the roll and pitch axis tune.
38_autotune_roll_pitch_retune_setup.param
file to the FC.AltHold
or Loiter
flight mode.Autotune
flight mode in the RC transmitter to engage Autotune.You should get something like the 39_autotune_roll_pitch_retune_results.param
file.
As you can see in the picture below, the Stabilize Roll, Pitch and Yaw P gains achieved with this method are high. The maximum stabilize P gain that autotune strives for is 36, and that was achieved in the roll axis! This is a clear indication that the vibration noise filters and the PID control loops are working well together.
After using Autotune to find proper PID parameters, it is time to evaluate the performance of the vehicle’s control loops in real flight.
Follow these steps:
28_evaluate_the_aircraft_tune_ff_disable.param
file to the FC.ALTHOLD
flight mode and wait for home location acquisition..bin
log file from /APM/LOGS
to your PC29_evaluate_the_aircraft_tune_ff_enable.param
file to the FC.In our vehicle, we got a transient response of around 60ms in roll and pitch and around 110ms in yaw.
Step response Roll:
Step response Pitch:
Step response Yaw:
If you are satisfied with the performance, increase ATC_THR_MIX_MAX
to 0.9 (default is 0.5) to increase prioritization of attitude control over throttle.
This can reduce the pitch overshoot sometimes seen (especially on copters with large propellers) in AltHold if the vehicle suddenly slows after performing a fast-forward flight.
Take a look at the RATE.*out
values in the .bin
log file, they all should be below 0.1.
Now the standard tuning is complete you can skip to Section 13 Productive Configuration
Follow ArduCopter’s airspeed estimation Wiki and/or use the Lua script provided by Yuri in the forum.
In our case, the frontal area looks like this:
and the side area looks like this:
Divided by 1,000,000 to convert from mm² to m², the frontal area is 0.01097 m² and the side area is 0.01455 m². The weight of our drone is 560g, therefore the ballistic coefficients are
Use ArduPilot Methodic Configurator to edit and upload the 40_windspeed_estimation.param
file to the FC.
Now do the flight to collect the data to Calculate the Propeller Drag Coefficient.
After that, open the logs with MAVExplorer to get the needed values.
Display the absolute values for acceleration in X and Y, as well as GPS speed by inputting graph abs(IMU.AccX) abs(IMU.AccY) GPS.Spd
.
Then crop it so you only see the tests in AltHold flight mode.
It should look like this:
Note that our test flight was quite noisy but there is enough data to extract. Next crop it so you see one acceleration into the wind and the consecutive deceleration. It should look like this:
Get the current wind speed, that is the GPS speed when AccY reaches zero and the GPS speed has stabilized. In this case, it is:
Next, get the groundspeed at the start of the test. That is the GPS speed when the vehicle starts to decelerate after the little bit of jitter is over. In this case, it is:
With this information, you can calculate the vehicle’s airspeed, which is:
Next get the maximum acceleration during the test, which is the acceleration at the time of the groundspeed measurement. In this case, it is:
With the air density at the time of testing and the previously calculated ballistic drag coefficient (EK3_DRAG_BCOEF_X
for front and back, EK3_DRAG_BCOEF_Y
for left and right side) you can now calculate the bluff body drag, which is 1/2 * air density * airspeed^2 / BCOEF.
In this case, it is:
With that, you can now calculate the momentum drag, which is max_accel - bluff body drag. In this case, it is:
Now you can calculate the momentum drag coefficient EK3_DRAG_MCOEF
, which is momentum drag / airspeed.
In this case, it is:
For better accuracy, you should do that for all directions and take the average. In our case, we got:
Note that these are quite high values due to the ducts around the props. For a normal copter with open propellers, it should be in the range of 0.1 to 0.2.
After it is set, do another flight and check that the windspeed and direction are correctly estimated.
Follow ArduCopter’s baro compensation Wiki and/or use the Lua script provided by Yuri in the forum.
Use ArduPilot Methodic Configurator to edit and upload the 41_barometer_compensation.param
file to the FC.
Now do the flight to collect the data and analyze the logs to see if the barometer is correctly compensated and insensitive to wind.
These steps are optional. Their goal is to build a mathematical model of the vehicle that can later be used to further optimize the control loops of the vehicle according to a set of constraints (requirements).
Documentation is available on Fabian Bredemeier’s Identification of a multicopter section at ArduCopter’s_wiki.
Use ArduPilot Methodic Configurator to edit and upload the 42_system_id_roll.param
file to the FC.
Now do the flight to collect the data for the roll rate system identification.
Use ArduPilot Methodic Configurator to edit and upload the 43_system_id_pitch.param
file to the FC.
Now do the flight to collect the data for the pitch rate system identification.
Use ArduPilot Methodic Configurator to edit and upload the 44_system_id_yaw.param
file to the FC.
Now do the flight to collect the data for the yaw rate system identification.
Use ArduPilot Methodic Configurator to edit and upload the 45_system_id_thrust.param
file to the FC.
Now do the flight to collect the data for the thrust system identification.
This describes how to use IAV’s multi-objective optimization to achieve even better (according to a predefined set of constraints) PID tuning.
One other approach is described by Bill Geyer in his Blog post: Predicting Closed Loop Response For Faster Autotune.
Use ArduPilot Methodic Configurator to edit and upload the 46_analytical_pid_optimization.param
file to the FC.
The most inner angle rate and angle control loops have been tuned. Now let’s tune the position controller.
Use ArduPilot Methodic Configurator to edit and upload the 47_position_controller.param
file to the FC.
These are optional, and only make sense if you do beyond visual line-of-sight (BVLOS) autonomous flights using a companion computer.
Use ArduPilot Methodic Configurator to edit and upload the 48_guided_operation.param
file to the FC.
These are optional, and only make sense if you have extra hardware on your vehicle to support it.
Use ArduPilot Methodic Configurator to edit and upload the 49_precision_land.param
file to the FC.
Some changes should be made for everyday productive operation.
Use ArduPilot Methodic Configurator to edit and upload the 53_everyday_use.param
file to the FC.
We presented a sequence of small, methodic steps that result in a fully operational and safe drone. Beginning with informed hardware decisions, appropriate hardware configuration and concluding with a finely tuned vehicle equipped with robust, fast-acting control loops. Each step is documented in its own intermediate parameter file, ensuring reproducibility and traceability. Each file is numbered, ensuring that the sequence of steps is clear. The number of test flights was reduced to a minimum, and their order was optimized. This process was developed for our specific multicopter, but it can be tailored to any other ArduPilot vehicle.
PID controller | Intermediate parameter file(s) used to configure and tune it |
---|---|
Position Z acceleration | 20_throttle_controller.param |
Roll rate | 31_autotune_roll_results.param , 39_autotune_roll_pitch_retune_results.param |
Pitch rate | 33_autotune_pitch_results.param , 39_autotune_roll_pitch_retune_results.param |
Yaw rate | 35_autotune_yaw_results.param , 37_autotune_yawd_results.param |
Roll | 31_autotune_roll_results.param , 39_autotune_roll_pitch_retune_results.param |
Pitch | 33_autotune_pitch_results.param , 39_autotune_roll_pitch_retune_results.param |
Yaw | 35_autotune_yaw_results.param , 37_autotune_yawd_results.param |
Position XY velocity | 47_position_controller.param |
Many thanks to the ArduPilot’s developers and community.
This work has been sponsored by the company I work for IAV GmbH. We provide engineering and consulting for robotic systems including multicopters. Feel free to contact us for help or development support.
Your vehicle is now properly tuned according to AduPilot’s standard procedures and some of IAV GmbH’s know-how.
Enjoy,
Jan Ole Noack
Amilcar do Carmo Lucas