javaclient2.extra
Class PIDController

java.lang.Object
  extended by javaclient2.extra.Controller
      extended by javaclient2.extra.PIDController
Direct Known Subclasses:
HeadingControl, PositionControl

public class PIDController
extends Controller

Proportional-Integral-Derivative controller implementation.

Author:
Radu Bogdan Rusu

Field Summary
protected  double kd
          Derivative constant
protected  double ki
          Integral constant
protected  double kp
          Proportional constant
 
Fields inherited from class javaclient2.extra.Controller
currE, eSum, goal, lastE
 
Constructor Summary
PIDController(double Kp, double Ki, double Kd)
          Constructor for PIDController.
 
Method Summary
 double getCommand(double currentOutput)
          Calculate and return the controller's command for the controlled system.
 double getKd()
          Get the current value of the derivative constant.
 double getKi()
          Get the current value of the integral constant.
 double getKp()
          Get the current value of the proportional constant.
 void setKd(double newKd)
          Set a new value for the derivative constant.
 void setKi(double newKi)
          Set a new value for the integral constant.
 void setKp(double newKp)
          Set a new value for the proportional constant.
 
Methods inherited from class javaclient2.extra.Controller
deltaE, setGoal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kp

protected double kp
Proportional constant


ki

protected double ki
Integral constant


kd

protected double kd
Derivative constant

Constructor Detail

PIDController

public PIDController(double Kp,
                     double Ki,
                     double Kd)
Constructor for PIDController.

Parameters:
Kp - the proportional constant
Ki - the integral constant
Kd - the derivative constant
Method Detail

getCommand

public double getCommand(double currentOutput)
Calculate and return the controller's command for the controlled system.

Parameters:
currentOutput - the current output of the system
Returns:
the new calculated command for the system

getKp

public double getKp()
Get the current value of the proportional constant.

Returns:
Kp as a double

setKp

public void setKp(double newKp)
Set a new value for the proportional constant.

Parameters:
newKp - the new value for Kp

getKi

public double getKi()
Get the current value of the integral constant.

Returns:
Ki as a double

setKi

public void setKi(double newKi)
Set a new value for the integral constant.

Parameters:
newKi - the new value for Ki

getKd

public double getKd()
Get the current value of the derivative constant.

Returns:
Kd as a double

setKd

public void setKd(double newKd)
Set a new value for the derivative constant.

Parameters:
newKd - the new value for Kd