Class jalansim::controller::PID
template <typename T>
ClassList > jalansim > controller > PID
Proportional-Integral-Derivative ( PID ) controller.More...
#include <pid.hpp>
Public Functions
| Type | Name |
|---|---|
| JALANSIM_HOST_DEVICE | PID (T kp, T ki, T kd, T min_value=T(-1e9), T max_value=T(1e9), T min_output=T(-1e9), T max_output=T(1e9)) Constructor for PID controller. |
| JALANSIM_HOST_DEVICE T | compute (T setpoint, T measured_value, T dt) Compute PID control output. |
| JALANSIM_HOST_DEVICE void | reset () Reset the PID controller to initial state. |
Detailed Description
Implements a standard PID controller with configurable gains and output limits. Provides proportional, integral, and derivative control actions to minimize the error between setpoint and measured values. Includes input/output clamping for stability and safety.
Template parameters:
TNumeric type (float, double)
Public Functions Documentation
function PID
Constructor for PID controller.
inline JALANSIM_HOST_DEVICE jalansim::controller::PID::PID (
T kp,
T ki,
T kd,
T min_value=T(-1e9),
T max_value=T(1e9),
T min_output=T(-1e9),
T max_output=T(1e9)
)
Parameters:
kpProportional gain-
kiIntegral gain -
kdDerivative gain min_valueMinimum allowed input value (default: -1e9)max_valueMaximum allowed input value (default: 1e9)min_outputMinimum allowed output value (default: -1e9)max_outputMaximum allowed output value (default: 1e9)
function compute
Compute PID control output.
inline JALANSIM_HOST_DEVICE T jalansim::controller::PID::compute (
T setpoint,
T measured_value,
T dt
)
Calculates the control output based on the error between setpoint and measured value. Updates internal state (integral and previous error) for next iteration. Applies input and output clamping for stability.
Parameters:
setpointDesired target valuemeasured_valueCurrent measured/actual valuedtTime step since last computation
Returns:
Computed control output (clamped to output limits)
function reset
Reset the PID controller to initial state.
inline JALANSIM_HOST_DEVICE void jalansim::controller::PID::reset ()
Clears the accumulated integral error and previous error values. Useful when starting control of a new trajectory or after a significant disturbance.
The documentation for this class was generated from the following file include/jalansim/controller/pid.hpp