From 16107036e7ab73a87bb3795cea8c2eaad361c3bc Mon Sep 17 00:00:00 2001 From: melfey Date: Sat, 13 Jun 2026 13:53:22 -0500 Subject: [PATCH] Changed internal PID math The system new reduces itself by 1000 internally before output, hopefully making the precision much higher (IE NOT needing to use tiny ass inputs to make anything reasonable) --- src/core/logic/pid.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/logic/pid.rs b/src/core/logic/pid.rs index b1f6fba..4771d11 100644 --- a/src/core/logic/pid.rs +++ b/src/core/logic/pid.rs @@ -38,14 +38,14 @@ impl PID { integral: 0.0, prev_error: 0.0, set_point: 0.0, - output: 0.0 + output: 0.0, } } } impl Default for PID { fn default() -> Self { - PID::new(Config{ + PID::new(Config { kp: 0.0, ki: 0.0, kd: 0.0, @@ -93,9 +93,9 @@ impl PID { //Calculate and store the output let output = match self.config.accel { - 0.0 => f + p + i + d, + 0.0 => (f + p + i + d) * 0.0001, _ => { - let pre_output = f + p + i + d; + let pre_output = (f + p + i + d) * 0.0001; let change = pre_output - self.output; let change = change.clamp(-self.config.accel, self.config.accel);