-
Notifications
You must be signed in to change notification settings - Fork 1.7k
PID Attenuation and scaling
This topic covers methods used to dynamically adjust your models PID gains, to prevent control oscillations as the models airspeed changes throughout the flight.
Multiple methods are used to accomplish this. Depending on whether it's a multicopter or fixedwing platform.
-
Multicopter TPA - Throttle PID Attenuation
-
Fixedwing APA - AirSpeed PID Attenuation and boost (INAV 9.0)
-
Fixedwing TPA and Pitch Angle - Throttle and Pitch Angle PID Attenuation and boost (INAV 9.0)
-
Fixedwing TPA - Throttle PID Attenuation and boost (Pre INAV 9.0)
Settings :
-
TPA_Rate - percentage of PID attenuation that will occur when the throttle is increased above the
TPA_breakpoint. -
TPA_Breakpoint - the throttle micro-second value in the curve at which
TPA_Ratewill begin to be applied. Below that point the PIDs are not attenuated at all.
- Firstly, set
TPA_Rate = 15as a starting point.
The PID's should be tuned in the throttle range your copter will comfortably cruise at - e.g. 1300 - 1600uS based on thrust to weight ratio and bank angle. - But once the throttle is moved higher than this point, you may start seeing oscillations. So begin increasing the
TPA_breakpointto a throttle value just prior to the onset of those oscillations. - Then slowly increase the
TPA_Ratevalue until the oscillations in the higher throttle range are gone.
It may require increasing even more on powerful freestyle or race quads.
Note - On reverse motor 3D installs, TPA is not recommended.

Note
Fixedwing dynamic PIDFF adjustment is broken into multiple methods, based on changes made in INAV 9.0.
It is important to understand the operation of both methods. Due to TPA and Pitch angle becoming a fall-back if the APA airspeed hardware source fails.
INAV 9.0
Settings :
-
Fw_reference_airspeed- Is the Airspeed at which your PIDs, Rates and Feedforwards should be optimally tuned, to provide a strong stabilization response. -
apa_pow- Sets how aggressively the gains will be dynamically adjusted from the base PIDFF tune.
Increasing its value from the default of 120, will boost the gains more aggressively below thefw_reference_airspeed, and attenuate them more aggressively above thefw_reference_airspeed.
While decreasingapa_powwill make the gain adjustments less aggressive. Meaning the PIDFF gain boost will be weaker, as will its attenuation strength, leaving the based gain tune less altered by airspeed changes.
Tip
Setting apa_pow = 0 will disable this function and revert to using the TPA and Pitch Angle method instead.
If either GNSS data or the Pitot sensor data becomes untrusted. It will also revert back to the TPA and Pitch Angle method.
FUNCTION :
This method uses airspeed data to dynamically adjusts the PIDFF gains.
Airspeed can be obtained from either a Pitot airspeed sensor. Or Virtual airspeed, derived from GNSS data requiring a 3D satellite fix..
As with the throttle TPA_rate setting, APA_pow also uses a similar scaling limit factor of [2x boost] 200% gain increase - [0.3 attenuation] 70% gain reduction.
-
If you have not done so; firstly tune your airplanes rates and Feedforwards with AutoTune, using the default PID gains. But if you already have a workable tune for your airplane, use that.
-
Enter the airspeed value your airplane will comfortably cruise at, into the
fw_reference_airspeedsetting. -
Start incrementally increasing your PID gains, while holding the approximate cruise airspeed you entered above. Tuning can be done easier via inflight tuning.
-
Once this is complete. You will notice that the stabilization automatically becomes tighter when the airspeed reduces below the
fw_reference_airspeed, and control surface oscillations are prevented as the airspeed increases above that point. -
However, if you do encounter control surface oscillations at higher airspeeds, this is when you can increase the value of
apa_pow. It will allow the gains to become more aggressively attenuated at higher speeds to prevent this occurrence. Only make adjustments of no more than 10 at a time. -
Also keep in mind that control surface throws as well as higher airspeeds will influence the need to adjust
apa_pow. If you have larger control surface throws, it may also require increasing.
But if your airplane is very draggy and can't make it past 120km in a full throttle dive. You can reduceapa_powto provide a tighter stabilization response over the planes whole speed range. -
fw_tpa_time_constantis not used in airspeed based dynamic PID adjustment.
This method uses the throttle position, combine with the airplanes climb or dive angle, to determine the optimal PIDFF gain adjustment required.
INAV 9.0
Settings :
-
TPA_Rate- the amount of scaling apply to the PIDs. 100%TPA_Rateallows the base PID tune to be scaled by a factor of[2x boost]200% gain increase -[0.5 attenuation]50% gain reduction. -
TPA_breakpoint- is the point in the throttle curve when the base PID tune is not boosted or attenuated. -
nav_fw_pitch2thr- is used to calculate the collective effect throttle and pitch will exert to dynamically adjust the PIDFF gains.
The ideal value for this function is 10. With 10 being the default value. Adjusting it too far outside this range may significantly reduce or increase TPA/pitch angle effectiveness.
NOTE : This setting also influences the navigation climb throttle. So only adjust it in small amounts either side of the default. -
fw_tpa_time_constant- is a smoothing and time delay constant, reflecting the non-instantaneous response of the airplane, based on relative drag, inertia and thrust. This filter works upon a throttle approximation or the forward speed, and pitch angle gravity induced speed changes.
FUNCTION :
The Throttle position and Climb/Dive angle are used together to provide more accurate attenuation or boost control over the gains.
The attenuation/boost strength is determined by how high you set TPA_rate.
Because this method can account for the pitch angle. It can override the conventional throttle based gain adjustments, according to the effect gravity has on the airplane in a climb or a dive. i.e. The airplane will either speed up in a fall, or slow down in a climb; which throttle position alone can not account for.
Example :
If your airplane is flying level at 80% throttle, the gains will have some attenuation applied to them at that airspeed to prevent control oscillations.
But if you then pull back on the elevator stick, so the airplane starts climbing at high angle. The vertical airspeed will generally start to wash-off on airplanes that aren't over powered. Leading to a transition from gain attenuation to gain boost. This will tighten the gains as the airplane slows closer to a stall, even when the throttle is higher.
The same applies if the airplane is placed in a 90° downward dive. When using the old method, having the throttle low in this case, would cause the gains to boost. But because this method knows that the airplane is in a dive, it will start attenuating the gains, preventing oscillations, because the airplanes free-fall speed is increasing, irrespective of the throttle.
-
Tune your PIDs to the throttle range you intend to fly your airplane. nav_fw_cruise_thr is ideal. Set that value as the
TPA_breakpoint. e.g. 1400 - 1480uS -
If you haven't already tuned your airplane. Make sure you complete an AutoTune with the default PID gains. Otherwise you can use the tune you already have.
-
Now you can start increasing the P and D gains around the throttle value you have
TPA_breakpointset. You should also increase theTPA_Ratefrom the default, to a conservative value of 40% when you're tuning the base gains. So it allows some dynamic PID adjustment to occur. Otherwise a tight base gain tune around the TPA_breakpoint will instantly cause oscillation if you increase the throttle/speed by too much. -
Now when your flying at lower throttle, your airplane should feel a bit tighter in its stabilization response. And when flying at higher throttle (up to full throttle), the control surfaces should not oscillate.
Once you have the base PID gains at the TPA_breakpoint throttle value tuned as tight as you are comfortable with. Push the throttle up toward full and let the speed increase. If oscillations start to occur. Incrementally increase theTPA_rateuntil they are gone.
Caution
Be cautious when increasing the TPA_rate on airplanes that have a thrust to weight ratio greater than 1.3 : 1. Such airplanes can climb vertically at a high speed. Which means high gain boost will occur under this condition. Make sure you run a vertical climb test, to look for control oscillations when increasing the TPA_rate during the tuning process.
- Due to drag also effecting how fast a given airplane will gain or lose speed.
fw_tpa_time_constantmay require adjustment to account for the time it takes for the speed to ramp up or ramp down, based on climb or dive pitch angle.
Pre INAV 9.0
Settings :
-
TPA_Rate- the amount of scaling apply to the PIDs. 100% TPA_Rate allows the base PID tune to be scaled by a limiting factor of[2x boost]200% -[0.5 attenuation]50%. -
TPA_breakpoint- is the point in the throttle curve when the base PID tune is not boosted or attenuated. -
fw_tpa_time_constant- is a smoothing and time delay constant, reflecting the non-instantaneous speed/throttle response of an airplane, based on drag and inertia.
FUNCTION :
The Throttle stick position is used to not only attenuate the PID gains in the higher throttle range, above the TPA_Breakpoint. But also boosts them in the lower throttle range, below the TPA_breakpoint, for tighter stabilization control when flying or gliding at lower speeds with minimal or no throttle.
-
Tune your PIDs to the throttle range you intend to fly your airplane. nav_fw_cruise_thr is ideal. Set that value as the
TPA_breakpoint. e.g. 1400 - 1480uS -
Once your P and D gains are tuned, and before you add any
TPA_Rate. You may notice when flying at lower throttle, your airplane handles more loosely. And when flying at higher throttle (up to full throttle) control surfaces may begin to oscillate.
You can now start increasing theTPA_Ratevalue until those oscillations are gone or minimal in the higher throttle/speed range. This will also translate to better handling at lower throttle/speeds, by boosting the PID gains.
Note
The above method had its limitations. It can not attenuate the PIDs at lower throttle values if the airplane is placed into a dive, causing the air-speed to increase. This could lead to control surface oscillations.
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
MultiWii Serial Protocol
MSP V2
MSP Messages reference guide
MSP Navigation Messages
INAV MSP frames changelog
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
Source Enumerations.md
Features safe to add and remove to fit your needs.
Developer info
INAV Remote Management, Control and Telemetry
Lightweight Telemetry (LTM)
Making a new Virtualbox to make your own INAV[OrangeRX LRS RX and OMNIBUS F4](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