I picked up an US$8.50 MPU-9250 9-axis IMU (inertial measurement unit) for my Raspberry Pi 3B based GoPiGo3 robot this week. Connecting it up electrically was very simple, and I quickly got a basic “directly read the accelerometers, gyros, and mags over I2C” working.
This IMU has two features that are more complex: data filtering, and a FIFO readings buffer.
I have not found documented Python examples for these two features.
Even after finding or figuring out these, I will still need to package the features up for asynchronous processing, with a further complication that I don’t have an interrupt line connected.
I’m thinking I need an IMU process (not threaded, true multi-processing) which
- configures a known sample rate, and then
- periodically reads the FIFO
- tags each sample with a time or time since “zero point”, then
- creates an integrated “pose” (zero point referenced X,Y,Z, heading, speed), and
- stuff poses into a Queue that was passed from the parent process
- and also handles periodic correction against drift when the bot stops moving
so that my robot can periodically pop the poses when it wants to know where it is
(Disclaimer: I know the errors build quickly. I want to see what is possible.)