Hi, i'm trying to put up a stabilization-system.
ActivationGroup1 is supposed to activate an automatic rudder, that is already working pretty well (my joystick lacks a twist rudder).
Here is the input-expression of the rudder:
Yaw + clamp01((Activate1&(Yaw=0)&(-1 * (Roll=0)))|Activate2) * (-PID(0, AngleOfSlip, 0.4, 0.2, 0.4))
ActivationGroup2 shall switch on a roll-angle-stabilization. The intention is to maintain any roll-angle that i have rolled into by using the ailerons' (funky trees-) input. I have already made some different attempts to achieve that. One of them looks rather succesfull, but i'm not 100% sure whether my roll-angle doesn't slightly change over a longer period of time. This is the corresponding expression:
Roll + clamp01(Activate2&(Roll=0)) * -PID(RollAngle, RollAngle, 0.4, 0.3, 0.3)
But this only works in combination with the auto-rudder (thats why there's an Activate2 in the rudder-code). As soon as i exclude the Activate2 part from the rudder code, the aileron-code is only able to maintain the roll-angle while the auto-rudder is also switched on by activating group1. I believe the PID for the ailerons doesn't work without support of the rudder, because it does not really make sense to have RollAngle as target and as current at the same time.
In the earlier attempts i tried: -PID(0, RollRate, 0.4, 0.3, 0.3). But that kept the plane rolling back to neutral, confusing me because i thaught regulating the rollrate to zero should prevent the plane from rolling anymore without any input from the stick instead of regulating the roll-angle itself to zero. If you've got any ideas or even have already solved a similar problem, i'd be glad if you could help me here :)
PS: The code has been only tested on a glider so far. It flies quite stable already without any stabilization at all and and slowly rolls back to normal automaticly after being tilted left or right. I tested the stuff on that plane in order to notice even rather small differences in it's behavior.
its making my plane do a bunch of flips what do i do?
@SnoWFLakE0s Thank you for the Expression, that should help me a lot :)
@Ditsch
.
1. Utilize the data saver script I devised:
smooth(X, pow(10, 3)*clamp01(Control))
X is the thing you're measuring, Control is any control boolean (e.g. Activate1)
2. You could modify that particular script above to fit your needs. Something like
RollAngle = 0
as the control. I think.Thanks for the kind comments.
@SnoWFLakE0s Hi, at first: Thanks for your help. And sorry in advance for having further questions:
1. How do i generally save a value at a certain moment (e.g. the RollAngle at the time of activation)? Is there any workaround for something like setting a value to a user-defined variable or anything similar?
2. Would it be possible to save the RollAngle every time the Roll-input hits zero (so basically when i put the joystick in neutral position)?
Sorry for just asking more questions, just started using FT (and finding it pretty brilliant, thank you for your tutorial-website btw). And i really need to further tune the PID (started watching youtube-tutorials on that).
I think I would try to play around with PID a bit more, but for a more rudimentary (surefire) system is to save the RollAngle on the time of activation, subtract from current RollAngle, and create a response curve for different delta amounts.