Skip to content

Commit

Permalink
Small fix for madgwick
Browse files Browse the repository at this point in the history
  • Loading branch information
AKuederle committed Feb 20, 2025
1 parent 2d3ab95 commit 101a8c8
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ def _madgwick_update(gyro, acc, initial_orientation, sampling_rate_hz, beta):

# Switch the component order back
s = np.array([s1, s2, s3, s0])
mag_s = np.sqrt(np.sum(s**2))
if mag_s != 0.0:
s /= np.sqrt(np.sum(s**2))
norm_s = np.sqrt(np.sum(s**2))
if norm_s != 0.0:
s /= norm_s

# Apply feedback step
qdot -= beta * s
Expand Down Expand Up @@ -298,9 +298,9 @@ def _madgwick_update_mag(gyro, acc, mag, initial_orientation, sampling_rate_hz,

# Switch the component order back
s = np.array([s1, s2, s3, s0])
mag_s = np.sqrt(np.sum(s**2))
if mag_s != 0.0:
s /= np.sqrt(np.sum(s**2))
norm_s = np.sqrt(np.sum(s**2))
if norm_s != 0.0:
s /= norm_s

# Apply feedback step
qdot -= beta * s
Expand Down

0 comments on commit 101a8c8

Please sign in to comment.