Advertisement

Combining Euler angles to get the correct orientation

Started by December 06, 2013 01:32 PM
9 comments, last by RobM 11 years, 2 months ago

When the sensor is at rest sitting on the table, the vector is pointing directly down.


That makes no sense. The acceleration should be pointing directly up when the device is resting on the table: The table is pushing the device up, which is what is being detected.
The acceleration is essentially gravity, so when the device is flat, gravity is 1G (normalized) and pointing directly down, hence -1. I actually flip it so it shows 1 as it made it easier to visualise (I show a line on the screen depicting the accelerometer vector).

I reread your previous post earlier - I've been playing about with quaternions today. I created 3 actually, one for each axis. I create one which is rotation about Y (or up) by the yaw, then I use the cross of yaw -90 (and up) to create one for the pitch and then create one for the roll. Using these and multiplying them together I can apply Euler angles for yaw, then pitch and then roll. Doing some test numbers gives correct results even using full 360 degree values.

So now I have this, and I can get the accurate tilt-compensated yaw, I just need to get the pitch and roll from the accelerometer and that should be it.

So your idea of using the gyro to get the quaternion and then nudging towards the accelerometer values, could you elaborate a bit on that?

This topic is closed to new replies.

Advertisement