Direction of iPhone movement using CoreMotion

Discussion in 'iOS Programming' started by rjain, Aug 4, 2014.

  1. rjain macrumors newbie

    Joined:
    Aug 4, 2014
    #1
    I need to know how i can detect the direction among left, right, top, upward and downward of iphone movement using CoreMotion?

    My ultimate goal is to calculate distance traveled by iPhone and in which direction.

    Looking forward for reply.

    thanks in advance.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  3. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #3
    You can get direction. But not anywhere near accurately enough to calculate distance. (As an exercise, simulate distance results over time for various small numbers of digits in error bounds.)
     
  4. rjain thread starter macrumors newbie

    Joined:
    Aug 4, 2014
    #4
    Direction of iPhone movement using CoreMotion

    Yes i have gone through Core Motion. And i just looking forward to know the direction of motion either it is left, right, upward or downward. Can you please tell how i can get it?

    Thanks.
     
  5. rjain thread starter macrumors newbie

    Joined:
    Aug 4, 2014
    #5
    RE: Direction of iPhone movement using CoreMotion

    Besides the direction, FYI I need to check only linear motion along the the axis. I want to ignore all device tilt. But the acceleration changes on tilt as well, so how can i differentiate between tilt and linear motion?
     
  6. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #6
    The 3-axis gyros will tell you if the device is being tilted. If not, any acceleration is from moving linearly.
     
  7. rjain thread starter macrumors newbie

    Joined:
    Aug 4, 2014
    #7
    RE: Direction of iPhone movement using CoreMotion

    Seems like a good approach. How i can exclude accelerometer reading which comes due to tilt in the device.Should i just ignore the reading when Gyro is giving some readings. What unit Gyro gives readings in? How it can be used for my purpose?

    Any specific formula i need to apply or i just ignore accelerometer reading during gyro readings?
     

Share This Page