Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nasty bug #40

Merged
merged 3 commits into from
Oct 6, 2024
Merged

Nasty bug #40

merged 3 commits into from
Oct 6, 2024

Conversation

kevinfrei
Copy link
Member

@kevinfrei kevinfrei commented Oct 6, 2024

NASTY BUG WARNING!

tl;dr: Update your version of TechnoLib if you're using v2+

Symptoms:

  • All opmode commands you've run since restarting the bot or deploying your code are being scheduled.
  • Auto paths are jerky (and you can control your bot during auto)
  • TeleOp controls seem haunted, because the bot will try to run the auto paths you had run previously

Details

When I switched from a Singleton to static methods for the CommandScheduler, I no longer deleted & recreated the singleton in the CommandScheduler.clear method. That particular action, however, had the side effect of also clearing out any commands that may have been scheduled.

So, without the fix the first time you run an opmode, everything looks fine. But when you start a second opmode, all the previous commands you scheduled on the first opmode will be running along with any new commands you may have scheduled.

What does this look like?

If your run a dumb auto that does nothing but waits for 25 seconds to test things out and ends with "terminateOpMode", then you run a teleop mode for driving around, your teleop is going to terminate in 25 seconds.
If you run a RoadRunner opmode after a 'fresh' deploy, it will work fine. But then if you run that driving around opmode, the command scheduler flips between driving and running your roadrunner opmode at the same time. So the bot slowly jerks toward it's auto goals, while you're not doing anything with the joystick at all. Then, you may want to go back and try your auto opmode again, but because the joystick drive command is still scheduled, the path ran nice and smooth the first time, but not it's jerky and awful.

Kevin's a read idiot

It turns out that this change did cause some tests to start failing, but I didn't see it at the time, so 30 commits later, I noticed that some tests were failing, and just updated the tests to assume the new behavior was correct.

@kevinfrei kevinfrei merged commit 4edacc6 into main Oct 6, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant