【问题标题】:Removing Noise from recorded accelerometer/gyroscope data从记录的加速度计/陀螺仪数据中去除噪声
【发布时间】:2013-08-16 06:50:37
【问题描述】:

我已经看到了一些关于如何在聆听时降低加速度计 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 未写入文件中。

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

提前致谢。

【问题讨论】:

    标签: android accelerometer sensors gyroscope noise


    【解决方案1】:

    不知道是不是太晚了,写一下,以备不时之需。

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

    就我个人而言,我更喜欢卡尔曼滤波器,尽管它的计算成本有点高。

    【讨论】:

      【解决方案2】:

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

      一切顺利, 列弗

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-12-07
        • 1970-01-01
        • 1970-01-01
        • 2011-05-21
        • 2019-05-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多