-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Math errors in AQUA filter #103
Comments
Hi, thanks for pointing this out. However, I couldn't find a problem with the mentioned expressions, and I think I know why the confusion appears: the authors use a different convention. In the section
The forward quaternion derivative (eq. 37) is defined in the article as: But, in AQUA's case they need the derivative of the inverse unit quaternion defined as: A couple of things to notice here:
To linearize this operation, they redefine the derivative in matrix form: Here is where the confusion arises. It is true that the product has to be negated, so that we can obtain the expected inverse derivative. However, the elements in the Admittedly, I also got confused initially, because the article omits the product with Additionally, I tested the change from This confirmed my initial hypothesis that the definition of the quaternion derivative has been correctly set. Regarding the quaternion from magnetometer as you mentioned. I assume you refer to the denominators dividing Here I couldn't find any missing parenthesis. Both denominators are surrounded entirely by parenthesis, and performing as expected. I refactored the code, so that each element is defined per line. Maybe, someone can double check that the definitions are ok. |
To calculate quaternion using gyroscope by integration of measurement, the factor is not 1/2 but -1/2 (sign error).
qDot = -0.5*self.Omega(gyr) @ q # Quaternion derivative (eq. 39)
To calculate quaternion for accelerometer and magnetometer (no gyroscope):
if lx >= 0:
q_mag = np.array([np.sqrt(Gamma+lxnp.sqrt(Gamma))/np.sqrt(2Gamma), 0.0, 0.0, ly/(np.sqrt(2)np.sqrt(Gamma+lxnp.sqrt(Gamma)))])
else:
q_mag = np.array([ly/(np.sqrt(2)np.sqrt(Gamma-lxnp.sqrt(Gamma))), 0.0, 0.0, np.sqrt(Gamma-lxnp.sqrt(Gamma))/np.sqrt(2Gamma)])
Missing parentheses at denominator: a/bc =/ a/(bc)
I found so many bug during the C rencoding process. You should check your code using simulate script of an IMU or use it in real implementation...
The text was updated successfully, but these errors were encountered: