Profile image

How do i make fly-by-wire?

1,473 Stick  4 days ago

I'm trying to make a plane with automatic trim (holds its AOA if no input is given), and maybe some PSM capabilities but i can't find any tutorials or pointers on how to do it. And i'm REALLY confused about the whole PID thing.

  • Log in to leave a comment
  • Profile image

    @Stick k

    3 days ago
  • Profile image
    1,473 Stick

    @RestlessGalaxies No the problem is my TVC randomly goes "u roll now" when im like 70 degrees up. Without it it got no problems. Tried out your code, I'm gonna try and reverse engineer it to tune it cuz it's making my plane wobble. already clamped.

    3 days ago
  • Profile image

    @Stick yeah, again, just try making the outer part of your wing a little more lifting than the root


    The alternative is making the wings so small that the wings HAVE to stall completely in unison before one of them loses airflow enough to cause the induced roll

    3 days ago
  • Profile image

    @Stick that's a real life problem. It's either fixed with RollRate limitors or a wing that has higher aft sweep (basically more pointy backwards and longer) so that the tips don't stall.

    3 days ago
  • Profile image
    1,473 Stick

    @Stick update. the tvc gives me a ton of roll input at high AOAs. Dunno why. Code is clamp(Roll - RollRate/300,-1,1)

    3 days ago
  • Profile image
    1,473 Stick

    @RestlessGalaxies Thanks, i found guyfolk's tutorials so i got PSMs down. Basically wanna have it hold a AOA so i don't have to trim anything. 1 problem i got is that it rolls right bad when i pull the pitch, only in TVC though cuz normally that rarely happens.

    +1 3 days ago
  • Profile image

    We'll start with this...


    Auto trim and Holding angle of attack are two very different functions.


    As for PID... Well, unless you have an engineering degree, that's going to be pretty difficult. PID are known to be finnicky to those who can't be bothered to open a desmos graph and plot in the maths. Even then PID's in simple planes are sensitive to the thousandth decimal.


    What you want for "Auto trim" is to reduce the PitchRate so that the Pitch Angle doesn't change. Trying something like PitchRate>0.1? PitchRate/25 : (PitchRate(smaller than)-0.1? PitchRate/25 : 0) may work... But I just got that from the top of my head and testing will be needed.

    +1 3 days ago
  • Profile image

    @restlessGalaxies

    4 days ago
  • Profile image

    @restlessGalaxies

    4 days ago