The QCISRFIFO.py code is finally up and running; this is where the standard GPIO ISR callback function puts each sample into a python Queue (FIFO) and the motion processing empties the queue periodically and does the motion processing. The code now allows for easy setting of both the sampling rate and the number of samples per motion processing. Testing reveals some interesting results. With the IMU sampling rate set to 1kHz, a nominally 9 second flight (in the lab so no props are spinning) actually takes 15s. So although the IMU was sampling at 1kHz, the GPIO code was missing some of the 50us pulse data ready interrupts from the IMU and the result sampling rate was only 608Hz i.e. 40% of samples were lost. Dropping the IMU sampling rate to 500Hz resulted in an equivalent sampling rate of 441Hz or only 11% of samples were lost. Dropping down to 333Hz IMU sampling led to 319Hz or 4% loss of samples.
For each I had motion processing happening every 10 samples, so at approximate 60Hz, 44Hz and 32Hz. I think 32Hz motion processing is just about enough to maintain good stability, so I gave it a go. Wobbly to say the least, and clearly in need of some PID tuning, but I think there is a chance this may prove to be the new way forwards. Once I’ve done a bit more tuning I’ll try to get a video done, hopefully tomorrow.