Android Low pass filter and High pass filter

前端 未结 4 1123
一整个雨季
一整个雨季 2020-12-07 16:46

I have a very basic question. What is Low Pass filter and High Pass filter in case of Android Accelerometer?

When I see the output from the Accelerometer Sensor, I

4条回答
  •  感情败类
    2020-12-07 17:51

    I usually use this formula To filter the data from the accelometer sensor data coming out to linear sensor(like gyroscope) data. Use it if you are not sure there is a built-in Gyroscopic sensor.

    private float[] values;
    private float[] valuesN;
    private float[] prev;
    private float[] prevHF;
    private boolean doHPF = false;
    
    // ind - index of three dimensions (x, y, z)
    private void makeHPFf() {
        for (int ind = 0; ind < 3; ind++) {
            valuesN[ind] = values[ind] * 0.002f * 9.8f;
            if (doHPF)
                values[ind] = valuesN[ind] - prev[ind] + (prevHF[ind] * 0.8f);
            prev[ind] = valuesN[ind];
            prevHF[ind] = values[ind];
        }
    
        if (!doHPF)
            doHPF = true;
    }
    

提交回复
热议问题