我正在使用 IMU(3 轴加速度计、3 轴陀螺仪、3 轴磁力计),我想从加速度计数据中获取线性加速度。我知道传感器融合以及使用陀螺仪数据(并获取方向)来获取重力矢量的能力,从而消除其对相应轴的影响。
我是否走在正确的道路上,如果可以的话,你能帮忙吗?
之后,我将对加速度进行两次积分以获得如下位置
CurrentAcceleration[0] = e.Accelerometer[0];
CurrentAcceleration[1] = e.Accelerometer[1];
CurrentAcceleration[2] = e.Accelerometer[2];
//we need to get the linear acceleration instead of the read data !!
CurrentVelocity[0] += (CurrentAcceleration[0] + PreviousAcceleration[0]) / 2;
CurrentVelocity[1] += (CurrentAcceleration[1] + PreviousAcceleration[1]) / 2;
CurrentVelocity[2] += (CurrentAcceleration[2] + PreviousAcceleration[2]) / 2;
Position[0] += (CurrentVelocity[0] + PreviousVelocity[0]) / 2 ;
Position[1] += (CurrentVelocity[1] + PreviousVelocity[1]) / 2 ;
Position[2] += (CurrentVelocity[2] + PreviousVelocity[2]) / 2 ;
PreviousAcceleration[0] = CurrentAcceleration[0];
PreviousAcceleration[1] = CurrentAcceleration[1];
PreviousAcceleration[2] = CurrentAcceleration[2];
PreviousVelocity[0] = CurrentVelocity[0];
PreviousVelocity[1] = CurrentVelocity[1];
PreviousVelocity[2] = CurrentVelocity[2];