You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.
We had a bug on Saturday. What happened is if we disabled in the middle of our autonomous code and then reenabled, the motors would sometimes continue at the same values they had before and would not accept input. I found a tricky infinite loop and fixed it, and from then on we didn't see the issue again:
Here's my attempt at figuring out what the issue is.
Consider the following TaskRunner and example task:
new TaskRunner(
new ExampleTask(),
new UpdateMotorsTask()
);
public class ExampleTask extends Task {
public void run() {
while (true) {
Robot.motors.allDrive.set(1.0);
wait.forFrame();
}
}
}
If you enable the robot, this task will run and work fine. However, if you make the logic slightly more insidious:
public class ExampleTask extends Task {
public void run() {
while (true) {
if (condition) {
continue;
}
Robot.motors.allDrive.set(1.0);
wait.forFrame();
}
}
}
If condition is true, then this task will get caught in an infinite loop and will not ever wait, and thus will not ever terminate. This loop will continue to run as long as condition is true...
Actually, I can't seem to get something that'd replicate the issue we saw on Saturday.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We had a bug on Saturday. What happened is if we disabled in the middle of our autonomous code and then reenabled, the motors would sometimes continue at the same values they had before and would not accept input. I found a tricky infinite loop and fixed it, and from then on we didn't see the issue again:
581d9e3#diff-2094e283bb3890e841571da6ac09c6b1R133
Here's my attempt at figuring out what the issue is.
Consider the following TaskRunner and example task:
If you enable the robot, this task will run and work fine. However, if you make the logic slightly more insidious:
If
condition
is true, then this task will get caught in an infinite loop and will not ever wait, and thus will not ever terminate. This loop will continue to run as long as condition is true...Actually, I can't seem to get something that'd replicate the issue we saw on Saturday.
The text was updated successfully, but these errors were encountered: