quietlychris / quadcopter

Early work on an embedded Linux-only flight controller for a quadcopter in Rust
GNU General Public License v3.0
12 stars 3 forks source link

quadcopter

This is a proof-of-concept attempt working towards building a Linux-based quadcopter flight control system.

Basis thesis

Many flight control systems are currently written on either bare metal or using an RTOS. These techniques are often less approachable to developers, as they tend to require somewhat complicated toolchains and either sophisticated simulators or hardware-in-the-loop development. Furthermore, this was often necessitated by relatively slow computation--the timing requirements on control loops meant that even a few years ago, it may have been difficult to run a non-deterministic control loop on a single-threaded board and be relatively certain that it would run quickly and reliably enough without the main thread hanging at any point. The past few years have seen many more low-cost, multi-threaded high performance ARM single-board computers running Linux become available, which may offer a way to build a flight-control system using only the board's standard I/O and a few peripherals, such that the native performance of the board is high enough maintain stable flight using an off-the-shelf Linux SBC.

Notably, this idea was heavily explored by Anders Martenssson at the Blekinge Institute of Technology in their senior thesis paper, which seemed to indicate this approach could be relatively promising.

The hardware

This is the hardware I'm currently using. Most of these components could feasibly be switched out with something else if necessary (which is sort of the point), but in general you can assume that these will work together.

Plus things like screw terminals, plastic rotors, a WiFi adapter for the Odroid-C4. As mentioned, for the motor power, I'm using a 3S/30C LiPo battery using XT-60 connectors, which is actually pretty important--I'm registering somewhere between 1.5-2.0A per motor to get flight at the moment, which was more than my 5A benchtop power supply could produce, so I had switch over to a LiPo battery for development.

quadcopter

Current state

Subsets of this code, with the described hardware have been proven to work on one and two-axis stabilization controls problems. In other words, a single motor/propeller on an unsupported lever arm can indefinitely maintain a level position with low oscillation. The same goes for an in-line pair of lift-producing motor on opposite sides of a pivot point.

I've also done some work with all four motors running, and holding a quadcopter chassis from the corner (I haven't finished the counter-rotation yet for the motors I've been using, so I can't let go entirely) the quadcopter is able to stay relatively level in plane with little input from my arm. When I kill the control signal, the chassis drops, so I believe it's safe to say that the attitude control system is at least close to working.

License

This code is licensed under GPLv3