Code:
public void autonomous() {
xmove=.25;
autonomousTimer.start();
autonomousTimer.reset();
while(true){
if(photoSwitch.get()){
topLeft.set(xmove);
topRight.set(-xmove);
bottomLeft.set(xmove);
bottomRight.set(-xmove);
}
if(!photoSwitch.get())
{
topLeft.set(0);
topRight.set(0);
bottomLeft.set(0);
bottomRight.set(0);
}
if(autonomousTimer.get()>15.0){
topLeft.set(0);
topRight.set(0);
bottomLeft.set(0);
bottomRight.set(0);
break;
}
Watchdog.getInstance().feed(); //Gotta feed that watchdog
}
}
Sometimes, the code works as it's supposed to be, It (the bot)stops when it reaches the end of the line. Sometimes it keeps going indefinitely, and sometimes and it doesn't move. This makes no sense to me. I've been pulling my hair out as to why it keeps doing this. Any help would be appreciated.