Angular Movement in Android

Discussion in 'Application Development' started by abhinavm, Jul 7, 2010.

  1. abhinavm

    abhinavm Member

    Apr 29, 2010

    I'm trying to track the angular movement of a phone in Android.

    For example, if the user rotated the phone upwards (pitched) it by 90
    degrees, then rolled it by 180 degrees and then pitched it again by
    -90 degrees (in the frame of reference of the phone), the output
    should say - "Total yaw = 0, total pitch = 0, total roll = 180".

    In another scenario, if the user starts from the same initial position
    and makes a yaw movement of 180 degrees, the final position of the
    phone will be same as the one in the above scenario, though the output
    will say "0 roll, 0 pitch and 180 yaw."

    I'm trying to use SensorEvent to get orientation values. The problem
    I'm facing is, that if the phone is held at a tilted angle and then a
    roll or a pitch movement is made, the value of "yaw" returned by the
    phone also changes. Similarly, if a make a yaw movement, the pitch and
    roll values returned also change. Therefore, I am unable to pinpoint
    whether any particular movement made is a yaw, pitch or a roll

    I understand that this problem could be solved very simply through
    some mathematics, but I am unable to find a good starting point. It
    would be great if someone could point me in the right direction ?



Share This Page