Skip to content

Conversation

@Daniel1464
Copy link
Contributor

@Daniel1464 Daniel1464 commented Oct 20, 2025

Currently, standard command groups (like Commands.sequence and Commands.parallel) require all subsystems used by any of their children for the entire duration of the group's execution. This prevents the default commands of "idle" subsystems (those required by the group but not by the currently running child command) from running.

This new class provides factory methods that fix this behavior by ensuring default commands run on any subsystem that is not in use by the active command(s).

These commands are designed to bring most of the appeal of proxying(having default commands run within command groups) without the compromise of undefined cancellation behavior and requirements conflicts.

@Daniel1464 Daniel1464 requested a review from a team as a code owner October 20, 2025 14:58
@github-actions
Copy link
Contributor

This PR modifies commands. Please open a corresponding PR in Python Commands and include a link to this PR.

@github-actions github-actions bot added the component: command-based WPILib Command Based Library label Oct 20, 2025
Copy link
Contributor

@KangarooKoala KangarooKoala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually this will also need tests and C++.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't this be a (private) factory method in NonBlockingCommands wrapping around Commands.parallel()?
This class violates the command method lifecycle invariants- For example, scheduling cmd.deadlineFor(new RunDefaultsCommand(requirements)) (with no other commands involving requirements running) will cause the default commands to be initialized, executed, then initialized again without a call to end() once the deadline finishes. Another example is a default command finishing normally (which is generally not advised but does happen) but other default commands still running, causing the finished default command to have execute() called at unexpected times.

allReqs.addAll(command.getRequirements());
}
var group = new SequentialCommandGroup();
group.addRequirements();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this no-op here for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I think it got left there for some reason - thanks

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

Labels

component: command-based WPILib Command Based Library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants