This is a high level overview of my current thinking on software architecture:
Runs on Pi
Listens on TCP port for incoming connections from a Remote
Responds to commands from Remote to operate the drone
I can use asyncore module for TCP server part
Uses multiprocessing module to start flight controller loop as a separate Process
Flight controller reads sensors, calculates motor speeds, drives motors and passes sensor data back to TCP server to report to Remote
Must run on multiple platforms (at least Linux, Windows and Android)
Connects to drone via TCP/IP
Displays current info about the drone (sensor data, motor speeds and so on)
Provides controls to operate drone (throttle, pitch, roll, yaw, etc.)
Since everything will be written in Python and most of the above functionality can be done with standard modules, the only questions are what do I use to drive motors and what UI framework to use for Remote.
I tried to test drive motors using RPIO library. Unfortunately, I wasn’t able to get it to work on Pi 2. I tried a fork of RPIO that claims that it fixed Pi 2 compatibility, but it didn’t work either.
After a little research I settled on pipgio library. That worked without any issues and I was able to spin one of the motors from python shell over ssh.
For Remote’s UI I’m going to go with Kivy. I’ve used it before. It is cross platform and lands itself well to quick UI prototyping.
More details to come.