Skip to content

Conversation

@Daniel1464
Copy link
Contributor

This was always a thing that we should have added to the docs, so here it is.
Also, I fixed a couple of small things related to the AutoChooser too.

@github-actions github-actions bot added component: documentation Improvements or additions to documentation component: choreolib-java labels Nov 15, 2025
@DJ-Laser
Copy link

My take on a LoggedAutoChooser: https://gist.github.com/DJ-Laser/e0c11d7b835489ff63e6e4d2f72e089f
Since the default autoChooser has a special behavior on sim, it's important to keep the command name that will actually be ran logged instead of the user selected name, otherwise replay and real behavior could differ if an auto is selected and ran without alliance info.

@Daniel1464
Copy link
Contributor Author

My take on a LoggedAutoChooser: https://gist.github.com/DJ-Laser/e0c11d7b835489ff63e6e4d2f72e089f Since the default autoChooser has a special behavior on sim, it's important to keep the command name that will actually be ran logged instead of the user selected name, otherwise replay and real behavior could differ if an auto is selected and ran without alliance info.

Your implementation does seem correct, but isn't alliance info automatically replayed as well? If no alliance info is given, the auto should default to a null-op.
My main concern with your implementation, though, is that its a little bit of a leaky abstraction. Manual select() calls on the AutoChooser will cause replay to be inaccurate, because they override the AutoChooser's internal selected String property.

@DJ-Laser
Copy link

In a real robot, starting an auto without alliance info would be a no-op, but in simulation, it forces the command to generate, which would cause a difference in behavior in replay.

// AutoChooser.class line 213
public Command selectedCommand() {
    if (RobotBase.isSimulation() && nameAtGeneration == DO_NOTHING_NAME) {
      select(selected, true);
    }
    return generatedCommand;
}

I don't think calling select() an issue since that's what happens when it is set via networktables anyway?
In a real robot the internal selected variable may be "someAuto" but have a "Nothing" nameAtGeneration until it is selected again with Alliance data.
In a replay, the Chooser's selected variable will be "Nothing" until the time when a a different nameAtGeneration was logged, so the behavior should be the same, though correct me if I'm wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants