0
$\begingroup$

I am currently working on a hobby project involving a device that will be attached to a golf driver club. Its primary function is to continuously measure the angles (pitch, roll, yaw) throughout the swing. This will allow me to monitor specific parameters, such as pitch at 60 degrees, roll at 15 degrees, and yaw at 10 degrees.

For this purpose, I am currently utilizing an accelerometer and gyroscope sensor (LSM6DSR) and contemplating the addition of a magnetometer (LIS3MDL).

Various fusion algorithms can be employed to combine the data from each sensor, including the Complementary filter, Kalman Filter, Extended Kalman Filter, Mahony Filter, and Madgwick Filter, among others.

However, my initial attempt with a simple complementary filter proved inadequate, as even minor vibrations caused the angles to become highly unpredictable.

Hence, my first question is: which filter would be best suited for my application? It is worth noting that I am utilizing an STM32 microcontroller with a clock frequency of 72MHz and a Floating Point Unit (FPU), enabling me to perform complex calculations during the swing if necessary.

Moving on to my second question, regarding the calculation of the pitch: can the accelerometer and gyroscope alone provide accurate measurements, or should I consider incorporating magnetometer values as well? Alternatively, is the magnetometer primarily utilized for yaw calculations?

$\endgroup$
3
  • $\begingroup$ Its worth noting that dedicated IMUs with all this stuff combined will often filter the information itself and provide you a ~100hz orientation output using highly tuned / calibrated filtering techniques leveraging the specifics of each of the measurement devices. That may be worth taking a look into since they cost only a few dollars and might solve alot your problems. $\endgroup$ May 29 at 21:18
  • $\begingroup$ @StevenMacenski That sounds interesting! Could you give me an example of one of those IMUs so I can look into them? :) $\endgroup$
    – Gripen
    May 30 at 22:03
  • $\begingroup$ BNO055 or BMIXXX are ones I've worked with in the past in the context of mobile robotics and am happy with. Those are relatively inexpensive (dev kits are only $30) but you can definitely go higher end which have much fancier fusion. $\endgroup$ May 31 at 23:03

1 Answer 1

1
$\begingroup$

In my experience, The Madgwick Filter is one of the fastest ways to implement an AHRS system, as there are many open source implementations and requires very little tuning effort.

If your IMU is cheap, you could consider fusing the magnetometer data for heading correction but it must be properly calibrated, especially if the IMU is placed nearby iron materials (the golf club?) or undergo heavy magnetic field distortions.

$\endgroup$
3
  • 1
    $\begingroup$ +1, seconding the Madgwick filter; it's what I recommend to everyone for all IMU sensor fusion questions. If you read his paper (warning: direct PDF download) it outperforms the Kalman filter for pose estimation, there's no tuning involved, and it's already written in C and Python on his Github and C#, Matlab, and LabVIEW on the bottom of his website. $\endgroup$
    – Chuck
    May 30 at 9:11
  • 1
    $\begingroup$ @Chuck Hello! I just wanted to come back here and thank you for the Madgwick recommendation! It really was what I was looking for and I get absolute perfect pitch roll and yaw values that is very resistent to me shaking the sensor which is exactly what I need. So once again, thanks!! $\endgroup$
    – Gripen
    Jul 18 at 12:42
  • $\begingroup$ @Gripen glad it's working for you! It was SystemSigma_'s answer here, I was just endorsing the recommendation. Please be sure to accept the answer so future visitors can find the same information quickly! $\endgroup$
    – Chuck
    Jul 18 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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