|
这是一个开源云台的代码里面在IMU中关于ROll和Pitch角的解算的部分
// Rotate Estimated vector(s), ROLL
deltaGyroAngle = gyroADC[ROLL] * scale;
EstG.V.Z = scos(deltaGyroAngle) * EstG.V.Z - ssin(deltaGyroAngle) * EstG.V.X;
EstG.V.X = ssin(deltaGyroAngle) * EstG.V.Z + scos(deltaGyroAngle) * EstG.V.X;
// Rotate Estimated vector(s), PITCH
deltaGyroAngle = gyroADC[PITCH] * scale;
EstG.V.Y = scos(deltaGyroAngle) * EstG.V.Y + ssin(deltaGyroAngle) * EstG.V.Z;
EstG.V.Z = -ssin(deltaGyroAngle) * EstG.V.Y + scos(deltaGyroAngle) * EstG.V.Z;
// Rotate Estimated vector(s), YAW
deltaGyroAngle = gyroADC[YAW] * scale;
EstG.V.X = scos(deltaGyroAngle) * EstG.V.X - ssin(deltaGyroAngle) * EstG.V.Y;
EstG.V.Y = ssin(deltaGyroAngle) * EstG.V.X + scos(deltaGyroAngle) * EstG.V.Y;
// Attitude of the estimated vector
angle[ROLL] = _atan2(EstG.V.X, EstG.V.Z) ;
angle[PITCH] = _atan2(EstG.V.Y, EstG.V.Z) ;
群里有高手能帮我说明这段代码的意思吗,计算Pitch和Roll的角度应该是用X,Y,Z轴的加速度分量做反正切,但为什么加速度分量使用gyro的数据来算的呢
|
|