Skip to content

Commit

Permalink
Add optional estimation without magnetometer.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayitzin committed Jul 12, 2022
1 parent 18be81d commit 0368775
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ahrs/filters/complementary.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@

import numpy as np
from ..common.orientation import ecompass
from ..common.orientation import acc2q
from ..utils.core import _assert_numerical_iterable

class Complementary:
Expand Down Expand Up @@ -268,6 +269,8 @@ def am_estimation(self, acc: np.ndarray, mag: np.ndarray = None) -> np.ndarray:
q_am : numpy.ndarray
Estimated attitude.
"""
if mag is None:
return acc2q(acc)
return ecompass(acc, mag, frame='NED', representation='quaternion')

def update(self, q: np.ndarray, gyr: np.ndarray, acc: np.ndarray, mag: np.ndarray = None, dt: float = None) -> np.ndarray:
Expand Down

0 comments on commit 0368775

Please sign in to comment.