|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.lejon.PIDController
This is an implementation of a PID controller to control and compensate the steering error of a DD. We use the rotation differential of the left and right wheel, i.e. the difference between the ticks of the left and the right rotation sensor, as input to the controller.
The setpoint given by the user is the constant ticks difference measured after a period of TIMEBASE, wich is the (constant) time between two successive calls to controlPID(). The setpoint is compared against the actual input and the error is calculated.
Then the error is amplified by the PID constants where the amplified error forms the output of the PID. The PID output is then actuated. The error is transformed in an equivalent power differential for the left and right motor wich compensates the measured error.
Constructor Summary | |
PIDController()
|
Method Summary | |
float |
controlPID(int ticksLeft,
int ticksRight)
Calls the control algorithm of the PID with inputs y=(ticksLeft - ticksRight) and r=setpoint set by reset(). |
void |
init(DriveParameters params)
Intialize the PID with the PID constants and the MaxTicksPerTimeBase from DriveParameters |
void |
reset(float newSetpoint)
Reset the PID with a new setpoint |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PIDController()
Method Detail |
public void init(DriveParameters params)
params
- the specific drive parameterspublic void reset(float newSetpoint)
newSetpoint
- the new setpointpublic float controlPID(int ticksLeft, int ticksRight)
ticksLeft
- amount of TICKS from left wheelticksRight
- amount of TICKS from right wheel
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |