3
$\begingroup$

I am currently working on a self balancing robot project. I am going to use a MPU6050 to get data from both the accelerometer and the gyroscope. Since I need to get accurate data in a very small amount of data I need to filter the raw data I get. So many people have suggested me to use the Kalman Filter but I could not comprehend it (the maths behind it). Are there any other types of filters I can use in my project?

Thanks in advance.

$\endgroup$
  • 4
    $\begingroup$ A complementary filter can sometimes be used in these situations. $\endgroup$ – Paul Feb 15 '17 at 22:14
  • 1
    $\begingroup$ So you've giving up one of the best filters (i.e. it is an optimal filter ) that ever been invented just because you don't understand its math?! I don't agree with your logic yet the math of Kalman is trivial. You don't need to understand its derivation though. $\endgroup$ – CroCo Feb 16 '17 at 14:23
  • $\begingroup$ @CroCo you are right. But I just could not find a source that explains it well for me to comprehend. I have checked many websites. All I want to know is what I should do with the data I get from mpu. $\endgroup$ – Huzo Feb 16 '17 at 14:25
  • $\begingroup$ Applied Optimal Estimation by Gelb is a good practical book. $\endgroup$ – CroCo Feb 16 '17 at 14:26
  • 1
    $\begingroup$ You don't need any sensor fusion algorithm if you have already the attitude from a sensor fusion library. The Kalman filter could be used, if you want to get (Yaw, Pitch, Roll) from (GyroX, GyroY, GyroZ, AccX, AccY, AccZ). $\endgroup$ – HansPeterLoft Feb 19 '17 at 9:49
5
$\begingroup$

A good choice for sensor fusion with the MPU6050 is a second order complementary filter, which I used for the orientation estimation in a project. The complementary filter is computational cheap and so a good choice for a microcontroller. A paper about the implementation you can find here:

http://www.academia.edu/6261055/Complementary_Filter_Design_for_Angle_Estimation_using_MEMS_Accelerometer_and_Gyroscope

$\endgroup$
2
$\begingroup$

Particle filters (epecially in Monte Carlo localization) always seemed easy to intuitively understand to me. You basically simulate bunch of possible states of your robot, rank them with probabilities and occasionally you throw away the improbable ones.

There's obviously more to it (and more math), but this should be enough to make a small working test.

$\endgroup$
  • $\begingroup$ Will check it out! $\endgroup$ – Huzo Feb 16 '17 at 9:52
  • $\begingroup$ are you saying that a particle filter should be used to estimate the pitch of the robot? $\endgroup$ – KyranF Feb 20 '17 at 0:49
  • $\begingroup$ Should? No. It's just another tool. Particle filters could be used to estimate it. They would likely end up slower than comparable Kalman filter, but they can handle more complicated inputs and are really dead simple to visualize. $\endgroup$ – cube Feb 20 '17 at 21:04
1
$\begingroup$

Check this website pratical approach to kalman filter it will give you a comprehensive description of kalman filter for a balancing robot (like yours) both theoritical and pratical (you have the code as well). And it runs on an Arduino !

$\endgroup$
1
$\begingroup$

Want to get orientations from accelerometers and gyroscopes?

Use the Madgwick filter.

From the paper, "Results indicate the filter achieves levels of accuracy exceeding that of the Kalman-based algorithm."

As @CroCo mentioned, the Kalman filter is the optimal estimator.... for a linear system signal in the presence of zero-mean, Gaussian noise. Accelerometers and gyroscopes have a non-zero bias, and they also experience bias drift which means that, even if you could measure and offset the bias, the bias isn't stable and changes over time.

The Madgwick filter is free, and even better, there are already efficient implementations of the filter already written in C, C#, and Matlab. You can learn the math if you want, but again the math has already been done and the finished product - the filter - is free to download and use.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.