$VULCAN/src/PID/
defines the class <PID-controller>
. The output mn of a PID controller obeys the equation
The class <PID-controller>
has the following public fields:
(kp (self <PID-controller>)) // proportional gain (kd (self <PID-controller>)) // derivate gain (displacement (self <PID-controller>)) // m_R (reset-time (self <PID-controller>)) (max-output (self <PID-controller>)) (min-output (self <PID-controller>))In order to use an instance of this class you have to provide values for the public fields above. For example,
(set! mcontroller (mstart (make <PID-controller) kp: 1 kd: 1 reset-time: 0.1 max-output: 10 min-output:10))The methods associated with this class are:
(mstart (self <PID-controller>)) (update (self <PID-controller>) error) (reset (self <PID-controller>))The method
update
returns the output of the controller given the current input error. The output is kept always between the maximum and minimum values specified for the controller. In addition, an ``antiwindup'' feature is incorporated in the controller, so that the controller detects when the integral term saturates and stops using the integral term of the controller until the output variable returns to within the control range.