1

I'm developing an app for iPhone (iOS 4.2) which needs to be able to collect large amounts of data from the accelerometer and gyroscope. I'm current looking at using the CoreMotion framework to get the data into an acceptor class (from which I'm writing it to a database).

However, for code quality I want to write some test cases to test my acceptor class. Through research there doesn't seem to be any clear way to do this - CoreMotion just outputs data as floats, but I don't just want to feed a load of floats into the acceptor class, because that won't replicate how CoreMotion behaves - rather just how a feed of floats will.

Is it fair to assume that as CoreMotion is an apple-produced class when "they" say it will produce data at x-hertz, and this data will be between the range of y and z that this is a given?

Any ideas/hints relating to writing and developing test cases, and additionally relating to my overall design would be greatly appreciated.

4

1 回答 1

0

在开发者网站上下载 core motion 茶壶示例。您将能够设置每秒返回数据的速率(赫兹)。您还可以从核心运动请求时间戳,以获取加速度计/陀螺仪数据的准确时间。

加速度计不准确。您可以使用它来大致了解当前加速度,这对于检测运动方向很有用,但不适用于获取距离或速度。

于 2011-02-20T06:25:11.070 回答