More clean yaw error calculation

This commit is contained in:
Oleg Kalachev 2024-10-20 10:32:35 +03:00
parent 5613028678
commit 84a329cca7

View File

@ -123,7 +123,8 @@ void controlAttitude() {
ratesTarget.y = pitchPID.update(error.y, dt);
if (yawMode == YAW) {
ratesTarget.z = yawPID.update(wrapAngle(attitudeTarget.getYaw() - attitude.getYaw()), dt);
float yawError = wrapAngle(attitudeTarget.getYaw() - attitude.getYaw());
ratesTarget.z = yawPID.update(yawError, dt);
}
}