Quote:
Originally Posted by cpapplefamily
pseudo code
Code:
public class myCounterCommand extends CommandBase {
double myCounter;
protected void initialize() {
myCounter = 0;
}
....
....
....
protected void execute() {
myCounter = myCounter + 10;
wait(1000);
}
or do I
Code:
...
...
protected void execute() {
while(true){
myCounter = myCounter + 10;
wait(1000);
}
}
here since the first called execute is not done will sequential calls be skipped?
here what happens the 49 times this execute is called when the wait is not done?
|
This will actually cause your entire robot to lock up for 1 second. A general rule of thumb when using the Command Based structure is to never use a wait().
Instead use a Date field to store the time and increment your count when the time has exceeded a second.