MPU9150 Sensor Fusion speed on Raspberry PI

After seeing the parts list of PenguPilot for a Raspberry PI only approach, I ordered an IMU 10DOF with an MPU9150 (Gyroscope, Accelerometer, Magnetometer) and an MS5611 (Barometer, Thermometer) at http://www.ebay.de/itm/271393599577. I do not plan to rebuild that quad, but I will try to build on their PenguPilot software, which seems to be pretty well crafted on a first look and is definately worth another post later.

20150610_221422 20150610_221538

Apart from the already known fact that the MPU9150 is compatible to the MPU6050 (which I already use in the Arduino+Raspberry Pi combination), this blog post says that the RTIMULib library is able to get approximately 860 Samples per second (including Kalman filtering) on a 900 MHz Raspberry Pi.

The latest version of RTIMULib has an optimized MPU-9150 driver and, using a 900MHz Raspberry Pi, it can achieve 860 Kalman-fused samples per second at around 28% CPU utilization (and using a 400kHz I2C bus). Not quite the magic 1000 samples per second supported by the MPU-9150 but not too bad. This is more of a stress test than something real but it suggests that operation at up to 500 samples per second is probably practical.

For me, this is really great news:

  1. 500 samples per second is really much more than I had hoped for on a Raspberry Pi. With my hand-crafted Python Kalman filter I only got to around 50 samples per second on the Raspberry Pi 1.
  2. Now I have a Raspberry Pi 2, which should be able to handle even more (or at least do the same with less CPU usage)
  3. Although many professionals use 1 kHz like scientists from ETH Zürich in this paper about quadrocopter multi-flips, 100 Hz are said to be enough to handle stable (normal) flight: http://www.thomasteisberg.com/quadcopter/

    All of these calculations are performed approximately every 12 milliseconds. If the rate is significantly slower than this, the quadcopter cannot correct fast enough to stay in the air, so optimizing the code to prevent delays was essential.

    So it seems that the Raspberry Pi 2 is able to handle the basic flight control loop / attitude sensor fusion with sufficient speed while also doing high-level sensor (altimeter=height, GPS position, distance to ground) fusion in a separate thread.

Advertisements

One thought on “MPU9150 Sensor Fusion speed on Raspberry PI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s