Compensating Accelerometer readings from gravity i.e., finding out the direction of movement
9 views (last 30 days)
Show older comments
Hello All,
I've a two Quaternions,
QuatA = [0.14396358 0.6159271 -0.1679541 -0.7561083] and
QuatB = [0.7638229 0.526972 -0.36838415 0.056286708]
I've calculated the acceleration due to gravity for these quaternions and they turned out to be
gA = [-0.883057 0.431325 0.18485]
gB = [0.622084 0.763556 0.173187]
But, my ultimate goal is to find the linear acceleration. or in which direction the object is moving.
To achieve this I've to subtract this acceleration due to gravity from the dynamic acceleration.
Can anyone help me out on how to calculate the dynamic acceleration from Quaternions i.e., how to compensate accelerometer readings from gravity.
Thanks in advance.
0 Comments
Answers (1)
James Tursa
on 23 Nov 2015
Edited: James Tursa
on 23 Nov 2015
First, there are too many unknowns. E.g., what are the coordinate systems of the quaternions (ECI to BODY, or what)? Scalar first or last? Left or right successive rotation convention? What is the coordinate system of the gravity vectors?
Second, quaternions typically represent attitudes. There is no linear acceleration information present in them, just rotational information. How is it that you expect to extract linear motion information from quaternions that only contain rotational information? Can you explain the process by which you calculated the acceleration due to gravity for these quaternions?
In summary, your current problem description is incomplete and frankly I don't understand the connection you seem to be implying between quaternions and linear acceleration.
2 Comments
James Tursa
on 23 Nov 2015
Edited: James Tursa
on 23 Nov 2015
Well, I quickly scanned over the material in that link. If the author is claiming to derive an expected direction of gravity from a quaternion, then it must be some Local Level frame to Body, not an ECI to Body as you claim. So that part of what you have written confuses me.
Assuming some Local Level frame, then the g[0], g[1], g[2] calculations in that link simply look like the unit vector obtained from converting the quaternion to a direction cosine matrix (i.e., rotation matrix) and picking off the appropriate elements to form the vertical direction vector. Then assuming the units of the measured acceleration are in g (so the gravity vector has magnitude of 1), I can see where the author could come up with the simple compensation equation he shows in the Python code snippet. Mind you, I haven't checked any of this in detail ... I am simply stating what I have gleaned from a quick look at that link. It is not clear from my quick reading under what conditions the author intended to use this code (e.g., only for sitting still on the ground and not rotating? Or is he trying to develop a generic local level navigator?)
So, what is it that you are attempting to do with this? Do you have data coming from hardware that you need to reduce? Or what?
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!