Coder Social home page Coder Social logo

simondlevy / hackflight Goto Github PK

View Code? Open in Web Editor NEW
279.0 31.0 81.0 704.09 MB

C++ flight-control toolkit for makers

License: GNU General Public License v3.0

C 1.00% Python 33.86% C++ 41.66% Shell 0.08% Batchfile 0.26% Makefile 1.52% Java 1.14% Rust 20.48%

hackflight's Introduction

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

hackflight's People

Contributors

akhazaee avatar alecsinger avatar juangallostra avatar levyswluedu avatar pepms avatar simondlevy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hackflight's Issues

EM7180 USFS - Magnetometer ID not recognized

I'm having issues with using the USFS. I've followed every step in the wiki, including calibration, and the USFS_Master test example is working perfectly. However, uploading the Hackflight firmware results in the error Magnetometer ID not recognized being printed to the serial monitor. Curiously, this error message only shows sometimes, although the actual error persists (GCS always gives the error No response from board). In my case, I got the board to print the error by adding Serial.println("USFS initializing"); just before calling _sentral.begin() in usfs.hpp.

I can't for the life of me understand why this error occurs, since the code in Hackflight's usfs.hpp seems identical to MasterTest.ino, and as I said, MasterTest.ino works perfectly.

error compilation

hi Simond,
I have a little problem on arduino mac v1.8.5 and 1.8.9, I can't compile your superfly, I can't understand why, I add librairy as your wiki.
Can you help me, you will find in attchment my debug compilator on arduino.
Thanks in advance
Regards
error superfly.txt

Hackflight firmware on Windows

I'm looking for firmware code that I can put in AirSim. Basically, this firmware would a simple cross platform library that takes in sensor inputs from the simulator and outputs rotor controls.

Is this possible to do with hackflight firmware?

commits

No commit message

it would be very nice to get an idea what you are doing.
some sort of commit text is very helpfull for all.
the code base is nice.

best
robert

"Firmware uses reciever (DSMX, SBUS), but reciever is not connected"

Greetings,
I have just attempted to use Hackflight with my Quadrino Nano board using Multiwii v2.4.
When I connect the serial device via the hackflight.py UI the error below appears:
Would you happen to have any insight into how this can be solved?

I am certain I have been able to get communication with the board, although spotty in some situtations that I have yet to ascertain.
img-2018-05-31-192630

Manual failsafe

Hackflight already has failsafe (cut motors) for when it loses R/C signal (it works with SBUS and DSMX).

The point here is enabling the user to immediately stop the drone with, for example, a switch, if anything goes wrong.

Traceback when running GCS on a Linux environment

When trying to start the GCS in a Linux environment the following Traceback is raised:

Traceback (most recent call last):
  File "hackflight.py", line 499, in <module>
    gcs = GCS()
  File "hackflight.py", line 133, in __init__
    self.attitude_request = msppg.serialize_GET_ATTITUDE_RADIANS_Request()
AttributeError: 'module' object has no attribute 'serialize_GET_ATTITUDE_RADIANS_Request'

I think that changes made in d7eaa56 may be the culprit.

Basic Hackflight Compiling

Hello Dr. Levy,

I have been having trouble compiling Hackflight for the Ladybug Flight Controller using the Arduino IDE, and I was wondering if you could give me any advice.

I have:

-installed the latest version of the Arduino IDE, 1.8.12

-installed the gnu-arm compiler

I have been developing for the Adafruit Circuit Playground Express M0 (and M4) boards, so I think it works (fun board btw).

Then I:

-cloned the Hackflight repository into the ~/Arduino/libraries/Hackflight folder

-cloned the CrossPlatformDataBus repository into the
~/Arduino/libraries/CrossPlatformDataBus folder

-just in case, cloned the USFS repository into the ~/Arduino/libraries/USFS folder

-cloned the grumpyoldpizza repository into the
~/.arduino15/packages/arduino/hardware/grumpyoldpizza folder

No new boards show up in the Arduino IDE under Tools/Boards. I tried compiling BrushedMotorTest as a Adafruit M4 board and no luck.

Any ideas?

Thanks,
Brian Dunlap

sentral quaternion update rate

I was wondering what the update rate of the kalman filter inside the em7180 really is!? In the manual of the em7180 it says something about 30Hz, which seems a little bit slow for quadrotor attitude control. I understand that the Q_Rate_Divisor sets the speed of the quaternion readings based on the gyro update rate, e.g. 1/5 of 330Hz as in sentral.hpp. But that can also mean that the quaternion I get at 330/5 = 66Hz stays the same for ~2 update cycles. Am I missing something here?

.dll file creation

Hi! I tried creating the .dll file in microsoft visual studio professional 2015, by following the steps as mentioned by you. But each time, I encounter the error: C1083 Cannot open include file: 'v_repExt.h': No such file or directory v_repExtHackflight F:\Haptics\hackflight-master\sim\v_repExtHackflight.cpp
What do I do to overcome it??
P.S.- I use windows 10 ultimate

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.