Tested PWM Dithering

Fixed a few bugs with the dithering. There were too many sub-quantization levels for the PWM frequency that the motor controllers use - at 50Hz, 8 sub-levels means that the dithering cycle is at least 6.25Hz, so each cycle was so slow it was even audible. Decreased it to 4 sub-levels; it might be good to go even less than that depending on testing with actual stabilization.

Tried to reproduce an I2C communication bug that was happening when trying to read from Accelerometer or Gyroscope (ioctl failure...), but I can't reproduce it anymore. Tried feeding different voltages to the power supply which I thought was related to the issue (hi battery voltage seemed to be correlated with more failures), but with a voltage-controlled power supply it isn't reproduced. Might just have to ignore the I2C errors in the code.
Two-Staged PID; Timed Synchronous Update

Redesigned the update routine so that it is controlled by a timer. The user of the Drive class specifies an update rate, and then a timer signals a separate thread which runs the update routine. Hopefully this will help with reliability and also be more synchronous with the sensor update rate. Stopping and restarting the timer hasn't been tested, though it's probably not a very useful API.

Changed the PID control to be a two-staged ("cascaded") PID control. In this setup, the output from one PID is used as the input for the 2nd PID (PID in series), and the 2nd PID output goes to the motor speed. The 1st PID takes the angle as input, while the 2nd PID takes angular *rate* as input (i.e. gyroscope). In this way, the control loop acts as if trying to achieve the appropriate angular rate instead of directly the desired angle. Credit for idea to Oscar Liang (blog.oscarliang.net/quadcopter-pid-explained-tuning/)