Profile image

How to make an Autopilot?

10.5k Timplanes  2.6 years ago

I’m posting this because I want to make a fairly basic autopilot in my regional airliner. I thought I could wing it, but I found out that it was more complicated than I thought. An altitude code is dependent on vertical speed, a heading code is dependent on bank angle, etc.

So, I am wondering if anyone knows what the ideas behind an autopilot code were, OR has tips on coding, and then tuning an autopilot. I have a decent input system for heading, vs, and altitude, but that’s about it.

Thanks!

  • Log in to leave a comment
  • Profile image

    Use Roll + clamp((-RollAngle / 20), -1, 1)*clamp(Activate1 ,0 ,-1)

    for pitch -Pitch + clamp((PitchAngle / 20), -1, 1)*clamp(Activate1 ,0 ,-1)

    one month ago
  • Profile image
    3,060 KM13

    1.Very interesting autopilot features as well as funky tree features:
    https://www.simpleplanes.com/a/7jOT58/F-104PrimerPlus-block-4-StealthStarfighter-RM8-5-generation-land-based-version

    2.Very advanced funky tree aircraft-carrier landing autopilot:
    https://www.simpleplanes.com/a/Rd5d8I/F-104PrimerPlus-STOL-naval-StealthStarfighter-block-2-RM8-5-generation-version

    https://www.simpleplanes.com/a/UGOzpU/F-4Primerplus-Stealth-naval-aircraft-carrier-PhantomIII-Block4-O593-5-5Generation

    +2 1.3 years ago
  • Profile image
    3,947 BigAeroblane

    https://www.simpleplanes.com/a/4I11JL/AutoPilot-TestTwin-Prop
    It can maintain the speed, heading, altitude of the input, this is just a rudimentary version and I am still updating it

    1.4 years ago
  • Profile image
    3,060 KM13

    @isaashmead62 There're two examples helping you to make autopilot that automatically targeting at the selected target:
    https://www.simpleplanes.com/a/2067mq/F-4Primerplus-Stealth-PhantomIII-O593-5-5Generation-simplified-mobile-friendly-ve

    https://www.simpleplanes.com/a/GT4G1Z/F-106Primer-Plus-NGAD-Light-6-Generation-O593-Angel-Block-4-simplified-mobile-fri

    I think they could help you to make an autopilot.

    1.7 years ago
  • Profile image

    Can anyone help me with this one? Please.

    1.7 years ago
  • Profile image

    I can make too!

    2.4 years ago
  • Profile image

    @Phoebe Does it work on the input of the wing's control surface to gather maximum speed in TAS of aircraft?

    2.6 years ago
  • Profile image
    10.5k Timplanes

    Thank you @Phoebe and @PlaneFlightX for your help!
    I have a pretty stable altitude/vs system working now, just have some work on the heading stuff.

    This is the link to the plane for PlaneFlightX.

    2.6 years ago
  • Profile image
    49.5k PlaneFlightX

    Autopilot... complicated but explainable.

    Lemme explain the basics in a p̶a̶r̶a̶g̶r̶a̶p̶h̶ short essay. I will be using the SWL-10's autopilot (wait, you can use that!) for this example. For the SWL-120 the basics will be the same.

    The first thing we want to do is make a system which allows us to select a target heading, altitude, and vertical speed. You have done this. Now, we want to incorporate our current heading, vertical speed, and altitude. Then we want to find the difference between the two and then clamp that difference, so we get a number which smoothly goes to 0 as we approach all of our targets. Something important to note is Unity works in metric (meters, meters per second) instead of imperial (knots, feet).

    Another good thing - A while ago, I made several YouTube videos about the development of the SWL-10, specifically focusing on the funky trees, and I think one or two were almost exclusively about the autopilot. I'm not sure if they include all the information, but I'll make a video or two when I make the SWL-120's autopilot.

    Here is the video about the autopilot. I'm pretty sure some info is missing, but let me know and I'll help you.

    Oh, and here's the SWL-10. The autopilot is in the bottom few variables (the video will help), and some numbers might need tuning. I'd also recommend looking at the code in the four "physics wings" around the aircraft.

    I'd also like to have a look at the funkyness in the cockpit of this regional airliner you're building.

    One last thing - if you're really stuck, then I'd recommend waiting a month or two, until I can make a video on the SWL-120's autopilot, because in that video I'll try and make sure the entire video is dedicated to completely explaining how the autopilot works, and then coding and testing it.

    +2 2.6 years ago
  • Profile image
    10.5k Timplanes

    @PlaneFlightX,
    If you have time, could you help?

    +1 2.6 years ago