title_body: What are the available solutions for creating complex user-defined UAV behavior in autopilots?
upvoted_answer: I think your best bet would be Ardupilot. The communication protocol it uses, called MavLink, is documented and easy to use. Connect to the UART with an Arduino and you will have full control over the UAV.
  
  There is even an Arduino library and a bunch of examples, like this forum post, of people doing exactly what you are looking to do. I did this once because I needed to grab the GPS and Compass information for a work project. You can research the various mission control programs that use MavLink to see the extent of control the protocol has. If I remember correctly you can even send direct stick commands over that interface to manually pilot the craft. This solution makes for lots of flexibility, especially when you consider the huge community writing Arduino libraries. It would be simple to add just about any sensor you could want.