# Thread: How to interpret data from rotation sensor on Symbian device?

1. Hi everyone,

So I have some troubles with interpreting data from rotation sensor on Symbian device: I've found example which displays x, y and z angles from rotation sensor on the screen using QRotationReading class, I built this example and launched it on N8 device, but I don't understand angle values... For example, if hold device vertically in portrait mode and then rotate by 45 degrees around normal vector of the screen (vector which is perpendicular to the screen), rotation sensor retrieves x=45 and y=45. Why? According to this documentation http://doc.qt.nokia.com/qtmobility-1...onreading.html these angles should be at least x=45 and y=90! Well, If rotate device from vertical position in portrait mode around screen's normal vector, angle values are changing from x=90, y=0 to x=0, y=90. Why is it so? Can someone explain it to me?

2. Rotation data represents Euler angles
http://mathworld.wolfram.com/EulerAngles.html
and they are bit tricky in practise use as there are three rotations and each depends on previous rotations.
There are other ways of describing rotations in 3D: rotation matrix and quaternions, which are considered to be easier in practical use.
In you example you rotate phone around axis y, which is the last step in 3 step rotation according to Euler angles. As a result this rotation is expressed also through rotations around z and x axes before it goes to rotation around y. This reflects the fact that Euler angles describe rotation not in the simplest possible way, but rather concentrate on providing unique way of rotation representation.

Also note that rotation is expressed from original position, where phone lies horizontally with screen facing the sky.

3. Could you give more details on these rotations? I'm also having difficulties interpretating these angels.

By your description, it seems, that we are talking about intrinsic rotations, which is not clear from documentation IMHO. Lets assume, that rotation angle z = 0, x = 15, y = 25. How should I interpret this?
I could build a rotation matrix by first creating a rotation, Rx, about x-axis, 15 deg. Then rotate the y-axis with Rx , yr = Rx*y. Then create an rotation matrix Ry from the rotated y-axis, yr, and 25 deg. The complete rotation would then be:
R = Ry*Rx
This seems not to be correct, because if I rotate the vector [0 0 1]' by R, then I should get an vector pointing the same direction as the accellerometer reading, which it is not. What it it I'm missing?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.