I have raw data of Gyroscope and magnetometer. on basis of this data, i have to calculate Heading information with an accuracy of 1Deg.
I would like to know, is there any algorithm which can help me to get heading info using available information with mentioned accuracy?
Any article or any link also will be helpful.
Thanks
I am assuming you are using phone to collect
gyroscope+magnetometer
data.You cannot calculate Heading with
Gyro+Magnetometer
unless you know initial state of device. You have to tryAccelerometer+Magnetometer
. You can get heading values fromrotation-matrix' or
yaw` component from Motion sensor API of Android/IOS device.If you want to implement of your own try tilt-compensation algorithm. All you have to do is implement tilt- compensated ecompass using
accelerometer
andmagnetometer
. You getaccelerometer
andmagnetometer
readings in device frame.Accelerometer
andMagnetometer
gives readings as a function of rotation of device. This rotation contains information of Roll, Pitch and Heading of device. Following is explanation and derivation of heading estimation usingaccelerometer+magnetometer
.Tilt compensation algorithm
Let
accelerometer
andmagnetometer
give youreadings respectively. They are in device frame, and device is rotated through
.
Where is heading you are looking for. So rotation matrix of device will be
We have to solve for . So step by step solving for .
From above, equating to zero we get
Having from above
This is basic method of obtaining Heading value from
accelerometer+magentomete
. Yaw/Heading value is provided by Motion sensor APIs present in mobile phones.You have to look at few things while implementing
sensor-fusion
algorithms.Accelerometers
doesn't always gravity direction, it gives direction of ovarall acceleration experienced by the sensor eg, devices under linear accelerations.Magnetometer
readings are subjected distortion due to ferromagnetic substances in vicinity. Accuracy depends on systematic bias component ingyroscope
sensor too.There are numerous algorithms to estimate accurate heading values. Some of them are