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

  1. raw accelerometer data sum of accelerations measured i.e. combination of gravity , current acceleration of device.
  2. 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:

if app concept forces rely on precise results more half second, try change it.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -