-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrong angles when rotating back to vertical mode #1
Comments
This occurs almost evey app that offers compass laying flat or standing out(AR application) I wasn't able to solve the issue. Sometimes, there is 10 degrees difference which is really bad. If anyone knows how to solve the angle difference between laying and standing position please email to [email protected] |
I've figured this out, and hopefully when I get time and permission I can update this project, because I can remove a ton of code and simplify how to calculate the right azimuth and altitude, and roll in any position. Here's an example of what to do that will work (and it may still be more complicated than necessary): When the phone is not held flat, rotate, using the rotation matrix from the sensors, a vector aligned with the negative-z-axis (0,0,-1) to determine the azimuth from the back of the phone. When held flat, this approach is problematic (the issue described), since it's hard to determine what the angle is, so don't use this approach when held flat. When the phone is held flat (or upside down), rotate, using the rotation matrix from the sensors, a vector aligned with the x-axis (1,0,0) and then calculate the azimuth from that. This uses the side of the phone, which, when held flat, is pointed clearly in a direction. When the phone is not held flat, issues arise if the side of the phone starts to point at north, because, it's then not very clear what the correct intended angle is. Using the normalized inverse of the vector gotten from the accelerometer sensor, along with the device screen rotation, can help determine the various cases here (flat, not flat, roll of the phone, etc), since it's absolute. Some other notes - the rotation matrix returned from the sensors is a row-ordered one. Android's Matrix class uses column ordered matrices, so it must be transposed before using the Matrix.* methods. Hopefully I get to update this project, but until then, I hope this helps. |
when I rotate the rotate the device on pitch axis, and rotate it back to vertical mode it the rotation vector compass does not show the right angles. I'm testing this app on samsung galaxy s4, software version 4.2
The text was updated successfully, but these errors were encountered: