PDA

View Full Version : Java Autonomous


goonsquad3604
02-11-2012, 11:45 AM
We are team 3604 and we program in java. Are autonomous method for interativeRobot is having issues. Any ideas?

public void autonomousContinuous()
{
getWatchdog().setEnabled(true);
getWatchdog().feed();


compressor.start();
in.set(true);
out.set(false);
in.set(false);

getWatchdog().feed();
Timer.delay(4);

getWatchdog().feed();
out.set(true);
out.set(false);

getWatchdog().feed();
Timer.delay(2);

getWatchdog().feed();
in.set(true);
in.set(false);

getWatchdog().feed();
Timer.delay(4);

getWatchdog().feed();
out.set(true);
out.set(false);

getWatchdog().feed();
Timer.delay(2);

getWatchdog().feed();
in.set(true);
in.set(false);
getWatchdog().feed();
}

theprgramerdude
02-11-2012, 12:25 PM
Um.... this is impossible to debug without the rest of the program. One issue, though, is that you're not feeding the watchdog enough. You're also doing absolutely nothing with what I believe is the solenoids... Yeah, you're doing absolutely nothing in your program at all, aside from trying to start the compressor -> which will fail, because you're not feeding the watchdog enough.

Chris27
02-11-2012, 01:37 PM
For one, your going about overriding autonomousContinuous() incorrectly. This is a function that will be executed at a fixed interval. I forgot what the exact interval is, but it is around ~50ms. It makes no sense to call Timer.delay or any function that blocks (i.e. waits for a long time for the function to return before moving on) inside autonomousContinuous() as this function should return quickly (no longer then the interval time).