From 33f92db305b2f6bcedad2decdc0bee88492b0c3d Mon Sep 17 00:00:00 2001 From: ctzsnooze Date: Thu, 10 Oct 2024 10:16:11 +1100 Subject: [PATCH] revise PID gains --- src/main/flight/autopilot.c | 7 ++++--- src/main/pg/autopilot.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/flight/autopilot.c b/src/main/flight/autopilot.c index fe77e98e06..7a2fd2d8de 100644 --- a/src/main/flight/autopilot.c +++ b/src/main/flight/autopilot.c @@ -36,9 +36,9 @@ #define ALTITUDE_I_SCALE 0.003f #define ALTITUDE_D_SCALE 0.01f #define ALTITUDE_F_SCALE 0.01f -#define POSITION_P_SCALE 0.01f -#define POSITION_I_SCALE 0.01f -#define POSITION_D_SCALE 0.01f +#define POSITION_P_SCALE 0.5f +#define POSITION_I_SCALE 0.1f +#define POSITION_D_SCALE 0.1f static pidCoefficient_t altitudePidCoeffs; static float altitudeI = 0.0f; @@ -179,6 +179,7 @@ void positionControl(gpsLocation_t targetLocation, float deadband) { // send setpoints to pid.c using a method similar to that in gpsRescueAngle[axis] // value sent needs shoiuld be in degrees * 100 // values will have steps at GPS rate, if too jumpy we would need to upsample smooth them + posHoldAngle[AI_ROLL] = rollSetpoint; posHoldAngle[AI_PITCH] = pitchSetpoint; diff --git a/src/main/pg/autopilot.c b/src/main/pg/autopilot.c index ea202f1d9a..8f040bc5a6 100644 --- a/src/main/pg/autopilot.c +++ b/src/main/pg/autopilot.c @@ -39,7 +39,7 @@ PG_RESET_TEMPLATE(autopilotConfig_t, autopilotConfig, .altitude_D = 15, .altitude_F = 15, .position_P = 15, - .position_I = 40, + .position_I = 15, .position_D = 15, // .position_F = 0, .position_filter_hz = 75,