I propose to use a flight controller resp. a FC software like [Betaflight][1] connected to a Arduino or Raspberry Pi.

The new F3 or F4 flight controllers have, in general, I2C/SPI interfaces where you can call the FC functions.  


  [1]: https://github.com/betaflight/betaflight/releases