-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] in Madgwick -> update_marg #1
Comments
That is quite interesting. The algorithm implementation is not written by me but by Sebastian Madgwick himself. If I see it correctly at a first glance, the bug you are referring to is also present in the files downloadable at https://x-io.co.uk/open-source-imu-and-ahrs-algorithms/ ("C code (Header and source files)"). Is this correct? Unfortunately, I probably won't be able to find time to dig through the whole algorithm in the near future. On a first glance, I agree that a factor of two seems to be missing in the code somewhere. Have you checked that this missing factor is not indirectly compensated somewhere else in the code? |
Yeah, the formula in the C code from this link and in this repo are the same. At the beginning, I used the C code above and got unreasonable results using 9-axis Madgwick's algorithm. For example, when I set beta to 0.041, which is an official recommended param setting, the quaternion converges dramatically slowly. However, when I changed beta to 2.0, the output quaternion turns out to be reasonable. So I compared the C code in this repo and a python lib here. I fed the same inputs and got different outputs (for 9-axis algorithm). Then I did 2 things:
Anyway this implementation is out of date and no more maintained. XD |
Just to see if this has an influence on the errors presented in the BROAD paper, I ran the evaluation code with your fix. And indeed, the error (TAGP) decreases slightly, from 4.96° to 4.69°. Fortunately, this just changes the numbers a little bit, but all comparisons and conclusions drawn in the paper remain valid. The note about the x-io page no longer being maintained is quite recent. I am sure that many people still use this implementation and consider it to be the canonical version. So it is quite unfortunate that apparently there is a bug in this code and probably nobody will fix it. (Note that there is another version of the algorithm found in the appendix of the technical report. This version also handles the mag update slightly different.) In this repository, I would like to keep the algorithm code in the original version, since the paper explicitly states that the implementation from the x-io website is used. I'll add a link to this issue in the README so that people using this implementation will be made aware. Slightly off-topic: If you are interested in IMU orientation estimation, you might want to take a look at https://github.com/dlaidig/vqf. |
Thanks for your great and valuable work on BROAD dataset and I am looking forward to studying your new work. |
This is the code in
void MadgwickAHRS::update
of example_code/madgwick_mahony_c_code/MadgwickAHRS.cpp.While refer to the raw paper of Madgwick Algorithm, I think bx and bz are supposed to be 2 times larger.
The text was updated successfully, but these errors were encountered: