Skip to content

Commit

Permalink
Merge pull request #102 from petrinm/fix-iterating-in-flae
Browse files Browse the repository at this point in the history
Fix loop condition in FLAE-newton implementation
  • Loading branch information
Mayitzin committed Nov 29, 2023
2 parents 18b255f + 20cabda commit 084ed62
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ahrs/filters/flae.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,10 @@ def estimate(self, acc: np.ndarray, mag: np.ndarray, method: str = 'symbolic') -
t2 = -8*np.linalg.det(H.T)
t3 = np.linalg.det(W)
if method.lower() == 'newton':
lam = lam_old = 1.0
lam = 1.0
lam_old = 0.0
i = 0
while abs(lam_old-lam) > 1e-8 or i <= 30:
while abs(lam_old-lam) > 1e-8 and i < 6:
lam_old = lam
f = lam**4 + t1*lam**2 + t2*lam + t3 # (eq. 48)
fp = 4*lam**3 + 2*t1*lam + t2 # (eq. 50)
Expand Down

0 comments on commit 084ed62

Please sign in to comment.