Thursday, December 5, 2013

My UAV Project: Part 1


I've been having a lot of fun on a side project of mine lately and wanted to share out what I've been doing, so here it goes!

At a high level, my goal has been automated aerial tracking and cinematography. Basically, I'm about halfway through my hang gliding license and I'd like to be able to share my love for flight with my friends and family via 1st person video and 3rd person video if possible.

Think something like this, but external to my glider and autonomous.

Yeah, I get the willies too just thinking about it.

So I've been researching and tinkering, designing and coding, and otherwise been having a blast with the construction of my new pet quad rotor, SkyCam. From a technical perspective, it's been tons of fun. I've designed and developed almost everything about the hardware platform from the bottom up and done so mostly from scratch. My progress is thus:


Here you see the quad, its restraining harness, a GoPro Hero3+, and a Raspberry Pi (for eventual video encoding and live streaming).

The only thing to come in a kit was the carbon fiber frame. Everything else has been off-the-shelf parts. There's been plenty of work just to get this up and running, but it's been pretty great so far.

For example, the motors didn't adapt to the frame's motor mounts, so I had some fun and milled the mounts to make appropriately dimensioned screw holes.



I also got to bust out my electronics skills. Any cabling or circuitry was built as needed to piece together the hardware. For instance, here's an over-voltage protection circuit to keep the microcontroller from getting fried.



All together, the system has been designed to optimize slightly for time. It's design has a theoretical flight time of anywhere from 20-30 minutes. The agility and carrying capacity are the other two main design parameters. The responsiveness is not acrobatic, but it's also not sluggish. The spare carrying capacity will be somewhere around 400-600 grams. Also, the top speed of the quad must be great enough, and will be, to keep up with the glider. (My glider typically cruises at around 35mph)


On the software side of things, I've been writing all the code from scratch as well. I could have just as easily taken some pre-existing code and adapted it to my platform, but I wanted something truly custom that I built myself. This project is as much about solving the problem of autonomous 3rd party video as it is about learning to design robust embedded systems and UAV solutions.

The software is built on top of off-the-shelf hardware. I've worked with cross compilers/toolchains for embedded systems in the past, so I went the easier route of using Arduino related technology for my flight controller. The sensors are also COTS.

Computing platform(s):

Quad:
  • Arduino Fio
  • XBee 802.15.4 Pro wireless
  • Parallax: Altimeter, Compass, Gyroscope, and Accelerometer
  • GPS

Transponder (relays my position to the quad):
  • Arduino Fio
  • XBee
  • GPS
  • Altimeter

My software currently features the following:

Flight computer:
  • Sensor support
  • Software safeguards
    • Watchdog supported resets
    • Radio out detection and handling
  • UDP-like protocol for handling message communication
  • RPC support
  • Simple C/C++ code that adheres to the embedded principles laid out here
  • Code optimized and hardware configured for low latency communication
    • This enables fine grained remote control (Latencies low enough that the control algorithm can be run remotely, for instance)

Serial client
  • Runs on node.js
  • Written in coffee script
    • Chosen for ease of expression and versatility
  • Contains RPC client code
  • Supports a RESTful interface to said client code

Web client
  • Consumes the serial client's RESTful interface
  • Displays diagnostic information about the quad
  • Exposes basic control knobs and configuration via a convenient web GUI

Currently with all of this combined, my browser can make a request for the quad's sensor data and get it back with a round trip time of roughly 50ms.


Future work:

There's still plenty of work to be done. At present, I'm just about done wrapping up the latency optimizations and am about to start work on the control algorithm so I can get this bad boy up and hovering. Software safeguards are present as well as physical restraints to prevent undesired takeoffs in the event of bugs and otherwise poor code. But hovering and control parameter tuning is just the beginning. After that there are still a myriad of milestones I'd like to meet before demonstrating SkyCam as a solution to 3rd party tracking & filming.

My timeline up until now has been pretty fast paced but reasonable. Here are some of the highlights:
  • 9/21/2013 - Decided to start this project while browsing through components at Frys
  • 9/29/2013 - Quad performance researched and designed. Parts ordered from everyone's favorite hobby wholesaler
  • 10/2/2013+ - Parts start trickling in (wireless, battery)
  • 10/16/2013 - Majority of parts arrive (frame, motors, charger, propellers)
  • 10/27/2013 - Hardware platform's first E2E, remotely controlled, hand-stabilized flight.
  • 11/5/2013 to now - Added all of the software features mentioned above


So far this project's been a blast! Keep posted and hopefully I'll have some hovering footage pretty soon.