From 28f5855a57ef9f4993f936364d976964f6670621 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Tue, 13 Jan 2026 17:43:53 +0300 Subject: [PATCH] Re-arrange control.ino declarations to make a bit more sensible So the control command is above the PID controllers. --- flix/control.ino | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flix/control.ino b/flix/control.ino index 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 modes int 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;