We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d2ed4c1 commit c92ac33Copy full SHA for c92ac33
lib/simulation/controls-base-sim.ts
@@ -172,11 +172,11 @@ export class ControlsBaseSim {
172
173
calculatePID(error: number): number {
174
// Calculate PID output
175
- this.integral += this.kI * error * this.dt
+ this.integral += error * this.dt
176
const derivative = (error - this.prevError) / this.dt
177
this.prevError = error
178
179
- return this.kP * error + this.integral + this.kD * derivative
+ return (this.kP * error) + (this.kI * this.integral) + (this.kD * derivative)
180
}
181
182
update(dt?: number): void {
0 commit comments