[Interest] QML Rotation sensor readings

Jason H jhihn at gmx.com
Sun Jan 28 20:39:15 CET 2018


I'm trying to get a reading of 0 at horizon, and above the horizon as positive direction. I can't seem to do this because the orientation changes, but I can't fluidly detect that.

QML defines 0 as on the table, face up, and as I raise the top of the phone it comes to vertical it is 90, then as I take the normal of the backface of the phone above the horizon it starts to decrease. It only goes negative when the top edge is below the bottom edge, either transitioning into face down (over 180deg from 0 face up) or face up (dipping the top edge below the bottom edge)

I've compiled a table of lifting the top edge from almost flat, face up over until face down:
rot | orientation
 13 | 5
 32 | 5
 50 | 1
 69 | 1
 78 | 1 <-
 83 | 1 <- problem 
 74 | 1 <-
 62 | 1
 47 | 1
 29 | 6
 19 | 6
 12 | 6
  8 | 6

The despite the continuous movement, the value peaks at 90 and decreases, with me having no way to know that the rotation has not changed.  

How can I map rotation from 0 to 180, face up to face down (landscape and portrait)?



More information about the Interest mailing list