from ahrs.filters import Madgwick
import numpy as np
madgwick = Madgwick()
q = np.array([1.0, 0.0, 0.0, 0.0])
acc_device = [0.08853444, 0.009571291, -9.856036]
gyro_device = [6.8720314E-4,1.5271181E-4,6.8720314E-4]
mag_device=[34.912502, -0.84375006, 53.531254]
from scipy.spatial.transform import Rotation
for i in range(0,10000):
q = madgwick.updateMARG(q, gyr=gyro_device, acc=acc_device, mag=mag_device)
euler = Rotation.from_quat([q[1], q[2], q[3], q[0]]).as_euler('xyz', degrees=True)
print(euler)
The value of the acc/gyro/mag sensor in the above code is read from an Android phone with NED attitude, I thought the output would be three Euler angles of 0, but the actual output is [-59.91242581 -56.71604791 6.81958275], why?
The value of the acc/gyro/mag sensor in the above code is read from an Android phone with NED attitude, I thought the output would be three Euler angles of 0, but the actual output is [-59.91242581 -56.71604791 6.81958275], why?