Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-564] Accuracy of compass and accelerometer

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-07-27T16:56:36.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsaccelerometer, ios, iphone
Reporterflaz83
AssigneeReggie Seagraves
Created2011-04-15T02:32:04.000+0000
Updated2011-07-27T16:56:36.000+0000

Description

Hi, I'm working on augmented reality, so I need to use accelerometer and compass features.
The problem is the measurement accuracy. The measurement difference of the accelerometer with a little movement of the iPhone it's about 2-3%, while in other application like AroundMe or iHandyLevel it seems to be more accurate. Is it possible to change/increase the accuracy on iPhone? Thanks a lot, Flavio

Comments

  1. flaz83 2011-04-15

    I have found a solution.
    If you need more accuracy, you can do as apple suggests:

    var accelX = 0;
    var accelY = 0;
    var accelZ = 0;
    var kFilteringFactor = 0.1;

    Ti.Accelerometer.addEventListener('update',function(e)
    {

       accelX = (e.x * kFilteringFactor) + (accelX * (1.0 - kFilteringFactor));
       accelY = (e.y * kFilteringFactor) + (accelY * (1.0 - kFilteringFactor));
       accelZ = (e.z * kFilteringFactor) + (accelZ * (1.0 - kFilteringFactor));
       
       ts.text = e.timestamp;
       x.text = 'x: ' + accelX;
       y.text = 'y:' + accelY;
       z.text = 'z:' + accelZ;
       

    });

    This uses a low-value filtering factor to generate a value that uses 10 percent of the unfiltered acceleration data and 90 percent of the previously filtered value.
    -> More accuracy but short-lived changes in motion.

    Regards, Flavio

  2. Vikramjeet Singh 2011-07-27

    Bug: Invalid. Apple don't support this. Not possible. Asked Blaine

JSON Source