The IMU development is coming along but a number of modifications had to be made to get it to work more reliably:
- The original design was updating both IMU and PID loops every 20 ms. I found that this was not fast enough to react to the fast attitude changes of the Quad. To achieve a faster update rate I had to re-write the IMU code and Kalman filters from scratch to allow them to run at a 5 ms update rate.
- The gyro conversion from the raw ADC sample to rad/sec (or deg/sec) was wrong by a factor of two resulting in an error in the short term estimate of the pitch and roll angles (the accels did eventually correct the angle). Fixing the conversion factor considerably improved the the angle response and allowed to tune the Kalman filter to rely on the gyro more than the accels. That results in a much faster IMU response to attitude changes. That can also be seen in the video below. Keep in mind that the artificial horizon is only updated every 100ms through the debug port so there is a noticeable lag in the UI.
- The PID loops now run at a 10 ms rate, the motor ESCs are updated at the same rate however I am not sure how often the input is actually read by the ESC. In any case an improvement was seen with the faster update rate.
- Some more progress was also done on the Windows application that is used to record and display data from the IMU controller in real-time. The update rate is a bit slow (100 ms) due to the large number of channels that are transmitted through the debug port.
- Preliminary flight tests show that a large amount of derivative control is needed in the PID loops to minimize the oscillation. The PID loops were also modified to use the un-biased rates that are calculated by the Kalman filters as the input to the derivative part of the PID loops (rate of change). That allows the loops to quickly react to changes in attitude before the Quad starts oscillating out of control.
- The GY401 Heli gyro works pretty well, in heading hold mode it keeps the Quad steady in the yaw axis. There is a slow drift but this is expected since there is no sensor to measure the absolute yaw. A magnetic compass could be added in the future for that purpose.
More work is needed on the tuning of the PID loops and Kalman filters and this is the next step. Preliminary tests show that stable flight is possible with the current setup!

