|
Re: PIDController Rotate
public void turn(double speed, int angle)
{
PIDRotate rotate = new PIDRotate();
PIDController turn = new PIDController(DRIVE_P, DRIVE_I, DRIVE_D, gyro, rotate);
turn.setTolerance(0.05);
turn.setSetpoint(angle);
turn.setContinuous();
turn.enable();
while(!turn.onTarget())
{
drive(0.0, rotate.getValue());
}
turn.disable();
}
Here is what I have now. This is the method that completes a turn. Below is the PIDRotate class that gets the PID value written to it.
public class PIDRotate implements PIDOutput
{
private double value;
public PIDRotate()
{
value = 0.00;
}
public void pidWrite(double output)
{
value = output;
}
public double getValue()
{
return value;
}
}
|