Skip to content

Commit 0368775

Browse files
committed
Add optional estimation without magnetometer.
1 parent 18be81d commit 0368775

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ahrs/filters/complementary.py

+3
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109

110110
import numpy as np
111111
from ..common.orientation import ecompass
112+
from ..common.orientation import acc2q
112113
from ..utils.core import _assert_numerical_iterable
113114

114115
class Complementary:
@@ -268,6 +269,8 @@ def am_estimation(self, acc: np.ndarray, mag: np.ndarray = None) -> np.ndarray:
268269
q_am : numpy.ndarray
269270
Estimated attitude.
270271
"""
272+
if mag is None:
273+
return acc2q(acc)
271274
return ecompass(acc, mag, frame='NED', representation='quaternion')
272275

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

0 commit comments

Comments
 (0)