Profile image

Well, I tried to make auto trim.

13.9k ChrisPy  3.6 years ago

So I was working on a project and trying to figure out how to do auto-trim and while I wasn't entirely successful I made some progress. The rotators deflect too much and cause the plane to wobble and doesn't let it pitch the way it needs to. I used two equations on two different rotators due to the way the graph needed to be shaped:
(PitchRate<0)*smooth(-clamp(log10(-PitchRate+1)/1.7,-1,1),.2)
and
(PitchRate>0)*smooth(clamp(log10(PitchRate+1)/1.7,-1,1),.2)
Smooth didn't help me a whole bunch and using round on Pitch Rate won't help with small differences in PitchRate. If yall got any ideas it would be very much appreciated. Maybe I could just use a linear graph to remove the need for two equations but idk if the lack of curve will make it overpowered again.

  • Log in to leave a comment
  • Profile image
    13.9k ChrisPy

    that top one says PitchRate<0

    Pinned 3.6 years ago
  • Profile image

    How do I turn this into MCAS

    4 months ago
  • Profile image

    clamp((Trim-PitchRate/5)/20*clamp01(smooth(Pitch,1)=0)+
    smooth(sign(Trim-PitchRate/5)*clamp01(TAS>5),abs(Trim-PitchRate/5)/2
    *clamp01(smooth(Pitch,1)=0)*clamp01(TAS>5)+clamp01(TAS&lt;5)),-1,1)

    try this. another type of PID but replace sum() with smooth(sign(target-current),abs(target-current)) to prevent overvalue

    +4 3.6 years ago
  • Profile image
    13.9k ChrisPy

    @edensk sp keeps doing formulas correct until i hit the reset button and it keeps saying NaN
    heres the formula which should work
    DebugExpression clamp01(Activate5=1)*clamp(smooth(rate(Altitude)/TAS*10,.5),-1,1)

    +3 3.6 years ago
  • Profile image
    16.5k edensk

    @ChrisPy increasing the derivative ensures it doesn't oveshoot by slowing everything down, you might wanna decrease it a bit.
    Regarding the proportional, increase it till the plane starts wobbling, then divide that value by half

    3.6 years ago
  • Profile image
    13.9k ChrisPy

    @edensk the problem im having is that it adjusts to slow and i cant really change that. So I have to have it not change the value while I'm moving the stick around. Any ideas?

    3.6 years ago
  • Profile image
    13.9k ChrisPy

    @edensk so its not really responding fast enough so i increased the proportional and the derivative but it still doesnt respond fast enough

    3.6 years ago
  • Profile image
    16.5k edensk

    @ChrisPy you're welcome man, good luck! If you need more help you know who to ask

    3.6 years ago
  • Profile image
    13.9k ChrisPy

    now it makes sense thank you!

    3.6 years ago
  • Profile image
    13.9k ChrisPy

    @edensk ahhhhh i get it now

    3.6 years ago
  • Profile image
    16.5k edensk

    it will fight against your pitch commands though, specially because of the integral

    3.6 years ago
  • Profile image
    16.5k edensk

    @ChrisPy if that's what you want, sure

    3.6 years ago
  • Profile image
    13.9k ChrisPy

    @edensk why shouldn't I just put 0 for the target and PitchRate for the variable

    3.6 years ago
  • Profile image
    16.5k edensk

    @ChrisPy if the target is Pitch*20 and pitch is 0 then the pid will try to maintain 0 pitchrate...

    3.6 years ago
  • Profile image
    13.9k ChrisPy

    @edensk ok thank you but if I wanted to have 0 pitch rate what would i put in there

    3.6 years ago
  • Profile image
    16.5k edensk

    Also, the output of the PID function happens to be more or less the same than (variable-target)*p + sum(variable-target)*i + rate(variable-target)*d
    meaning you don't really have to use a pid but it's easier to use one

    3.6 years ago
  • Profile image
    16.5k edensk

    @ChrisPy
    PID(target,variable,p,i,d)
    target will be the value you want your variable to be, variable is self explanatory, p is the gain, i is the retarded thing- I mean the sum of the error, and d the derivative, which smoothens the output to prevent overshooting.
    you can set the target to Pitch*20 and the variable to PitchRate so that the PID will try to maintain 20 degrees per second when full pitch up is applied.
    you can go here to learn how to tune p,i and d. (use small values from 0.001 to 0.1 though)
    I personally dislike the integral for certain reasons, but it's usually necessary for complete stability.

    3.6 years ago
  • Profile image
    13.9k ChrisPy

    @edensk idk how to use it m8 no one is explaining it well i tried to do what toxicgamer88 said but it doesn't work. I've tried multiple sources

    3.6 years ago
  • Profile image
    16.5k edensk

    PID is the way to go

    3.6 years ago
  • Profile image
    44.3k rexzion

    you tried

    3.6 years ago
  • Profile image
    13.9k ChrisPy

    @WHlTE more AOA???

    3.6 years ago
  • Profile image
    13.9k ChrisPy

    @2Papi2Chulo noice I was considering there too!

    3.6 years ago
  • Profile image
    76.6k 2Papi2Chulo

    @ChrisPy thats awesome. I'm trying to go to embry riddle next year.

    3.6 years ago
  • Profile image
    13.9k ChrisPy

    @toxicgamer88 hmm tried it but currently it just only uses the values of 1 and -1

    3.6 years ago
  • Profile image
    13.9k ChrisPy

    @2Papi2Chulo or another aerospace company after I get out of college Im going to Wichita State University this coming fall

    3.6 years ago
  • Log in to see more comments