Mayitzin / ahrs

Attitude and Heading Reference Systems in Python

Home Page:https://ahrs.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

help AttributeError: 'Madgwick' object has no attribute 'Q'

43998213 opened this issue · comments

from ahrs.filters import Madgwick
>>> madgwick = Madgwick(gyr=gyro_data, acc=acc_data) # Using IMU
The estimated quaternions are saved in the attribute Q.
>>> type(madgwick.Q), madgwick.Q.shape

AttributeError: 'Madgwick' object has no attribute 'Q'

from ahrs.filters import Madgwick

madgwick = Madgwick(gyr=gyro_data, acc=acc_data) # Using IMU
The estimated quaternions are saved in the attribute Q.
type(madgwick.Q), madgwick.Q.shape

AttributeError: 'Madgwick' object has no attribute 'Q'

def __init__(self, gyr: np.ndarray = None, acc: np.ndarray = None, mag: np.ndarray = None, **kwargs):
    self.gyr = gyr
    self.acc = acc
    self.mag = mag
    self.frequency = kwargs.get('frequency', 100.0)
    self.Dt = kwargs.get('Dt', 1.0/self.frequency)
    self.q0 = kwargs.get('q0')
    self.gain = kwargs.get('beta')  # Setting gain with `beta` will be removed in the future.
    if self.gain is None:
        self.gain = kwargs.get('gain', 0.033 if self.mag is None else 0.041)
    if self.acc is not None and self.gyr is not None:
        self.Q = self._compute_all()

sorry misspelling