Hi,
With the way we intend to use the MPU-6050, it's not guaranteed that the user will start the device with the accelerometer/gyro lying on a flat surface, so the initial value of the Quaternion might be in reference to any orientation. Is there a way to reset this initial quaternion, when we know the MPU is in the right orientation?
Also, I'm trying to do some sensor fusion, so we can have the Linear Acceleration and Gravity vectors from the quaternion and accelerometer readings, and I'm having problems getting these values correctly when the device is started in a random orientation. What I do is:
if(device is "stable") //(Acceleration == ~1G and no rotation):
QuaternionReference = currentQuaternion; //(1)
GravityReference = rotate(AccelerationReading, QuaternionReference^-1)
else
FusedGravity = rotate(GravityReference, currentQuaternion)
LinearAcceleration = AccelerationReading - FusedGravity
(1): that's where the quaternion reset could be helpful...
This is working fine when I start the device on a flat surface, but not when I start the device in a random orientation...
Any help would be appreciated!
Thanks