开发者

iPhone - detecting motion with gyroscope/accelerometer

开发者 https://www.devze.com 2023-01-20 19:07 出处:网络
I\'m trying to detect a swinging motion with an iPhone 4 using the gyro/accelerometer. I searched for some posts on SO about this, but couldn\'t find anything specific to my issues.

I'm trying to detect a swinging motion with an iPhone 4 using the gyro/accelerometer. I searched for some posts on SO about this, but couldn't find anything specific to my issues.

  1. Do I need to do any sort of calibration for data from the gyroscope/accelerometer?
  2. Anyone think of how I would measure a swinging motio开发者_如何学JAVAn?

Thanks!


1: Most iPhone games using the accelerometer don't do any calibration, but not all iphones are the same; there is some variation in accelerometer calibration. You could add a manual or automatic calibration to your program. If however, detecting a swinging motion is all you want, calibration is not necessary.

2: Apple has a nice little app that generates graphs of accelerometer motions in the iPhone SDK. You can download and build that and see the measurements for the motion you want. Then you can write code to detect similar accelerometer measurements.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号