# How can there be a difference in quaternion values of two points taken from sensors where the orientation is exactly same?

I have two situations-

A) One, the body with sensor embedded in it kept at rest. B) Second, the body is at rest for 10 secs, then undergoes some movement randomly and comes back to the exact orientation as the initial one (at rest) and kept there for rest for 10 secs again.

In the first case, the quaternion values are constant and that is what is expected. But in the second case, these values from the first 10 secs do not match with the last 10 secs. As the orientation is unchanged in both the situations, how can the quaternion values be different? Also, the accelerometer, gyroscope and magnetometer values for corresponding situations is same.

The sensors which I am using are accelerometer and gyroscope. I dont know the exact way how the quaternion values are getting computed from these sensor values here but I will try to give you a better understanding. So, the quaternion values initially at rest are [1,0,0,0]. If the object is kept at rest, it remains the same (should be like that) but if it moves randomly and then again comes to rest with the exact same orientation as the initial point, the quaternion values are [0.708547,-0.4962,-.4316,-0.2556]. If this is not matching, then what are the absolute quaternion values signifying?

Is there any flaw from my end in understanding the derivation of quaternion values at the conceptual level or I am missing something substantial?

• How do the values look like? How do you compute the quaternions? Are they computed (e.g. with a filter) from the mentioned sensors? – FooTheBar May 24 '17 at 13:30
• more information is needed here. At a minimum, what are the quaternion values? Quaternions are not the same as rotations and they have double coverage of the rotation space (in other words, there are two different possible quaternions values for every rotation). – ryan0270 May 24 '17 at 13:57
• Please update the question instead of adding the info to a a comment. Your quaternions look strange, they should normally be float values and the norm of the quaternion should be 1. You update the pose with imperfect sensors so you will never get exactly the same values when you return as measurement error of the sensors are adding up. – FooTheBar May 24 '17 at 16:48
• Pratik, the only conclusion we can draw from this information is that the orientation algorithm is misbehaving. If the sensor is reporting those numbers to you (running it's own algorithm) then you might need to test a different sensor or implement your own algorithm using the raw gyro, accel, mag values. Also, as a sanity check, make sure those raw sensor readings are the same before and after you shake the sensor – ryan0270 May 24 '17 at 17:34
• @ryan0270- I am using these values directly from invensense's own API. I am assuming these values are computed correctly. Logically speaking, I dont see any reason why there is a difference in quaternion values for the exact same orientation. May be there is something I am missing in terms of understanding the interpretation of this algorithm. Any thoughts? – Pratik May 24 '17 at 18:34