Flying Robot Operating System is designed to be the open source implementation example for your DIY drone.
Around the Internet of robotics, there are a lot of open-source/open-hardware projects to make an awesome flying robot : ROS, MAVLink, PX4, Mavros, Odroid XU4. Multiple companies uses thoses projects to make money without contributing to the community. This is an example of application. As it is no more maintained, use it with care but could could be taken as an example to make yours.
The way the packages are organized are available in the Project architecture file.