Class: PidController
A PID controller.
Constructors
constructor
• new PidController(kP
, kI
, kD
, maxOut
, minOut
, maxI?
, minI?
): PidController
Creates a new PidController.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
kP | number | undefined | The proportional gain of the controller. |
kI | number | undefined | The integral gain of the controller. |
kD | number | undefined | The differential gain of the controller. |
maxOut | number | undefined | The maximum output of the controller. |
minOut | number | undefined | The minumum output of the controller. |
maxI | number | Number.MAX_SAFE_INTEGER | The maximum integral gain. |
minI | number | Number.MIN_SAFE_INTEGER | The minimum integral gain. |
Returns
Defined in
src/sdk/utils/controllers/PidController.ts:44
Methods
getOutput
▸ getOutput(deltaTime
, error
): number
Gets the output of the PID controller at a given time.
Parameters
Name | Type | Description |
---|---|---|
deltaTime | number | The difference in time between the previous sample and this sample. |
error | number | The amount of error seen between the desired output and the current output. |
Returns
number
The PID output.
Defined in
src/sdk/utils/controllers/PidController.ts:62
getPreviousError
▸ getPreviousError(): undefined
| number
Gets this controller's most recent error input since it was created or reset.
Returns
undefined
| number
This controller's most recent error input since it was created or reset.
Defined in
src/sdk/utils/controllers/PidController.ts:52
reset
▸ reset(): void
Resets the controller.
Returns
void
Defined in
src/sdk/utils/controllers/PidController.ts:83
clamp
▸ clamp(value
, max
, min
): number
Clamps a number to maximum and minimum values.
Parameters
Name | Type | Description |
---|---|---|
value | number | The value to clamp. |
max | number | The maximum value. |
min | number | The minumum value. |
Returns
number
The clamped value.
Defined in
src/sdk/utils/controllers/PidController.ts:96