Hackflight is a minimalist software toolkit for building multirotor flight controllers and simulators. It is geared toward people like me who want to tinker with flight-control firmware, and use it to teach students about ideas like state estimation and PID control. If you are in the 99% percent of users who just want to get your vehicle flying without getting into firmware hacking, I recommend Betaflight (great for getting started when you're on a budget) or the Ardupilot system (for sophisticated mission planning with waypoint navigation and the like). In addition to big user communities and loads of great features, these platforms have safety mechanisms that Hackflight lacks, which will help avoid injury to you and damage to your vehicle.
My original goal with Hackflight was to support a variety of flight-control boards on any operating system. Because of the proliferaton of flight-control boards in recent years, and the advantages of Linux for rapid software development, I decided to narrow my focus to developing on Linux using the powerful, inexpensive Teensy 4.0 development board with Arduino libraries. Similarly, having tried all the major robotics simulation packages available, and written my own multirotor simulator, I have switched to the powerful, easy-to-use Webots platform as the basis of the Hackflight flight simulator.
Hackflight attempts to maintain a simple relationship between the code and the elements of the flight-control dataflow diagram shown below. Boxes represent data, ovals represent functions, and feedback arrows represent the need for functions that have state (instance variables); for example, the maintenance of an error integral in a PID controller:
By using header-only C++ classes whenever possible, avoiding C-style macros and null pointers, and leveraging existing Arduino libraries for receivers, ESCs, and IMUs, Hackflight supports a composable approach to taming the complexity of flight control. The Hackflight codebase is just a few thousand lines of code.
For flight simulation, Hackflight uses Webots, a free, open-source robotics simulator. Click here to get started.
If you love Haskell as much as I do and want to see how it can be used for flight control, click here.
Please cite Hackflight as:
@ARTICLE{10.3389/fnbot.2020.00016,
AUTHOR={Levy, Simon D.},
TITLE={Robustness Through Simplicity: A Minimalist Gateway to Neurorobotic Flight},
JOURNAL={Frontiers in Neurorobotics},
VOLUME={14},
YEAR={2020},
URL={https://www.frontiersin.org/articles/10.3389/fnbot.2020.00016},
DOI={10.3389/fnbot.2020.00016},
ISSN={1662-5218}
}