Class: PidController
Defined in: src/sdk/utils/controllers/PidController.ts:23
A PID controller.
Constructors
Constructor
new PidController(
kP
,kI
,kD
,maxOut
,minOut
,maxI
,minI
):PidController
Defined in: src/sdk/utils/controllers/PidController.ts:44
Creates a new PidController.
Parameters
Parameter | 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
PidController
Methods
getOutput()
getOutput(
deltaTime
,error
):number
Defined in: src/sdk/utils/controllers/PidController.ts:62
Gets the output of the PID controller at a given time.
Parameters
Parameter | 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.
getPreviousError()
getPreviousError():
undefined
|number
Defined in: src/sdk/utils/controllers/PidController.ts:52
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.
reset()
reset():
void
Defined in: src/sdk/utils/controllers/PidController.ts:83
Resets the controller.
Returns
void
clamp()
static
clamp(value
,max
,min
):number
Defined in: src/sdk/utils/controllers/PidController.ts:96
Clamps a number to maximum and minimum values.
Parameters
Parameter | Type | Description |
---|---|---|
value | number | The value to clamp. |
max | number | The maximum value. |
min | number | The minumum value. |
Returns
number
The clamped value.