From 84a329cca756058a757897078e1c5b5d714fcec3 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Sun, 20 Oct 2024 10:32:35 +0300 Subject: [PATCH] More clean yaw error calculation --- flix/control.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flix/control.ino b/flix/control.ino index ae60e4a..ef6eb8a 100644 --- a/flix/control.ino +++ b/flix/control.ino @@ -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); } }