I run the "motion-driver-client.py" and got the measured quaternion when the board is placed stationary:
q=[-0.8884, -0.0004, -0.4413, -0.1265]
I leaned from textbook about quarternion that a quarternion is defined as
Q = w + xi + yj + zk
or Q=[w, x, y, z] as a 4-element vector.
where
w = cos(theta / 2 )
x = ax * sin(theta / 2)
y = ay * sin(theta / 2)
z = az * sin(theta / 2 )
theta is the rotated angle and [ax,ay,az] is the axis
but the actual measurement q=[-0.8884, -0.0004, -0.4413, -0.1265] , Considering the quat-out-rate is set at 100Hz, that means that there is rotation represented by the above quot every 10ms, even the chip is placed stationary.
I know my understanding is not right as the object in the pygame window is not rotated. Can anybody teach me how to understand it? Thanks.
- Log in to post comments
phpbb Topic ID
15297
Re: Re: How to understand measured quaternion?
The quaternion represents the current orientation of the device, not a rotation "to be applied" to your application's current estimate. This is why the quat has stable, non-zero values when the device is stationary. For each update of the sensor, the accel and gyro updates are internally converted to quaternion, and the rotation update is applied to the quat values that are sent to the host processor.
Re: Re: How to understand measured quaternion?
@sectionsbest wrote:
Thank you for your reply. I still have question. When I run the demo, my board is not moved, so the quat should be [1, 0, 0 ,0], but actually it has values like [-0.8884, -0.0004, -0.4413, -0.1265]. why?
Re: Re: How to understand measured quaternion?
The board should default into a 9 axis operation, so will not always be representative of a startup of 1,0,0,0. The quat you get is normalized to a magnitude of 1, just has a rotation applied.
Re: Re: How to understand measured quaternion?
@sectionsbest wrote:
Do you know how to set the initial quat as [1 0 0 0] as no rotation at all? It is not so convinient.
Re: Re: How to understand measured quaternion?
You should take a look through our knowledge center, for how to manipulate quaternions. You can create an initial zero or subsequent "tare" of the orientation by taking an "offset" quaternion, which grabs the current reading, then rotates all subsequent points. You could do this as a quaternion or initial offset rotation matrix, per your application. Same idea as removing a sensor bias, but with more complicated math.