Skip to content

Commit

Permalink
Enforce returning numpy array in method updateMARG of AQUA.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayitzin committed Jan 24, 2025
1 parent 443c402 commit 45bdf8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ahrs/filters/aqua.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ def updateMARG(self, q: np.ndarray, gyr: np.ndarray, acc: np.ndarray, mag: np.nd
# CORRECTION
a_norm = np.linalg.norm(acc)
if a_norm == 0:
return qInt
return qInt.to_array()
a = acc/a_norm
gx, gy, gz = qInt.to_DCM().T @ a # Predicted gravity (eq. 44)
# Accelerometer-Based Quaternion
Expand All @@ -1077,7 +1077,7 @@ def updateMARG(self, q: np.ndarray, gyr: np.ndarray, acc: np.ndarray, mag: np.nd
# Magnetometer-Based Quaternion
m_norm = np.linalg.norm(mag)
if m_norm == 0:
return q_prime
return q_prime.to_array()
lx, ly, _ = q_prime.to_DCM().T @ (mag/m_norm) # World frame magnetic vector (eq. 54)
Gamma = lx**2 + ly**2 # (eq. 28)
q_mag = np.array([np.sqrt(Gamma+lx*np.sqrt(Gamma))/np.sqrt(2*Gamma), 0.0, 0.0, ly/np.sqrt(2*(Gamma+lx*np.sqrt(Gamma)))]) # (eq. 58)
Expand Down

0 comments on commit 45bdf8f

Please sign in to comment.