-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add airspeed TPA support #11042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add airspeed TPA support #11042
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
|
This does look kinda over-complicated for historical reasons. But I'm not volunteering to refactor it, so I'm not really complaining. We originally saw we need to reduce the PID when airspeed increases. Because the force/lift from the control surface is proportional to ( 0.5 * airspeed) ². What we really wanted originally when TPA was introduced was the airspeed. But we often don't have the airspeed. So we used the throttle value to make a rough estimate of what the airspeed might be, in order to reduce the PID appropriately. Now when we DO have the airspeed (the value we wanted in the first place), we're using the airspeed to simulate a throttle value, in order to estimate how much the throttle value might affect the airspeed and therefore the PID. Kinda like: Given we already know the airspeed, there's no need to mess around with estimating a "virtual throttle", then estimating how much that will affect the velocity and therefore the force. |
I think this only explain the first half of the theory and it is not proportial but inverse propotional, The following are my thoughts, in short the angular velocity of the plane is propotional to the control surface multiplied by airspeed. If the old TPA assumes throttle is propotional to airspeed. then it is on same page with the following. And airspeed gain reduction(TPA) will need some internal variable to calculate, then why dont we use the virtual throttle value as the internal variable to maintain the compability, reducing the workload of users to shift from throttle based to airspeed based. Relationship Between Airspeed, Control Surface Deflection, and Angular Velocity in Model Aircraft1. Fundamental Dynamic EquationFor a single rotational axis (roll, pitch, or yaw):
Interpretation: 2. Steady-State ConditionIn our small plane, the plane enters Steady-State quily, that is why the plane is mainly driven by FF gain
Therefore:
3. Key Proportional Relationships
4. Quick Reference
Summary
High-speed flight requires smaller control deflections to achieve the same rotation rate due to aerodynamic damping and increased control effectiveness. |
Agreed. Therefore the deflection needed to generate the force is ~ inversely proportional. (Given assumptions). So no need to bring a simulated throttle into it. THAT said, you actually wrote the dang code. And it works, presumably. I didn't write it and probably wouldn't, so whichever way you want to write it is fine by me. I'm somewhat regretting having said anything because you do great work and my comment wasn't pointing out a real problem that needed to be fixed. It just felt awkward to do a "virtual throttle". Ps I had mentioned inversely proportional to (0.5 * V)², I see why you said inversely proportional to V itself. I see V is probably more correct for correcting for external disturbances, whereas V² would be for initiating maneuver, for starting a a turn. (If I understand correctly). On an unrelated topic - I wanted to let you know I'm hoping to cut an INAV 9.0RC1 in the next couple of weeks. Hopefully with airspeed PID attenuation included. I sent a build with this plus some other PRs over to James Downing for testing. |
I think V is more important for continuous control stick input , and V² is more important for everything else including disturbances and starting a turn. I am changing my mind. considering only V, then the TPA formula can be much simplier but have some promlems.
While the virtual throttle method has some extra parameters to toggle, or add a new parameter/modify δ = δref * Vref / V curiousto know how others think |
|
I love that I have someone to discuss this with who understands it better than I do. :)
It occurs to me that V^1.3 or V^1.4 will always be in between. I think V^1.3 would probably be a good compromise between the two. Of course, if you didn't want to do a decimal exponent, something like (0.5 * V) ^ 2 would also give a compromise value in between V and V² 😜
The baseline is not having any airspeed-based attenuation at all, so IMHO capping the attenuation at 4 * vref or so would be pretty good. It's not like it explodes at the cap. It just doesn't attenuate any further. I don't think the exact cap is critical. Of course one could smooth out the saturation by multiplying by (10 - Vfactor) / (Vfactor + 8) or whatever. (Where Vfactor = current airspeed / Vref). |
Yeah I expect the deflection will be approximately linear to the force (0.5V)^2 given the material is reasonably sized for the application. In the end, I suspect that's about the difference between V^1.3 and V^1.35. |






User description
add a cli command to let fixed wing use airspeed based tpa.
It calculates the corresponding throttle value based on the airspeed. Ensure a seamless integration with the current throttle-based TPA. Turn it on with cli command and no more tunning is needed, fallback to old throttle based tpa if airspeed is not avaliable
tpa_breakpoint + (airspeed - fw_reference_airspeed)/fw_reference_airspeed * (tpa_breakpoint - ThrottleIdleValue(default:1150))
sim test ok
recommend to raise pitot_lpf_milli_hz on vitual pitot
PR Type
Enhancement
Description
This description is generated by an AI tool. It may have inaccuracies
Add airspeed-based TPA calculation for fixed-wing aircraft
New
airspeed_tpasetting to enable airspeed TPA modeRefactor TPA calculation to support both throttle and airspeed
Add airspeed validity check function for sensor health
Diagram Walkthrough
File Walkthrough
controlrate_profile.c
Initialize airspeed TPA settingsrc/main/fc/controlrate_profile.c
airspeed_tpafield initialization to control rate profile resetfunction
controlrate_profile_config_struct.h
Add airspeed TPA configuration fieldsrc/main/fc/controlrate_profile_config_struct.h
airspeed_tpaboolean field to throttle configuration structuresettings.yaml
Configure airspeed TPA settingsrc/main/fc/settings.yaml
airspeed_tpasetting configuration with descriptionpid.c
Implement airspeed-based TPA calculationsrc/main/flight/pid.c
calculateMultirotorTPAFactorto accept throttle parameterpitotmeter.c
Add airspeed sensor validity checksrc/main/sensors/pitotmeter.c
pitotValidForAirspeedfunction to check sensor validitypitotmeter.h
Expose airspeed validity functionsrc/main/sensors/pitotmeter.h
pitotValidForAirspeedSettings.md
Document airspeed TPA settingdocs/Settings.md
airspeed_tpasetting