Алгоритм шума компаса Android

From Delphi 2007 справочного файла:

ms-help://borland.bds5/devcommon/variables_xml.html

, "Если Вы явно не инициализируете глобальную переменную, компилятор инициализирует ее к 0".

9
задан Mads Kristiansen 10 December 2009 в 22:59
поделиться

4 ответа

You need Low Pass Filter. There are explanation and simple algorithm on wikipedia

15
ответ дан 4 December 2019 в 07:47
поделиться

What have you tried? How many readings do you get per second?

I would suggest something along the lines of an average of the last X number of readings to get rid of the "jiggles" and throw away any readings that are wildly different from the current direction to stop any crazy "jumping" of values. Depending on how many readings you are getting, and how much averaging you are doing, your app may lose responsiveness.

The following link might be useful. http://www.chem.uoa.gr/applets/appletsmooth/appl_smooth2.html

2
ответ дан 4 December 2019 в 07:47
поделиться

If you do get a significant number of completely-wrong values, you probably don't want to just average them. You could try applying a median filter first - take N samples, calculate the median, and throw out anything more than +- some threshold value. You can apply a smoothing filter after that.

1
ответ дан 4 December 2019 в 07:47
поделиться

I got rid of most of the noise by just using a slower update time. I'm not sure if Android has a built-in filter for these, but it seems to stabalize a lot. Something like:

mSensorManager.registerListener( 
    mSensorListener, 
    mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), 
    // SENSOR_DELAY_UI, instead of SENDOR_DELAY_FASTEST (or similar)
    //    seems to iron out a lot of the jitter
    SensorManager.SENSOR_DELAY_UI
);

SensorManager offers:

  • SENSOR_DELAY_FASTEST : get sensor data as fast as possible
  • SENSOR_DELAY_GAME : rate suitable for games
  • SENSOR_DELAY_NORMAL : rate (default) suitable for screen orientation changes
  • SENSOR_DELAY_UI : rate suitable for the user interface
3
ответ дан 4 December 2019 в 07:47
поделиться
Другие вопросы по тегам:

Похожие вопросы: