Has anyone made an AoA limiter And G limiter that increases sensitivity depending on speed, reliably keeping the G's Under a certain target value at almost all speed?
And that, without a PID, I mean.
So a code that someone who isn't well acquainted with PID inputs can use...
Proud to say that me and Tom worked something out for everyone here... and since it's so simple, a similar code might even work in Simple planes 2, so yeah, this code might actually help out a lot of people... I do request you read everything below carefully, though.
For the Pitch input, I took this as a variable that I lovingly called "PitchyWitchy" (Call the variable whatever you want)
GS [Lesser than sign] 277.165 ? AoA1 + smooth(Pitch/1.66,10) - PitchRate/500 : smooth(Pitch*4,2)/Geez + AoA1 - smooth(PitchRate/GSMultiplier,1.3)
As you can see, there are 3 variables in the code above... AoA1, Geez and GSMultiplier.
The input in AoA1 Is this:
AngleOfSlip [ Lesser than sign ] 90 ? clamp(-AngleOfAttack/19,-3,3) : -1*clamp(-AngleOfAttack/19,-3,3)
It takes the normal AngleOfAttack values, as you'd expect it to work..clamps it, then checks for whether the plane is flying in reverse... so like Guyfolk did it. If the craft is in reverse, then it inverts the limiters input... therefore accounting for reverse airflow.
Then Geez is well... The GForce input. Self Explanatory TBH. Just copy the code below in the Variable input.
smooth(clamp(GForce*GS/200,0.5,6),3.5)
Yes, it is Ground speed relative as well. Always a bonus.
GSMultiplier is... well it's a bit of monstrousity to look at with first impressions but it gets exponentially simplified when you realise how extremely simple it is.
clamp(1/(GS/12877),20,45)
basically, I found that at 600Mph, PitchRate/45 worked well, but as the craft slowly accelerated... there were issues were pitchRate/45 just wasnt enough limiting...
So what this code above does is a reliably return outputs that starts at 45 during 600mph, and then gradually lowers as speed increases...
Until it hits a minimum of 20, which is kind of like a hard limit before the values become too sensitive for simple planes to reliably simulate.
https://www.simpleplanes.com/a/F9pMP1/QUECHALS-GHOST
This is the demonstrator for the code in action. It works on pretty much all physics settings as well since we aren't doing complex calculus or PID, it just works. I have been lenient with how much it limits, so under 600mph, it still does cross well over 13G's if you Really push it, but it likely tones it down quickly and keeps a nice 12G's sustained.... And yes, this thing IS relaxed stability and the code above would likely work pretty well for TVC and PSM planes!
If you do wish to use it, no credit required... just tag me on the build because I really wanna see what people come up with using this, since I've not seen anyone else take it to this extent before.
I highly suggest you combine these codes for the normal aero surfaces on your plane, then add some code fromt he basic Thrust vectoring Guyfolk did a tutorial on. You should hopefully get a plane that is extremely realistic in it's flight model, fun to fly AND doesn't have a complex PID input system along with many wasted hours of testing and fine tuning.
If you Do not want the thing to pull as many G's, All you have to do is play around a little with the GSMultiplier values (The higher the GS Multiplier returns, the more Sensitive your limiter is) and for the under 600mph regime, just play around with the pitch divider. I suggest anywhere between Pitch/2.5 and Pitch/1.3
This permanently changes how simple planes builds will be in the future... The only case where this might become redundant is in simple planes 2, where they may introduce integrated Fly by wire system where you only have to use sliders. Even then, this code will hold up for SP 1 builds. I'm 4 years late to the party of Funky trees pros, but I've gotten there. This system is a code literally anyone can just basically pick up and use... It does needs some fine tuning hopping from build to build, but it works... and works consistently well on all physics settings, at that... So yes.
You absolutely do not need to credit me if you use this. Spread it around a little make it a default until SP 2 for all relaxed stability or... really just any design that inherently pulls too many G's. I only ask that you tag me because I really want to see all the creativity flow out now with having a system that skips you the pain of engineering a working FBW!
Here are all the codes with corresponding variable for you to copy paste (copy everything but the curly brackets.
For Variable {{ PitchyWitchy }} : {{ GS < 277.165 ? AoA1 + smooth(Pitch/1.66,10) - PitchRate/500 : smooth(Pitch*4,2)/Geez + AoA1 - smooth(PitchRate/GSMultiplier,1.3) }}
For Variable {{ AoA1 }} : {{ GS>1? (AngleOfSlip < 90 ? clamp(-AngleOfAttack/23,-3,3) : -1*clamp(-AngleOfAttack/22,-3,3)) : 0 }}
For Variable {{ Geez }} : {{ smooth(clamp(GForce*GS/200,0.5,6),3.5) }}
For Variable {{ GSMultiplier }} : {{ clamp(1/(GS/12877),20,45) }}
I should also tell that @ThomasRoderick Had a big hand in this. The Idea to have it get more limiting as speed increased was his. He did try to code it in, but he went for something that would work with real life variables, not simpleplanes. I just managed to make something that works suprisingly well with the idea. I've been trying to make it work like that, where it increases limiting factor so that the amoung of g's pulled is constantly below a hard limit throughout the flight for years now, But I didn't have that breakthrough point until Tom tried an equation, which made my mind work.
@Rb2h Sorry for the late reply, I was having a bit of a moment IRL.
@Rb2h weird, because it's working for me. Hold on, ill send mine to you
@GalaxiesDontSlleep This game ALWAYS GIVES ME PROBLEMS
@Rb2h GS>1? (AngleOfSlip < 90 ? clamp(-AngleOfAttack/25,-3,3) : -1*clamp(-AngleOfAttack/25,-3,3)) : 0
Try this then? The brackets should help isolate the codes.
@GalaxiesDontSlleep when the game says no
Might just be stupid
@GalaxiesDontSlleep Koltobanian
@Rb2h use the actual "<" instead of "lesser than sign"?
I edited the previous comment as well.
Also, Novaran fighter?
@GalaxiesDontSlleep can't do an Unlisted bc it's linked to a challenge and doing that will bypass the autocredit
@GalaxiesDontSlleep ???
@Rb2h landed and stopped right? Just add a condition so that it only activates above a certain GS. Or... Give me an unlisted link or I do it for you. Thanks for letting me know btw. I'll be putting up some updates mid December or so after I post the Ghost of Quechal (The demonstrator for this code)
But basically, go to AoA1, then do...
{{ GS>3 ? AngleOfSlip < 90 ? clamp(-AngleOfAttack/19,-3,3) : -1*clamp(-AngleOfAttack/19,-3,3) : 0 }}
Put this on my jet
Works well
But the elevator likes to go crazy when landed
@Rb2h Which one? The condition for if above a certain speed then change programme is in "PitchyWitchy", where the condition asks if GS<(Insert value here) ?
The value to be inserted must be in M/s
How do you edit the speed regime of the limiter
@overlord5453 Yes. AoA and G's.
@GalaxiesDontSlleep ohh. Thanks again.
Hang on, is this a two in one code? Limiting AOA and G's at the same time?
You mad man
@overlord5453 Having spent 4 Years banging my head on the wall that is relaxed stability did actually help me become someone who knows a thing or two about it. Again, let me know if you ever need some help!
Just saw the edit, may wanna increase the pitch divider for under 600mph
@GalaxiesDontSlleep it's not behind but right on each other. But thanks for the advice. I need it. I did get it to work at higher speeds. The problem occurs at lower speeds. Requires more fine tuning.
@Grob0s0VBRa Np. I made an addendum at the very bottom so that people can just directly copy and paste if they must.
Bonus toward you because this looks better thank Red markups.
@GalaxiesDontSlleep darn, that only helps with greater than and multiplication signs...
Well, that's site text formatting stuff...
@Grob0s0VBRa how'd you... Because look above, its still ";<" when I try do it. annoying.
@overlord5453 Oh yeah... If you're trying to put the COLBehind COM (And by quite a bit at that) then even PID inputs won't help... because frankly speaking It isn't possible, even IRL)
Reason being You're always at very high up rate because your wings are lifting before the mass is being "thrown" forward.
The farther back you go, the more precise your inputs need to be... at some point, You just can't limit it. Thought you could use that insight since you mentioned aggressive pitching. If it is aggressively pitching up and down then all you have to do is _Very slightly move your COM forward. It should be Okay if they are on top of each other as long as your pitch input isn't big.
Yeah, fine tuning, basically.
@Grob0s0VBRa Gonna try that rn. Thx!
ps...
create new line, leave it empty.
Hit space five times.
enter your code.
create another empty line.
profit...