-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Tune INAV PID‐FF controller for fixedwing
When tuned correctly, the FF-gain should do most of the work of turning the airplane. Which leaves Proportional, Integral and Derivative to make up for slight target error and drift caused by turbulence.
- Manually tuning Rates and Feedforward - How it works
- General ACRO PID tuning
- Tuning ANGLE mode
- LEVEL controller
- Fixedwing I-term Lock
Note
Do not underestimate the importance of correctly tuning the stabilization RATES and FEEDFORWARDS to suit your airplanes requirements.
Passing the angular rate target directly to the servo mixer, can reduce control processing delay. But if the Rates and Feedforwards are incorrectly tuned, it can instead add extra PID processing time, thus reducing stabilization effectiveness in all flight modes, including navigation modes.
Tuning of the Rates and Feedforwards can be done more easily via AutoTune, provided it's performed correctly.
However tuning can also be done manually as explained below.
While in the process of flying manually. It is beneficial at this time to run Servo Autotrim.
Tip
Ensure the control surface servo throws are set correctly before you tune the Rates and Feedforwards manually, or by the Autotune process.
Any adjustments made to the servo Mixer or Output travels after you have tuned the Rates and Feedforwards, will negatively effect performance. Requiring you to run the tuning process again.
In addition Fixedwing Airmode can be enabled with ACRO
mode. Do this before tuning, because the airplane will react differently to the Integral term.
-
Fly in
MANUAL
mode with themanual_roll_rate
,manual_pitch_rate
andmanual_yaw_rate
settings set to 100%.
Record DVR footage of the flight, and enable the blackbox to log flight data.
Perform hard rolls, hard loops and one 360° yaw turn. Apply full stick deflection for as long as possible throughout these maneuvers. -
To calculate an axis (approximate) rate from a DVR recording, you'll need to count the number of frames it took for your aircraft to do a complete maneuver (roll/flip/yaw turn), determined by the average FPS of the recording. Then use this formula :
360 / (number_of_frames / FPS)
.
You can take multiples samples and average them for better accuracy.
You can also use a Python script to help automate the process. -
Typical starting values for Rates, that are suitable for most airplanes are -
Roll = 300°/s
Pitch = 110°/s
Yaw = 70°/s -
Zero out P, I and D gains on the Roll, Pitch and Yaw controllers.
-
Set
tpa_rate = 0
-
Increase FF-gain until you get 90% of full servo throw when having sticks at full throw in
ACRO
mode, when compared toMANUAL
mode. -
This is so the FF-gain does most of the work turning the airplane, but leaving some for the P and I gain to work with.
-
For this step it's convenient to have the two modes
MANUAL
andACRO
available on a switch, so you can easily move between the two, and compare the throws. -
The 90% deflection value can also be calculated by dividing 13950 by the maximum rate for the axis. e.g. 360deg/s maximum roll
13950 / 360 = 38.75
FF. For 80% deflection, divide 12400 by the rate. -
Now set some P and I gain as a starting point.
fw_p_pitch = 6
fw_i_pitch = 8
fw_p_roll = 7
fw_i_roll = 12
fw_p_yaw = 10
fw_i_yaw = 3
This topic includes some non conventional means of tuning. However, things don't always work as theory dictates for fixedwing operation when the system still has missing components. e.g. true air speed based PIDFF attenuation.
Other settings which can influence the tune are -
-
Looptime can influence PID tuning. It is recommended to tune with the specific loop rate you choose, and not change once tuned. Higher looptime will allow the I-term to respond faster to the error, both in accumulating it (windup) and in correcting for overshoot of the error (unwind).
-
Gyro_main_lpf_hz can reduce axis jitter if set lower, by reducing the update rate.
I-term:
If the airplane drifts slightly from center on an axis, once Autotune, AutoLevel and Servo_Autotrim are complete. Increasing the I-gain on that given axis, can reduce the effect.
After Feedforward, allowing I-gain to do a little more work than the P-gain. Can actually make the Roll axis response smoother from an FPV perspective; than fighting a loosing battle by applying too much P-gain, in hopes of removing roll axis wobbles.
Be cautious. Too much I-gain can also cause oscillation. Values should be limited in the mid teens. Accounting for the use of pid_iterm_limit_percent and Fixedwing I-term Lock mentioned below.
P-term:
If you want more stabilization against hard buffeting from the wind, try increasing the P-gain. But only up to a point.
Too much P-gain can cause oscillations as the air-speed increases. This is when you want to apply some Fixedwing TPA.
P-term will never be able to fully correct for fixedwing roll axis instability at lower airspeeds, due to processing and SERVO reaction lag. And there won't be enough air flow over the surfaces to provide the optimal stabilization response required. It can often be a case of what you prefer on the Roll axis. i.e. Faster jittering from higher P-gain. Or slower mellow movements from higher I-gain.
D-term:
Once the P-gain it tuned to about 80% of its optimal, at a given air speed. Then start applying some D-gain in small amounts, to add axis damping.
After manually tuning your Rates and Gains. You can reduce them from their limit, to what suits your stick feel and flight requirements.
It's normal to see reduced servo throw's when reducing rates at this point. If you have full servo throw at this stages you would likely overshoot the target deg/s as well, leaving the P-term to do the rest.
-
Auto Level Trim should be used for the purpose of tuning the flight inclination level of the wing, comparing to the Flight Controller boards mounting angle.
However it can also be fine tuned manually if desired. EnterANGLE
mode. And check if your aircraft fly's straight and level, without climbing or diving slightly. If it doesn't fly level, your FC is probably not mounted flat relative to the aircraft's Angle of Incidence when flying. You can adjust it with fw_level_pitch_trim.
Adjusting the board's alignment viaalign_board_roll
,align_board_pitch
can also work, but is not recommended. -
If the Roll/Pitch bank angles are too low for your taste, you can adjust them via the
max_angle_inclination_rll
andmax_angle_inclination_pit
. This will provide greater authority on both axis's, within the full stick deflection range.
If you want the same amount of bank angle in navigation modes, you will also need to increase their values vianav_fw_bank_angle
,nav_fw_climb_angle
,nav_fw_dive_angle
. However, keep in mindnav_fw_bank
angles can not be set greater thanmax_angle_inclination
.
- If you're unhappy with the strength ANGLE based modes return back to level, after the stick is released. You can adjust the P-gain via
fw_p_level
. The default value of 20 is optimal. However reducing it can provide a smoother feel.
While increasing this value beyond 30 on a fixedwing; generally makes the corresponding axis more jittery when trying to maintain a level attitude in turbulent conditions. -
fw_i_level
works as a Low Pass Filter for the LEVEL controllers update rate. Any value greater than 5, is faster than most fixedwings can respond to attitude level correction. Reducing it in some cases to 3 or 2, can help provide a smoother feel. -
fw_d_level
uses the present rate target and the calculated angle rate target. Which allows for transition between ANGLE (level) and ACRO (rate), to provide HORIZON mode.
When tuning this value. Increase or decrease the setting according to the stick position you want transition to occur. Generally it is better to have transition occur near full stick deflection. Meaning, it's your intent to perform an aerobatic maneuver.
Version 8.0 and later
This feature solves the problem of I-term accumulation and bounce-back on a Fixedwing platform, when the stick is quickly release back to center, and the airplane still has angular momentum on that axis.
When the pilot moves the sticks, the following happens:
-
P-term and D-term are attenuated with a bell curve. With no attenuation at stick-center, and full attenuation when
fw_iterm_lock_rate_threshold
is met. Its value is a percentage of the maximum axis rotation rate. -
When the rate error rises greater than the
fw_iterm_lock_engage_threshold
10% (default). And that error keeps climbing untilfw_iterm_lock_rate_threshold
reaches 40% (default). Then the I-term will become fully attenuated, until the Gyro rate error drops below thefw_iterm_lock_engage_threshold
again. Or thefw_iterm_lock_time_max_ms
expires. -
FF-term is never attenuated. As a result, the airplane feels fully stabilized near stick center, and performs like Manual mode when executing fast maneuvers.
The default settings work fine.
But if you require less attenuation at a higher rate of axis rotation; fw_iterm_lock_rate_threshold can be increased. For example, in the case of 3D airplanes that uses the I-term to help hold axis attitude.
Or on air frames that carry more axis angular momentum, like those with a very high rotation rate or higher wing mass, fw_iterm_lock_engage_threshold can be decreased, or you could add more time to fw_iterm_lock_time_max_ms.
- Information on FW navigation tuning can be found here - Navigation PID tuning. This is the place to look if you encounter wandering left or right of the heading target. Or oscillations on the pitch axis while attempting to hold altitude.
INAV Version Release Notes
8.0.0 Release Notes
7.1.0 Release Notes
7.0.0 Release Notes
6.0.0 Release Notes
5.1 Release notes
5.0.0 Release Notes
4.1.0 Release Notes
4.0.0 Release Notes
3.0.0 Release Notes
2.6.0 Release Notes
2.5.1 Release notes
2.5.0 Release Notes
2.4.0 Release Notes
2.3.0 Release Notes
2.2.1 Release Notes
2.2.0 Release Notes
2.1.0 Release Notes
2.0.0 Release Notes
1.9.1 Release notes
1.9.0 Release notes
1.8.0 Release notes
1.7.3 Release notes
Older Release Notes
QUICK START GUIDES
Getting started with iNav
Fixed Wing Guide
Howto: CC3D flight controller, minimOSD , telemetry and GPS for fixed wing
Howto: CC3D flight controller, minimOSD, GPS and LTM telemetry for fixed wing
INAV for BetaFlight users
launch mode
Multirotor guide
YouTube video guides
DevDocs Getting Started.md
DevDocs INAV_Fixed_Wing_Setup_Guide.pdf
DevDocs Safety.md
Connecting to INAV
Bluetooth setup to configure your flight controller
DevDocs Wireless Connections (BLE, TCP and UDP).md\
Flashing and Upgrading
Boards, Targets and PWM allocations
Upgrading from an older version of INAV to the current version
DevDocs Installation.md
DevDocs USB Flashing.md
Setup Tab
Live 3D Graphic & Pre-Arming Checks
Calibration Tab
Accelerometer, Compass, & Optic Flow Calibration
Alignment Tool Tab
Adjust mount angle of FC & Compass
Ports Tab
Map Devices to UART Serial Ports
Receiver Tab
Set protocol and channel mapping
Mixer Tab
Set aircraft type and how its controlled
Outputs Tab
Set ESC Protocol and Servo Parameters
Modes Tab
Assign flight modes to transmitter switches
Standard Modes
Navigation Modes
Return to Home
Fixed Wing Autolaunch
Auto Launch
Configuration Tab
No wiki page currently
Failsafe Tab
Set expected behavior of aircraft upon failsafe
PID Tuning
Navigation PID tuning (FW)
Navigation PID tuning (MC)
EZ-Tune
PID Attenuation and scaling
Tune INAV PID-FF controller for fixedwing
DevDocs Autotune - fixedwing.md
DevDocs INAV PID Controller.md
DevDocs INAV_Wing_Tuning_Masterclass.pdf
DevDocs PID tuning.md
DevDocs Profiles.md
OSD and VTx
DevDocs Betaflight 4.3 compatible OSD.md
OSD custom messages
OSD Hud and ESP32 radars
DevDocs OSD.md
DevDocs VTx.md
LED Strip
DevDocs LedStrip.md
Programming
DevDocs Programming Framework.md
Adjustments
DevDocs Inflight Adjustments.md
Mission Control
iNavFlight Missions
DevDocs Safehomes.md
Tethered Logging
Log when FC is connected via USB
Blackbox
DevDocs Blackbox.md
INAV blackbox variables
DevDocs USB_Mass_Storage_(MSC)_mode.md
CLI
iNav CLI variables
DevDocs Cli.md
DevDocs Settings.md
VTOL
DevDocs MixerProfile.md
DevDocs VTOL.md
TROUBLESHOOTING
"Something" is disabled Reasons
Blinkenlights
Sensor auto detect and hardware failure detection
Pixel OSD FAQs
TROUBLESHOOTING
Why do I have limited servo throw in my airplane
ADTL TOPICS, FEATURES, DEV INFO
AAT Automatic Antenna Tracker
Building custom firmware
Default values for different type of aircrafts
Features safe to add and remove to fit your needs.
Developer info
INAV MSP frames changelog
INAV Remote Management, Control and Telemetry
Lightweight Telemetry (LTM)
Making a new Virtualbox to make your own INAV
MSP Navigation Messages
MSP V2
OrangeRX LRS RX and OMNIBUS F4
Rate Dynamics
Target and Sensor support
Ublox 3.01 firmware and Galileo
DevDocs Controls
DevDocs 1wire.md
DevDocs ADSB.md
DevDocs Battery.md
DevDocs Buzzer.md
DevDocs Channel forwarding.md
DevDocs Display.md
DevDocs Fixed Wing Landing.md
DevDocs GPS_fix_estimation.md
DevDocs LED pin PWM.md
DevDocs Lights.md
DevDocs OSD Joystick.md
DevDocs Servo Gimbal.md
DevDocs Temperature sensors.md
OLD LEGACY INFO
Supported boards
DevDocs Boards.md
Legacy Mixers
Legacy target ChebuzzF3
Legacy target Colibri RACE
Legacy target Motolab
Legacy target Omnibus F3
Legacy target Paris Air Hero 32
Legacy target Paris Air Hero 32 F3
Legacy target Sparky
Legacy target SPRacingF3
Legacy target SPRacingF3EVO
Legacy target SPRacingF3EVO_1SS
DevDocs Configuration.md
Request form new PRESET
DevDocs Introduction.md
Welcome to INAV, useful links and products
iNav Telemetry
UAV Interconnect Bus
DevDocs Rangefinder.md
DevDocs Rssi.md
DevDocs Runcam device.md
DevDocs Serial.md
DevDocs Telemetry.md
DevDocs Rx.md
DevDocs Spektrum bind.md
DevDocs INAV_Autolaunch.pdf