Mahony filter is a complementary filter, not as accurate as Kalman as I understand it. Is there a reason we aren’t using Kalman? Who should I talk to about helping with this? I’m going to have my VESC soon so I can start contributing.
Yes, I’ve heard about Kalman being better. If you can please add it, I can walk you through the directory structure of the code
The IMU directory has all the IMU related files. There’s currently 3 filter options: Madgwick, Mahony, and Fusion - I can add a stub for Kalman for you if you’d like to populate the actual code
This is the firmware repo:
bldc/imu at release_5_03 · vedderb/bldc (github.com)
And then there’s a matching VESC tool repository as well
Ryan reached out to a freelance control systems engineer who also recommended Kalman filter over Mahony for our application, so obviously there’s something to this that should be explored further!
So the Betaflight software for drones already has a Kalman Filter implementation that has been optimized for F3 microcontrollers called “Biquad RC+FIR2”. Might be worth taking a look there to port over? Biquad RC+FIR2 Filter: Prototype of ledvinap's suggestion on #4890 by fujin · Pull Request #4965 · betaflight/betaflight · GitHub
More info about it: Kalman or BIQUAD+FIR2 filter | IntoFPV Forum