Tuesday, 4 June 2013

Using two Raspberry Pi's to control a quadricopter

After the tricopter adventure I decided to go quadri! This means more payload and it also makes it easier/cleaner to strap various electronics on it and prototype things. Here's the result:


Back to the Raspberry Pi+WIFI transmission system, I've made some good progress. Initially the transmitter software only worked on Windows, so I ported it to Linux. It now runs on a second Raspberry Pi, aka "the ground station"! I'm using the Linux joystick API, via my own C++/object wrapper, and it works nicely with every game controller I have in store, including the XBox one...


...and an RC transmitter connected as a USB joystick (so not radio-transmitting!). The laptop on the picture is used to SSH the two PIs.


I had to do quick a few tests before finding decent values for the gains I apply to the different controls on the joysticks (throttle, rudder, etc...). In a nutshell, a stick returns a value between say -0.5 and 0.5, and I had to convert that into adequate PWM values for the KK board. The problem is that a thumbstick on an XBox controller is physically very different from one on an RC transmitter, it's much smaller so you're less precise as it moves faster with your thumb. It needs to be less sensitive than the RC stick.

Anyway the flying experience proved to be pretty correct.


Oh I forgot to say that in order to investigate latency, I first tried a wired version of the transmission system. The flying Pi was controlled with a joystick plugged directly onto it. In other words, this was a WC-quadricopter!


Next up: dual-command and quadricopter training school!