ios - CMDeviceMotion userAcceleration is upside down? -
i'm seeing unexpected readings useracceleration field in cmdevicemotion. when @ raw accelerometer data cmaccelerometerdata, see if iphone flat on table reading 1g straight down (1g in -z axis) , if drop iphone (on soft surface of course) acceleromtere reading goes 0 expected. that's fine. when instead use cmdevicemotion class, useracceleration reading 0 expected when iphone flat on table. again fine. when drop iphone , read cmdevicemanager useracceleration, useracceleration values 1g straight (+z) not down (-z) expected. appears useracceleration readings exact opposite of acceleration device experiencing. has else observed this? can invert (multiply -1) useracceleration values before try integrate velocity , position, or misunerstanding useracceleration reading?
there conceptual differences between cmaccelerometerdata.acceleration , cmdevicemotion.useracceleration
- raw accelerometer data sum of accelerations measured i.e. combination of gravity , current acceleration of device.
- device motion data result of sensor fusion of 3 sensors i.e. accelerometer, gyroscope , magnetometer. bias , errors eliminated (in theory) , remaining acceleration data separated gravity , acceleration used conveniently.
so if want compare both have check cmaccelerometerdata.acceleration
against cmdevicemotion.useracceleration + cmdevicemotion.gravity
compare like.
in general cmdevicemotion first choice in cases when want precise values , hardware independency.
another thing consider cmattitudereferenceframe provide when starting device motion updates via startdevicemotionupdatesusingreferenceframe. not sure default when using basic version startdevicemotionupdates
you stated want integrate values velocity , position. there several discussions , @ bottom line can it's impossible reasonable results. see:
- finding distance using accelerometer in iphone
- getting displacement accelerometer data core motion
- how can find distance traveled gyroscope , accelerometer?
if app concept forces rely on precise results more half second, try change it.
Comments
Post a Comment