Most freely available autopilot-enabled flight control hardware and firmware for hobby/consumer-grade UAVs seem to have a rather fixed feature set. There are usually varying degrees of stabilization, position hold/loiter modes, automatic takeoff and landing, return to home and a waypoint-following "mission" mode, but little beyond that. There are sometimes specialized modes such as thermal soaring and terrain following. However, all of these are pre-programmed and non-extendable, by which I mean that there is no way (at least I could find none) for a user to program their own custom flight logic, e.g. via scripting. I may have missed this, though.

So, Is there, in any of the autopilot solutions currently available to hobbyists, a way for a user to define their own flight logic without rewriting the autopilot software itself, by instead building on top of existing software?

To be clear, I'm looking for a way to write logic outside of the main flight control/autopilot package, either via some kind of scripting engine native to the autopilot or as a program running on a device parallel to the autopilot that can communicate to it and get the necessary flight information/send commands.

  • 1
    Tau Labs supports picoC and full flight scripting. It is very stable and the feature set is robust, but it's a bit abandonware at this point so you'd be on your own for support. – Kenn Sebesta Apr 23 at 14:06

I think your best bet would be Ardupilot. The communication protocol it uses, called MavLink, is documented and easy to use. Connect to the UART with an Arduino and you will have full control over the UAV.

There is even an Arduino library and a bunch of examples, like this forum post, of people doing exactly what you are looking to do. I did this once because I needed to grab the GPS and Compass information for a work project. You can research the various mission control programs that use MavLink to see the extent of control the protocol has. If I remember correctly you can even send direct stick commands over that interface to manually pilot the craft. This solution makes for lots of flexibility, especially when you consider the huge community writing Arduino libraries. It would be simple to add just about any sensor you could want.

| improve this answer | |
  • That sounds quite reassuring! I always thought mavlink was just a groundstation protocol, and I couldn't see any "custom/outboard/etc" modes on the list so I assumed Ardupilot didn't have these features available. I'll definitely give it a look, thanks! – FlashCactus Apr 23 at 20:05

PX4 looks like it is quite flexible, and might be what you are looking for. It might not be as user friendly as for example iNAV, but it should give you much more possibilities even if that comes at the cost of having to write more code.

| improve this answer | |

You could consider looking for research autopilots. Researchers try new things in all levels of the autopilot, and so they need extensibility and performance more than advanced features.

From what I understand Ardupilot and PX4 are popular. My university uses ROSflight, which is nice because it interfaces with Robot Operating System, which allows for sensor and control data to get around relatively easily. Depending on the type of UAV you're using, you would run ROSplane or ROScopter on top of it to provide higher level functions. It is all highly extensible, and you can replace any of the layers of the autopilot independently. Also nice, it has a pretty good simulator so that you can try fancy stuff without crashing a real UAV. Do note that it lacks some of the higher-level features provided by other autopilots, and so you'll have to look at what you want to do to decide.

| improve this answer | |

You can program/script elaborate flight patterns and then translate it to MAVLink format mission messages either live or in pre-recorded mission mode. Then depending on your needs - you either upload your mission or send it live over telemetry connection.

| improve this answer | |

After digging deeper on the Ardupilot website, I've found that besides MAVLink, it now supports onboard Lua scripts with full control of the aircraft that can be loaded to the flight controller's SD card.

The functionality is experimental as of now, and has been available in Copter/Rover since version 4.0 and Plane since v3.11. Further information can be found on the project's website.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.