View Single Post
  #11   Spotlight this post!  
Unread 05-27-2011, 09:04 AM
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,712
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
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;
}
}
Reply With Quote