This C++ program is used to fly the Cayley 1 quad rotor aircraft. Using inputs from an IMU and Ultrasonic sensor the aircraft calculates its Euler angles and self stabilise by passing these though a PID controller and controlling the rotors. User control is also possible from a XBee radio module.