Controlling a flying robot (or anything else) is a very complex subject (well, people are doing PhD on it..). I can recommend [this][1] free online course on the subject (I have taken it myself). It will give you a little taste of what it is. [1]: https://www.edx.org/course/autonomous-navigation-flying-robots-tumx-autonavx#.VJCQxyvF9bA