• Stars
    star
    285
  • Rank 145,115 (Top 3 %)
  • Language
    C++
  • License
    GNU General Publi...
  • Created almost 9 years ago
  • Updated 11 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Minimalist flight-control toolkit for makers

Intro

Hackflight is a C++ software toolkit for building multirotor flight controllers. It is geared toward people like me who want to tinker with flight-control firmware, and use it to teach students about ideas like inertial measurement and PID tuning. 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, and the origin of much of the code in Hackflight) 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.

Use cases

Hackflight has been tested on the following platforms:

To make it easy to develop flight firmware using Arduino-compatible microcontrollers, Hackflight is laid out as an Arduino library and uses the Arduino API; however, the core flight-control algorithm is hardware-independent.

Design principles

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: you instantiate a Board subclass, passing it your IMU settings, PID controllers, mixer, ESC type, and LED pin number. In your loop function, you just call the step() method on the Board object, passing it the raw values from your IMU. Look at this example program to get an idea of how this approach works.

Desktop visualizer app

Because it is useful to get some visual feedback on things like vehicle orientation and RC receiver channel values, we also provide HFViz, a very simple visualizer program that allows you to connect to the board and see what's going on. Check out the HFViz README for more information.

Citing Hackflight

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}
}

More Repositories

1

TinyEKF

Lightweight C/C++ Extended Kalman Filter with Python for prototyping
Python
1,008
star
2

BreezySLAM

Simple, efficient, open-source package for Simultaneous Localization and Mapping
C
761
star
3

AirSimTensorFlow

A simple example of using Microsoft AirSim to train a TensorFlow neural net on collision avoidance
Python
235
star
4

SensorFusion

A simple Matlab example of sensor fusion using a Kalman filter
MATLAB
154
star
5

MulticopterSim

Multi-language multirotor flight simulator using UnrealEngine
C++
123
star
6

OpenCV-Python-Hacks

Optical flow and other tricks in OpenCV
Python
97
star
7

RPiAdHocWiFi

Simple ad-hoc wireless network support for Raspberry Pi
Shell
90
star
8

GooMPy

Google Maps in Python
Python
84
star
9

neat-gym

Neuro-evolution for OpenAI Gym environments
Python
56
star
10

ARDroneAutoPylot

Auto-Pilot the Parrot AR.Drone from Python (or Matlab or C)
C
43
star
11

RealtimePlotter

Python real-time scrolling multi-plot over time
Python
40
star
12

OpenCV_GStreamer

Simple C++ example of using OpenCV with GStreamer
C++
40
star
13

PyQuadSim

A open-source quadrotor simulator in Python for Linux [NO LONGER SUPPORTED]
Python
38
star
14

UE4_OpenCV

Simple example of adding machine vision to UnrealEngine4 with OpenCV
C++
36
star
15

PyRoboViz

Simple Python tool for 2D visualization of robot pose and map
Python
35
star
16

CppSockets

Simple cross-platform socket support for C++
C++
32
star
17

gym-copter

Gymnasium environment for reinforcement learning with multicopters
Python
30
star
18

USFS

Cross-platform libraries for the EM7180 Ultimate Sensor Fusion Solution
C++
30
star
19

VL53L5CX

Arduino library for ST Microelectronics VL53L5CX multizone Time-of-Flight ranging sensor
C
28
star
20

NeatoPylot

Auto-Pilot the Neato XV-11 from Python
Python
26
star
21

RoverPylot

Pilot the Brookstone Rover 2.0 and Rover Revolution from Python
Python
23
star
22

BreezyCreate2

Ultra-simple Python API for iRobot Create 2
Python
21
star
23

BreezySTM32

Arduino-like API for for STM32-based flight controllers [NO LONGER SUPPORTED]
C
18
star
24

PySticks

Python API for flying with a game controller
Python
17
star
25

PyPX4Flow

A simple Python package for reading from the PX4Flow optical-flow sensor
Python
17
star
26

m021v4l2

Capture images from Leopard Imaging LI-USB30-M021 camera on Linux
C
16
star
27

UBX_Parser

C++ parser for binary UBX GPS messages with Arduino example
C++
14
star
28

AndroidBluetoothClient

Simple Bluetooth socket client for Android
Java
14
star
29

ISCPP

Introduction to Scientific Computing and Programming in Python
Python
13
star
30

BreezyArduCAM

A simple Arduino API for the ArduCAM Mini
C
11
star
31

xvlidar

A simple Python class for reading from GetSurreal's XV Lidar Controller
Python
11
star
32

PS2X_lib

Arduino Playstation2 library with compiler warnings fixed
C++
10
star
33

BreezyLidar

BreezyLidar - Simple, efficient, Lidar access in Python and C++
C
10
star
34

MSPPG

Multiwii Serial Protocol Parser Generator
10
star
35

RoboFirmwareToolkit

Simple C++ Robot Firmware Toolkit for makers
C++
10
star
36

DshotSTM32

DSHOT protocol library for STM32 microcontrollers
C++
9
star
37

CrossPlatformDataBus

Cross-platform C++ support for I2C and SPI devices
C++
9
star
38

ArduRust32

Calling Rust code from an Arduino sketch on STM32 microcontrollers
Python
8
star
39

pidcontroller

Simple example of an altitude-hold PID controller in Python
Python
7
star
40

kbhit

A Python class implementing KBHIT, the standard keyboard-interrupt poller
Python
7
star
41

DSMRX

Cross-platform interrupt-based C++ library for Spektrum DSM receivers
C++
7
star
42

LambdaFlight

Haskell-based flight controller with support for SITL simulation
C
6
star
43

PMW3901

Arduino library for PMW3901 optical flow sensor
C++
6
star
44

CA

Cellular automata in Matlab
MATLAB
6
star
45

PyMaxBotix

A cross-platform Python package for reading from MaxBotix ulatrasonic distance sensors
Python
6
star
46

TinyFlight

Minimalist flight-control firmware with simulator
C++
6
star
47

ArduEye

Arduino libraries and support for Centeye vision chips
C++
5
star
48

RXInterrupt

Interrupt-driven PWM RC receiver handling for Arduino
C++
5
star
49

TwoStepFilter

English translation of Jung Keun Lee's Two-step Kalman/Complementary Filter for Estimation of Vertical Position
TeX
5
star
50

PAA3905

Arduino library for the Pesky Products PAA3905 optical flow camera
C++
5
star
51

OpticalFlow

Simple header-only C++ library for optical flow
C++
5
star
52

AirSimCar

Quickstart for driving the car in Microsoft AirSim
Python
4
star
53

MPU6x00

Arduino library for InvenSense MPU6000/6500 IMU using SPI bus
C++
4
star
54

BMI270-SPI

Simple Arduino library for the Bosch BMI270 inertial measurement unit over the SPI bus
C
3
star
55

ES-Gym

Evolutionary Strategies in PyTorch for OpenAI Gym environments
Python
3
star
56

NMEA

NMEA parsing in C++ with Arduino example
C++
3
star
57

BreezyRobotArm

A simple Python library for controlling robot arms
Python
3
star
58

PythonSockets

Simple socket examples in Python
Python
3
star
59

Besties

Simple serial communication between Arduino Mega and its new BFF, ODROID XU4 with Shifter Shield
Arduino
2
star
60

HackflightGCS

Windows executable for Hackflight Ground Control Station
2
star
61

gym-mygame

A template for making your own OpenAI Gym game environment
Python
2
star
62

FreeSixIMU2

An updated version of the FreeSixIMU library that works with the Arduino Due
C++
2
star
63

LateralInhibition

Matlab software for Levy & Gayler (2009) "Lateral Inhibition" in a Fully Distributed Connectionist Architecture
MATLAB
2
star
64

SUEAP

Suite of Evolutionary Algorithms in Parallel for Matlab and Python
MATLAB
2
star
65

NengoCPP

Example of how to call the Nengo neural simulator from C++
C++
2
star
66

ArduinoTools

Useful sketches for Arduino-compatible microcontrollers
Makefile
2
star
67

MS5637

Cross-platform C++ library for the MS5637 barometer
C++
2
star
68

vsarobot

VSA Behavior-Based Robot Demo with V-REP
C++
2
star
69

arduino-STM32L4

Arduino support for STM32L4 Flight Controllers
C
2
star
70

TinyNEF

Simple implementation of the Neural Engineering Framework
Python
2
star
71

MB1242

Cross-platform C++ library for for MaxBotix MB1242 sonar
C++
2
star
72

LSM6DSM

Cross-platform C++ library for the STMicroelectronics LSM6DSM Inertial Measurement Unit
C++
1
star
73

simondlevy.github.io

JavaScript
1
star
74

bolt-esc

ESC board for Crazyflie Bolt 1.1
1
star
75

simdvs

Simple Python-based Dynamic Vision Sensor simulator
Python
1
star
76

MultirotorDynamics

Multirotor dynamics in Matlab, Python, and C++
MATLAB
1
star
77

BotBoarduino_CH3R_PS2

Cleaned-up version of Lynxmotion BoardBoarduino code for CH3-R hexapod robot
Arduino
1
star
78

ArduinoPrintf

A C-like printf() function for the Arduino
C++
1
star
79

PyGCSUDP

Python API and joystick example for OpenPilot Ground Control Station UDP connection: fly OP with a joystick!
Python
1
star
80

STM32F4_MPU6000

Reading from the MPU6000 IMU using the STM32F405 MCU
C++
1
star
81

WaveshareOLED

Arduino library for Waveshare 1.5" OLED RGB display
C++
1
star
82

huffcode

Simple Huffman code implementation in Python
Python
1
star
83

MAVLinkAutoPylot

Python support for autopilot on MAVLink-based flight controllers
Python
1
star
84

Hackflight-VREP

VREP-based flight simulator using the Hackflight flight control firmware
C++
1
star
85

eDVS

Arduino / Python support for the iniVation eDVS sensor
Python
1
star
86

PECON

Parallel Evaluation CONntroller: Run Matlab in Parallel on your Multicore PC or Unix Cluster
MATLAB
1
star
87

CPPMRX

Bare-bones Arduino library for reading from CPPM receivers
C++
1
star
88

HackflightCPP

C++ flight-control toolkit for makers
Java
1
star
89

WinJSTest

A little Windows console program for testing joysticks , game controllers, and similar devices
C++
1
star
90

CMA-Gym

CMA-ES for OpenAI gym environments
Python
1
star
91

Centeye

Moved to https://github.com/simondlevy/ArduEye
1
star