Question

How would I implement something that can make use of the iPhone 4's gyroscope and accelerometer in order to find out the speed/velocity at which the object is moving?

For example, if I took the iPhone into a car, it would tell me how fast the car is going? Or even take a simpiler case, assuming constant acceleration, say I attached the iPhone to small plastic cart and let it go down a mild slope. Could the iPhone take the velocity two times in order to compute the acceleration and thus calculate the velocity at each moment?

Thanks.

Was it helpful?

Solution

Just in case you don't know, Accelerometer won't give you the acceleration of device. (its unit are not m/s^2) It will give you the orientation of the device respecting to other position. Gyroscope is better because it will give the orientation taking in count one more dimension, you want to use this whenever is available.

Use the GPS (in CoreLocation) to get the current location of the device at a certain time but GPS is not as accurate as you would expect and might take time. Depending on your location, sometimes is not even available!

If you don't mind calculating speed and acceleration roughly then you can use them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top