javaclient2.extra
Class PDController

java.lang.Object
  extended by javaclient2.extra.Controller
      extended by javaclient2.extra.PDController

public class PDController
extends Controller

Proportional-Derivative controller implementation.

Author:
Radu Bogdan Rusu

Field Summary
protected  float kd
          Derivative constant
protected  float kp
          Proportional constant
 
Fields inherited from class javaclient2.extra.Controller
currE, eSum, goal, lastE
 
Constructor Summary
PDController(float Kp, float Kd)
          Constructor for PDController.
 
Method Summary
 float getCommand(float currentOutput)
          Calculate and return the controller's command for the controlled system.
 float getKd()
          Get the current value of the derivative constant.
 float getKp()
          Get the current value of the proportional constant.
 void setKd(float newKd)
          Set a new value for the derivative constant.
 void setKp(float 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 float kp
Proportional constant


kd

protected float kd
Derivative constant

Constructor Detail

PDController

public PDController(float Kp,
                    float Kd)
Constructor for PDController.

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

getCommand

public float getCommand(float 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 float getKp()
Get the current value of the proportional constant.

Returns:
Kp as a double

setKp

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

Parameters:
newKp - the new value for Kp

getKd

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

Returns:
Kd as a double

setKd

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

Parameters:
newKd - the new value for Kd