See
this link to ArduPilot.org. And
this link to diydrones. And
this link to mRobotics for hardware.
Probably the leading "open source" autopilot software, although there are others. A version was provided in the 3D Robotics SOLO system. This is a huge topic... and I am far from being a good source of information any more. My remaining three, upgraded SOLOs sit in a closet except when flying a 360 degree video camera. You might dive in to the 3DR Solo forum related to this forum.