Data fusion of gyroscope and electronic compass using compensation algorithm to calculate azimuth

Source: Internet
Author: User

When an electronic compass, such as a hmc5883l or MPU9250, AK8963 the azimuth, it is often found that the angular jitter of the measurement is severe. Even though it does not move, the angle changes in a small range. At this time, we need to use the gyroscope to compensate the azimuth angle and fusion, and obtain the stable data. This paper only discusses the azimuth of 2D space, which is the z-axis data of the electronic Compass X, y two-axis data fusion gyroscope.


1. Electronic compass and gyroscope measurement physical significance

Electronic compass: 0-360 degrees of azimuth, also known as yaw. Angle is arctan2 (y,x)

Gyroscope: angular velocity around an axis, where we only consider the z-axis, which is equivalent to the speed at which the azimuth changes.


2. Fusion Algorithm Formula

At some point in time TX , the electronic compass value is YawcompassTX, the gyroscope value is YawgyroTX, the fused data is YawfuzeTX

At the next point in time tx+1, the gyroscope calculates an angle change of Delta_yaw = Yawgyrotx+1* delta_t, where delta_t = tx+1 - t X

Yawfuzetx+1 = K * (yawfuzeTx+ delta_yaw) + (1-k) * Yawcompasstx+1


The value of k is generally [0.9, 1], the physical meaning is the degree of trust of the gyroscope.

At T0 Point in time, YawFuzeT0 = YawCompassT0




Data fusion of gyroscope and electronic compass using compensation algorithm to calculate azimuth

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.