Function rc_filter_pid#
Defined in File filter.h
Function Documentation#
-
int rc_filter_pid(rc_filter_t *f, double kp, double ki, double kd, double Tf, double dt)#
Creates a discrete-time implementation of a parallel PID controller with high-frequency rolloff using the forward-Euler integration method.
This is equivalent to the Matlab function: C = pid(Kp,Ki,Kd,Tf,Ts)
It is not possible to implement a pure differentiator with a discrete transfer function so this filter has high frequency rolloff with time constant Tf. Smaller Tf results in less rolloff, but Tf must be greater than dt/2 for stability. Returns 0 on success or -1 on failure.
- Parameters:
f – Pointer to user’s rc_filter_t struct
kp – [in] Proportional constant
ki – [in] Integration constant
kd – [in] Derivative constant
Tf – [in] High Frequency rolloff time constant (seconds)
dt – [in] desired timestep of discrete filter in seconds
- Returns:
Returns 0 on success or -1 on failure.