calculate
Calculates the PID output
Return
the PID output
Parameters
the current time (default: TimeSource.Monotonic.markNow())
the error in the target state; the difference between the desired state and the current state
the derivative of the error, or null to compute it automatically from the change in error over time. This is typically the difference between the desired and current velocity when controlling position, or the difference in acceleration when controlling velocity.
Calculates the PID output from an error MotionState.
This overload extracts the error and error derivative from the motion state's position and velocity components. The position magnitude is used as the error, and the velocity magnitude is used as the error derivative.
Return
the PID output
Parameters
the current time (default: TimeSource.Monotonic.markNow())
the error motion state containing position (error) and velocity (error derivative)
Calculates the PID output from a reference (setpoint) and measured value.
This overload assumes the reference derivative is zero (i.e., the setpoint is constant).
Return
the PID output
Parameters
the current time (default: TimeSource.Monotonic.markNow())
the desired/target value (setpoint)
the current measured value
the derivative of the measured value, or null to compute the error derivative automatically from the change in error over time.
Calculates the PID output from a reference (setpoint) and measured value, with their respective derivatives.
Return
the PID output
Parameters
the current time (default: TimeSource.Monotonic.markNow())
the desired/target value (setpoint)
the current measured value
the derivative of the reference value (e.g., desired velocity)
the derivative of the measured value (e.g., current velocity)
Calculates the PID output from reference and measured MotionStates.
This overload computes the error motion state by subtracting the measured state from the reference state. The position difference becomes the error, and the velocity difference becomes the error derivative.
Return
the PID output
Parameters
the current time (default: TimeSource.Monotonic.markNow())
the desired/target motion state (setpoint)
the current measured motion state
Type Parameters
the unit type for the motion states (must be the same for both)