The BAT (Brown Avionic Trainer) is a drone that uses the Rasberry Pi and Python to autonomously fly. It can be equipped with a camera, IR, and sonar sensors in order to find its height, localize itself, and hold its position. It uses Cleanflight and the Skyline flight controller as an IMU, gyroscope and flight controller. The total cost of the drone is around $250.

Rasberry Pi 3 $35 1 Computer and processor for the drone. Integrates all sensor information and sends commands to actuators.
16GB Micro SD $8.18 1 This is the onboard storage for the raspberry pi. All of our code goes on here.
Rasberry Pi camera $14.99 1 Rasberry Pi camera. It points downward and allows the drone to image the space it is flying over.
Pi Mount ~$0 1 We 3D printed a mount to attach the Rasberry Pi to the frame. The CAD model is linked above.
Battery Eliminator Circuit (BEC) $3.90 1 This 5V switching regulator drops the voltage from the battery to 5V so that we can power the Rasberry Pi from the battery. (There is a BEC included with the frame which is not sufficiently powerful to drive the PI, so we use this one)
Sharp 10-80cm IR Range Finder $10.79 1 Infrared distance sensor. Points downward and measures distance to the ground. We use it for altiude control
Adafruit Analog to Digital Converter $9.95 1 This device allows us to use the raspberry pi to read from the infrared sensor. It converts analog signal to digital.
250mm Frame $12 1 This 250mm plastic racing quad frame is the chasis for the drone.
Skyline 32 Flight Controller $15.43 1 Intertial Measurement Unit (IMU) and gyroscope. Measures the linear and angular acceleration the drone is experiencing. Plugs into the Rasberry Pi via USB and talks MSP (Multi Wii Serial Protocol). For more information, read the manual.
6" USB to USB Micro $2.79 1 Connects the Pi to the Skyline.
Motors (Two clock-wise and two Counter-clock-wise) $14.99 4 These brushless motors are the powerhouses of the system. A 3-phase AC signal drives them at variable speeds to keep the drone in the air.
12A ESC (Electronic Speed Controller) $9.90 4 These convert DC power from the battery into three-phase AC. It allows the flight controller to programmatically control the drone. You need an ESC for each of the four motors.
5x4 threeblade propellers $1.54 4 5x4 propellers serve as the wings of this drone. 5 refers to the diameter in inches, and 4 refers to the distance the propeller would travel if turned 1 rotation without slipage, say in jello. Three blades gives us more lift for a given diameter than two blades at the cost of efficiency.
1500mAh 3s LiPo $11.54 1 This lithium polymer battery can supply up to 360 watts of power, and keeps the drone in the air for about 7 minutes.
XT60 Connector with pigtail $5.79 1 The connector for the battery.
TOTAL $225 This price does not include spare batteries, chargers, and tools.

The architecture of the system includes a PID controller that talks to the cleanflight controller and controls velocity (using optical flow read from the hardware MPEG encoder following this paper), as well as height control using the IR sensor. We can also do position control to remember a pose using features.

The Rasberry Pi runs Raspian Jesse and we have installed ROS Indigo. We recomment you use our SD card image since compiling ROS on the Pi takes an extremely long time and strange things can go wrong.

The Flight Controller uses CleanFlight, which is a powerful piece of open-source software for controlling and flying drones. Our system uses CleanFlight and the PIDs in the flight controller to keep the drone level. Then it uses the downward-pointing camera and IR sensor to sense the height and planar velocity and position. It exposes both a velocity-control and position control interface.