How to combine data from Gyro and Accel

Ok, so after some experiments on different approach in filtering the data,I’m now interested in how to mix data from GYRO and ACC in order to get optimized results.

As always, also this time I found out a very interesting article that describe exactly this type of approach: kalman filter vs complementary filter.

Here it is possible to find how to implement 2 type of complementary filters, and the kalman filter to solve our problem.If you are interested in the kalman filter I strongly recommand to have a look on it since it is really simple to be implemented.I have to say that is is written for Arduino, not in python, but I don’t think this can allarm us.

Personally I just implemented the first order complementary filter and it seems to solve both the noise and drift problem.

IMU_Fusion1

In the picture you can see the comparison between the returned angle from gyro, from acc,  from the complementary filter and also from the complementary filter  using the acc data filtered with kalman filter.

As you can see the gyro drift that is really evident in the right (the blue line) is completelty deleted .

IMU_Fusion2

Here it is the pic zoom of the left side, where the registered acc noise is clear (red line).Look as the complementary filter reduces it strongly.

So finally after this test I decide to implement the complementary filter on my sw.

You can  find it here as IMU_Test3.

Note that the complementary filter is included directly in the imu_test.py code in the getAngleCompl() .

Now I can say that the development related to the IMU can be frozen at this stage. Now I want to move this into a python object that runs in a parallel thread so  I can monitor the IMU data anytime. After that It’s time to investigate in the PID.

Advertisements

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