Skip to content

Commit 85f6db1

Browse files
authored
fix: PID invalid integration of negative target_delta (#2213)
fix: Fixed invalid integration of negative target_delta. (cherry picked from commit 6b4164c)
1 parent 6b4d407 commit 85f6db1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

source/Core/Threads/PIDThread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ template <class T, T Kp, T Ki, T Kd, T integral_limit_scale> struct PID {
130130
// Thus we multiply this out by the interval time to ~= dv/dt
131131
// Then the shift by 1000 is ms -> Seconds
132132

133-
integration_running_sum += (target_delta * interval_ms * Ki) / 1000;
133+
integration_running_sum += (target_delta * (T)interval_ms * Ki) / 1000;
134134

135135
// We constrain integration_running_sum to limit windup
136136
// This is not overly required for most use cases but can prevent large overshoot in constrained implementations

0 commit comments

Comments
 (0)