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 at开发者_运维技巧tached 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.
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.
精彩评论