I’m getting some weird output from the mpu-9150 board. I noticed something in the code from pansenti (which appears to be newer than whats on sparkfun)
so a Vec3 is 3 numbers from 0 to 1.0 right? so then how can a vec be converted to degrees by multiplying it by the rads to degrees variable which should be 57.something.
basically my issues are the x axis flips from the 170s to the -170s. the z drifts even with the mag sensors fused in there, and none of the axis data seems anywhere close to right even with calibration.
I modified someone’s python opengl visualization I’m not sure if you can make out the wonky behavior or not
If the “Vector3” was a set of direction cosines or the real parts of a quaternion, then what you say would be true, although the range would be -1 to 1 IIRC. But if the 3 numbers are Euler angles, then the conversion from radians to degrees makes sense.
The following comment from the Pansenti page doesn’t solve the puzzle.
*John April 9, 2013 at 2:01 PM * Hello, in your code there is a problem with the algorithm, in a vertical position of the sensor, with a low movement, the output changes quickly… for example: y=90, when I spin the board in axis X near of 0 it changes from 0 to 180 quickly….
*Pansenti April 9, 2013 at 2:11 PM * This is the classic gimbal lock situation. Unfortunately, at the moment, the code has to go from the DMP quaternion into Euler angles to sort out the yaw and then go back to a quaternion again. The software could be more intelligent in how it handles this, both in avoiding the need to go into Euler angles for the magnetometer integration and also suppressing wild swings at unfortunate orientations. We’ll look at the problem…
But it does hint at your problem and suggests that the “Vector3” might be Euler angles.
I had read that but my output doesnt go from 0 to 180, it goes from -170s to positive 170s.
second of all could the magnetometer be converted to quanternions and then be merged with the dmp output? I’m using the teensy 3.0 so processing power is probably not an issue.
sirus:
I had read that but my output doesnt go from 0 to 180, it goes from -170s to positive 170s.
The rotations should range from -180 to 180 deg for 2 of the components, the other one from -90 to 90 deg.
sirus:
second of all could the magnetometer be converted to quanternions and then be merged with the dmp output?
I don't see why not. FWIW I don't understand why he goes to Euler angles once in quaternion "mode". The idea behind quaternions is to make the rotation math easy and avoid gimbal lock.
Then again there’s a lot of ways to skin this cat …
sirus:
wait one of the components only does 180 degrees? which axis and which device?
Have a look at the classical definition of axes and rotations in the wiki already linked to. Now which axis corresponds to which axis in your (Pansenti's) definition ... I have no idea. I've not read his stuff that well.