2

我已经看到了一些关于如何在聆听时降低例如加速度计 x、y、z 值的噪声的答案,但我的问题有点不同。

我已经有一些记录的数据(在 csv 文件中),如果可能的话,我想在之后消除/减少噪音。

以下是记录的数据:

陀螺仪的 X,Y,Z

来自陀螺仪的 Delta 0-3,以这种方式计算:

axisX = 0;
axisY = 0;
axisZ = 0;
// This timestep's delta rotation to be multiplied by the
// current rotation
// after computing it from the gyro sample data.
if (timestamp != 0) {
        final float dT = (event.timestamp - timestamp) * NS2S;
        // Axis of the rotation sample, not normalized yet.
        axisX = event.values[0];
        axisY = event.values[1];
        axisZ = event.values[2];

        // Calculate the angular speed of the sample
        float omegaMagnitude = FloatMath.sqrt(axisX * axisX + axisY
                * axisY + axisZ * axisZ);

        // Normalize the rotation vector if it's big enough to get
        // the axis (that is, EPSILON should represent your maximum
        // allowable margin of error)
        if (omegaMagnitude > 0.000000001f) {
            axisX /= omegaMagnitude;
            axisY /= omegaMagnitude;
            axisZ /= omegaMagnitude;
        }

        // Integrate around this axis with the angular speed by the
        // timestep in order to get a delta rotation from this
        // sample over the timestep We will convert this axis-angle
        // representation of the delta rotation into a quaternion
        // before turning it into the rotation matrix.
        float thetaOverTwo = omegaMagnitude * dT / 2.0f;
        float sinThetaOverTwo = FloatMath.sin(thetaOverTwo);
        float cosThetaOverTwo = FloatMath.cos(thetaOverTwo);
        deltaRotationVector[0] = sinThetaOverTwo * axisX;
        deltaRotationVector[1] = sinThetaOverTwo * axisY;
        deltaRotationVector[2] = sinThetaOverTwo * axisZ;
        deltaRotationVector[3] = cosThetaOverTwo;

}
timestamp = event.timestamp;
float[] deltaRotationMatrix = new float[9];
SensorManager.getRotationMatrixFromVector(deltaRotationMatrix,deltaRotationVector);

Pitch/Roll/Azimuth/Inclination,以这种方式计算:

// Calculation of the orientation through the
// magnetic-field and accelerometer sensors.
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER)
    mGravity = event.values;
if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD)
    mGeomagnetic = event.values;
if (mGravity != null && mGeomagnetic != null) {
    float R[] = new float[9];
    float I[] = new float[9];

    boolean success = SensorManager.getRotationMatrix(R, I, mGravity, mGeomagnetic);
    if (success) {
        float orientation[] = new float[3];
        SensorManager.getOrientation(R, orientation);
        // get the current orientation
        // orientation consist of: azimut, pitch and roll in radians
        azimut = orientation[0] * (180 / (float) java.lang.Math.PI);
        pitch = orientation[1] * (180 / (float) java.lang.Math.PI);
        roll = orientation[2] * (180 / (float) java.lang.Math.PI);
        inclination = SensorManager.getInclination(I) * (180 / (float) java.lang.Math.PI);
    }
}

加速度计的 X/Y/Z 未写入文件中。

所以我的问题是:我可以从这些数据中去除噪音吗?

提前致谢。

4

2 回答 2

1

我不知道对你来说是否为时已晚,只是写以防万一你仍然需要它。

您可以使用它实现某种过滤器。低通滤波器是典型的。否则,请尝试互补过滤器。

我个人更喜欢卡尔曼滤波器,尽管它在计算上有点昂贵。

于 2014-08-02T11:11:04.870 回答
0

由于您没有记录加速度计,如果我理解正确,您使用的是方向。我建议将欧拉角转换为四元数表示并使用平均来平滑数据,这不是常规平均,见下文。您可以使用此 matlab 代码示例通过平均来实现滚动窗口过滤器: https ://stackoverflow.com/a/29315869/6589074

一切顺利,列夫

于 2018-02-19T21:21:51.903 回答