Skip to content

armgit / flix

Public Imported from GitHub
0

Making an ESP32-based quadcopter from scratch

More clean yaw error calculation

Oleg Kalachev84a329cca756
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);
}
}