Search code examples
filteraccelerometergyroscope

How to use Madgwick filter


There is data from the gyroscope and accelerometer:

gyro_xyz = [gyro_x,gyro_y,gyro_z]
acc_xyz = [acc_x,acc_y,acc_z]

There is an implementation of the Majwick filter on Python: Madgwick filter
I create an object:

angles = MadgwickAHRS()


I push the data into the object:

angles.update_imu(gyro_xyz,acc_xyz)

What's next??
Explain how to use the Medjwick filter in a Python script if I need to get angles along the X, Y, and Z axes in degrees.


Solution

  • you can convert the quaternion to euler angles by using the Quaternion class method to_euler_angles()

    rpy = angles.quaternion.to_euler_angles()
    print("rpy: ", rpy)
    

    hope it answer your question