tested RunCommandForTime + DWIForTime in robotsim, both work

This commit is contained in:
aarav18
2022-03-22 16:56:40 -06:00
parent 8af4535191
commit 81ef2a858a
5 changed files with 32 additions and 22 deletions
@@ -56,6 +56,7 @@ public class RunCommandForTime extends CommandBase {
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
System.out.println("RUNNING");
this.elapsed = System.currentTimeMillis() - this.start;
this.command.execute();
}
@@ -70,6 +71,8 @@ public class RunCommandForTime extends CommandBase {
@Override
public boolean isFinished() {
if (this.override) {
System.out.println("Duration: " + duration);
System.out.println("Elapsed: " + elapsed);
return (this.elapsed >= this.duration);
} else {
return (this.command.isFinished() && (this.elapsed >= this.duration));