Quadrotor Control Systems And Kerbal Harriers

Kerbal Space Program, the game that teaches engineers at JPL and SpaceX the basics of rocket design and orbital mechanics, recently had a giant update. There are now science contracts that require you to fly Kerbals all over their tiny globe, collect data, and transmit it back to the Kerbal Space Center. As would be expected, this is a grind for XP, and the contracts sometimes don’t make sense – you need to collect data from cliff faces and mountain tops. Landing a Kerbal jet at these places is hard.

[Matt Thiffault] wanted to do these science contracts more efficiently. The best way to get to a remote location without a landing strip would be a helicopter, but a harrier jump jet would do just as well. This isn’t supported in the stock game, so [Matt] wrote a complete control system for four engines to control a hovering Kerbal jet.

[Matt]’s work is built on kOS, a scriptable autopilot mod for Kerbal that was originally intended to be something like the Apollo Guidance Computer. People have been using it to make computerized skycranes and automated rendezvous and docking programs, but these are actually relatively simple examples; there’s far more math involved in flying a quadcopter than there is getting into orbit.

To build his automated hovering harrier, [Matt] needed an aircraft. His Kerrier has parts from the Kerbal Aircraft Expansion, B9, and Infernal Robotics mods for KSP, but this is only half the problem. Anyone can put four tilt jets on an airplane, and it takes a real wizard to force a control system to hover. Hover control of the Kerbal harrier is accomplished with a complete control system for a four-engined aircraft, with proper PID control loops and code updating at 20Hz.

With kOS, the proper plane, and the right software running on this emulated guidance computer, [Matt] is able to park his plane in mid-air, have a Kerbal descend the ladder, perform some science, and return to base. It’s an impressive amount of work for a video game. A good thing, too: [Matt] is looking to get into controls engineering professionally. Whether this will go on his resume is another question entirely.

19 thoughts on “Quadrotor Control Systems And Kerbal Harriers

      1. he probably uses kOS, a quite extensive scripting system that allows for scripting in much the same way these systems run in real life, the same skills apply most of the way.

    1. so he used a scripting engine mod, which allows for from-scratch control of every system on a vehicle, to implement something generally running on a dedicated microcontroller, to run one of the few real life VTOLs, which he reproduced in the game using mod parts

    1. It actually looks like this /isn’t/ a mod itself – he’s just loading the existing kOS and b9 mods into the game, and getting to work writing the in-world code to run that jet. That’s what’s so beautiful about kOS – it /doesn’t/ give you these things. It gives you a vaguely basic-like language running on a processor part within the game, that can can use mostly the controls that you can use.

      What he’s done is straight (advanced) gameplay for kOS – and pretty badS :)

    2. best I’ve done VTOL wise was with the B9 parts pack, so not quite stock, but certainly no scripting like this. Extremely satisfying to take off normally at runway, fly to island runway, return but come in for a perfect vertical landing on the VAB.

  1. “There’s far more math involved in flying a quadcopter than there is getting into orbit”

    With respect to Brian, this is simply untrue. I say this with authority as someone with a PhD and 10 years of experience specialising in quadrotor dynamics and control (and some familiarity with orbital mechanics). Computing orbital insertion trajectories is substantially harder. Quadrotors are second-order rigid body systems with added damping and cross-coupling from induced rotor drag (and flapping if present); the hard part of quadrotors is mostly doing the inertial estimation, which a sim environment gives you for free. In comparison, launch to orbit has rigid body dynamics, non-linear transsonic aerodynamics, orbital mechanics, variable thrust response with changing altitude, constantly changing vehicle centre of mass… the list goes on!

    Developing quadrotors isn’t easy, but it’s also not rocket science. ;)

    1. I believe that he was referring to the fact that in the game, using the same kOS scripting mod, it is possible to get a craft into orbit using far less math (at least explicitly) than involved in this style of controller.

      I think most of us would agree that just about everything involved in REAL space flight is more complicated than aircraft controllers.

      1. I’m actually not sure of that – getting a craft to orbit (but perhaps needing somewhat more fuel to compensate for suboptimality, which could get expensive) I do get the impression that you can opt to front-load a fair of the orientation control into relatively passive aerodynamics while you’ve got enough atmosphere. For that matter, you mostly don’t /get/ to control thrust on a rocket (although it’s possible to adjust chamber pressure through most of the range that produces choked flow in the nozzle to adjust thrust reasonably efficiently, it’s apparently more trouble than it’s worth).

        I think what I’m saying is that /controlling/ a rocket for an orbital launch isn’t that hard. Building one and planning the mission are hard, but the actual controls aren’t necessarily so bad if you are just trying to get to orbit.

    2. I think he was referring to the fact that in the game, it is possible to write a script (using the kOS mod) that will put a ship in orbit using far less math (at least explicitly) than it takes to do something like the harrier.

      I think we’d all agree that basically anything involved in REAL space flight is going to be harder than the aircraft equivalent :P

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.