Question

Do someone know, for each property of CMMotionmanager.deviceMotion and their subproperties, on what kind of hardware they are based on (magnetometer, accelerometer, gyroscope, ...) ?

My question is about HARDWARE, not software.

I need to know from which piece of hardware the CMMotionManager get its values to know on which kind of iPhone my CMMotionManager calls will work. And to write consequent text on my web site.

So what piece of hardware is use to build :

deviceMotion.attitude.roll
deviceMotion.attitude.pitch
deviceMotion.attitude.yaw
deviceMotion.rotationRate (sole gyroscope ? Iphone 4 / 4S with iOS4)
deviceMotion.gravity (sole accelerometer ? So it should work on all iPhones with iOS4)
deviceMotion.userAcceleration (sole accelerometer ? So it should work on all iPhones with iOS4)
deviceMotion.magneticFied (sole magnetometer ? Iphone 3GS / 4 / 4S with iOS4)

Was it helpful?

Solution

Update (hardware):

The deviceMotion property is only available on devices having both an accelerometer and a gyroscope. This is because its sub-properties are the result of a sensor fusion algorithm i.e. both signals are evaluated together in order to decrease the estimation errors. Especially gravity estimation on fast moved devices is still hard work when high precision is demanded (car navigation, satellite positioning,... face the same problems). Popular fusion algorithms are for instance the Kalman filter and derivatives but I guess the CMMotionManager's internal implementation is based on simpler and thus faster algorithms.

Given that, you have only the raw sensor data properties of CMMotionManger accelerometerData and gyroData that are related 1:1 to a sensor - and in case of iOS 5 magnetometerData. deviceMotion and all its sup-properties are the calculated result of the internal implementation of fusion algorithms.

Old answer:

iOS 4.x:

CMMotionManager supports gyroscope and accelerometer. It provides for isXxxAvailable and isXxxActive to query hardware capabilities and determine the status, e.g. accelerometerAvailable and accelerometerActive. Furtheron there is a simple but quite efficient sensor fusion algorithm called DeviceMotion if the device has an accelerometer and a gyroscope on board - compass is not needed and thus not used. Analog to the sensors you use deviceMotionAvailable and deviceMotionActive for getting information.

Magnetometer is only available via CLLocationManager.

I experienced sometimes trouble with deviceMotionActive when the app is getting to foreground again after suspending (got true although DeviceMotion was definitely stopped before).

iOS 5.x: Magnetometer support is added to CMMotionManager and handled like the two other sensors.

General: You can use CMMotionManager even on iPhone 3g (with iOS4). You don't have access to CMDeviceMotion but can query accelerometer updates. Thus you have to use low pass filtering to get a gravity estimation and it's far more worse than DeviceMotion.

You should not use the pre-iOS 4 interface UIAccelerometerDelegate.

OTHER TIPS

See the reference

A CMMotionManager object is the gateway to the motion services provided by iOS. These services provide an application with accelerometer data, rotation-rate data, magnetometer data, and other device-motion data such as attitude. These types of data originate with a device’s accelerometers and (on some models) its magnetometer and gyroscope.

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