1

Let me tell you my physics is very bad. I want to calculate time between two points. The situation here is - if an object is moved from say point x to point y with an acceleration which is not constant, can we calculate the time between those points?

For example, if I am playing golf and I need to hit the ball, first I will need to swing my club backwards. Then I swing the club forward and hit the ball. I need to find the time taken to reach the peak of backward swing and the time taken to contact the ball.

Any ideas how I can achieve this using the iPhone accelerometer? I know we can use the core motion framework for this purpose, but am not sure how to find the time and speed. What kind of calculations do I need to do to achieve this?

halfer
  • 19,824
  • 17
  • 99
  • 186
Jayshree
  • 281
  • 1
  • 6
  • 28
  • The first answer from Feb 25 was deleted by a moderator because of plagiarism. You find a link to the original answer (that you knew already) below together with another link to a similar discussion. – Kay Feb 27 '11 at 09:52

1 Answers1

1

I think it's not impossible to get the information you want. But it is not that easy and needs enhanced maths and a lot of research & development i.e. try and error. The more complex your motion to detect the less exact the result will be. Same for duration: a long running motion (>2 sec) will be very hard to detect correctly.

You should have a look at the following questions:

Getting displacement from accelerometer data with Core Motion

Promising because brutella said he got his approach working already: Measuring time the vehicle takes to accelerate in iPhone

Community
  • 1
  • 1
Kay
  • 12,918
  • 4
  • 55
  • 77
  • Yes I saw already that your problem is somewhat different. I think you want the point of returning or peak point of a motion that swings back, right? The links above deal more with displacement as detecting the absolute position, but they are AFAIK the only ones at least a little bit close to what you might want. Let's stay here at SO because than all others benefit from what we find out, or do you mind because of NDA or inellectual property of your idea? – Kay Feb 28 '11 at 12:13
  • no its ok. we can stay on SO. actually i am trying to achieve something like the sgn golf app. when a person swings the iphone i want to find the time taken to reach the backswing peak. and then again the time taken contact the ball. i still haven't found out a way to do this. – Jayshree Mar 01 '11 at 08:29
  • 1
    Sounds hard to do this in a stable manner. You have to check your position from core motion (I recommend the quaternion or rotation matrix representation, no Euler angles), get the position of the club as vector in spherical coordinates. Inclination minimum seems the peak you are looking for. Then you have to track position and calculate angular velocity. Contact point might be a predefined vector near gravity and you check the distance to it on every tick. Maybe you need some interpolation like SLERP. Anyway, sounds possible but pretty tough regarding maths and physics. – Kay Mar 01 '11 at 11:02