Making an ESP32-based quadcopter from scratch
Python arduinoautopilotcontrol-theorydroneesp32flight-controlflight-controllermavlinkquadcopterquadcopter-firmwareuav
Re-arrange control.ino declarations to make a bit more sensible So the control command is above the PID controllers.
Oleg Kalachev28f5855a57ef
diff --git a/flix/control.ino b/flix/control.inoindex 9018630..8f6d8e6 100644--- a/flix/control.ino+++ b/flix/control.ino@@ -38,6 +38,12 @@ const int RAW = 0, ACRO = 1, STAB = 2, AUTO = 3; // flight modesint mode = STAB;bool armed = false;+Quaternion attitudeTarget;+Vector ratesTarget;+Vector ratesExtra; // feedforward rates+Vector torqueTarget;+float thrustTarget;+PID rollRatePID(ROLLRATE_P, ROLLRATE_I, ROLLRATE_D, ROLLRATE_I_LIM, RATES_D_LPF_ALPHA);PID pitchRatePID(PITCHRATE_P, PITCHRATE_I, PITCHRATE_D, PITCHRATE_I_LIM, RATES_D_LPF_ALPHA);PID yawRatePID(YAWRATE_P, YAWRATE_I, YAWRATE_D);@@ -47,12 +53,6 @@ PID yawPID(YAW_P, 0, 0);Vector maxRate(ROLLRATE_MAX, PITCHRATE_MAX, YAWRATE_MAX);float tiltMax = TILT_MAX;-Quaternion attitudeTarget;-Vector ratesTarget;-Vector ratesExtra; // feedforward rates-Vector torqueTarget;-float thrustTarget;-extern const int MOTOR_REAR_LEFT, MOTOR_REAR_RIGHT, MOTOR_FRONT_RIGHT, MOTOR_FRONT_LEFT;extern float controlRoll, controlPitch, controlThrottle, controlYaw, controlMode;