Making an ESP32-based quadcopter from scratch
Python arduinoautopilotcontrol-theorydroneesp32flight-controlflight-controllermavlinkquadcopterquadcopter-firmwareuav
Reset yaw target when drone disarmed Prevent unexpected behavior when the drone tries to restore its old yaw on takeoff.
Oleg Kalachevc4533e3ac8b0
diff --git a/flix/control.ino b/flix/control.inoindex 1c157c1..38c59d7 100644--- a/flix/control.ino+++ b/flix/control.ino@@ -80,7 +80,7 @@ void interpretControls() {if (mode == STAB) {float yawTarget = attitudeTarget.getYaw();- if (invalid(yawTarget) || controlYaw != 0) yawTarget = attitude.getYaw(); // reset yaw target if NAN or pilot commands yaw rate+ if (!armed || invalid(yawTarget) || controlYaw != 0) yawTarget = attitude.getYaw(); // reset yaw targetattitudeTarget = Quaternion::fromEuler(Vector(controlRoll * tiltMax, controlPitch * tiltMax, yawTarget));ratesExtra = Vector(0, 0, -controlYaw * maxRate.z); // positive yaw stick means clockwise rotation in FLU}