- #1
turban2k
- 2
- 0
This is my first post, so forgive me if I'm in the wrong place!
I know this topic has come up before, but I haven't seen quite what I need. I am basically looking for the math behind de-rotating the 3-D vectors (x,y,z) that I read out of an accelerometer, in order to compensate for gravity.
So I'll try to use an example. I have an accelerometer mounted on a surface, but it may be slightly tilted on the X axis (roll) and slightly tilted on the Y-axis (pitch). I'm assuming X axis points forward/back. Due to these slight rotations, I will have gravity components in the X and Y readings from the accelerometer.
So at steady state, I read out a relatively constant vector v1 = (x,y,z), where z is close to 1, but not quite since x and y are non-zero.
Given that vector v1, how do I de-rotate future readings (v2,v3 etc..) to compensate for this?? I have read lots of quaternions lately, and can sort of use them... but I can only use them to do a straight rotation about the X-axis let's say. I'm not sure how I can apply them for this example..
Any helps much appreciated!
I know this topic has come up before, but I haven't seen quite what I need. I am basically looking for the math behind de-rotating the 3-D vectors (x,y,z) that I read out of an accelerometer, in order to compensate for gravity.
So I'll try to use an example. I have an accelerometer mounted on a surface, but it may be slightly tilted on the X axis (roll) and slightly tilted on the Y-axis (pitch). I'm assuming X axis points forward/back. Due to these slight rotations, I will have gravity components in the X and Y readings from the accelerometer.
So at steady state, I read out a relatively constant vector v1 = (x,y,z), where z is close to 1, but not quite since x and y are non-zero.
Given that vector v1, how do I de-rotate future readings (v2,v3 etc..) to compensate for this?? I have read lots of quaternions lately, and can sort of use them... but I can only use them to do a straight rotation about the X-axis let's say. I'm not sure how I can apply them for this example..
Any helps much appreciated!