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

Introduce Features #4

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Introduce Features #4

wants to merge 7 commits into from

Conversation

kcooney
Copy link
Contributor

@kcooney kcooney commented Feb 17, 2024

Features can be initally disabled or disabled, and can be configured to be enabled via Shuffleboard. Commands can be configured to be scheduled only if all controlling features are enabled by using Features.whenAllEnabled().

This allows us to add functionality to the robot that might not be fully tested by having the functionality disabled by default.

@kcooney kcooney force-pushed the kevin/features branch 4 times, most recently from 2f449b1 to d54988d Compare February 18, 2024 01:46
@kcooney kcooney changed the base branch from main to phoenix6 February 23, 2024 04:58
kcooney and others added 4 commits March 16, 2024 15:10
Features can be initally disabled or disabled, and can be configured to be
enabled via Shuffleboard. Commands can be configured to be scheduled only
if all controlling features are enabled by using Features.whenAllEnabled().

This allows us to add functionality to the robot that might not be fully tested
by having the functionality disabled by default.
- Reduce code duplication in asSupplier() implementations
- Remove support for SmartDashboard
- Remove 'enabled' field and enabled() method from Feature
@kcooney kcooney changed the base branch from phoenix6 to main March 16, 2024 22:10
@kcooney kcooney changed the title Introduce Features. Introduce Features Mar 16, 2024
kcooney added 2 commits March 16, 2024 18:23
Evalating the features inside the command was problematic, since
replacing a Command expression with an expression that could
return a feature-controlled flag would change the requirements of
the resulting Command.
Copy link
Collaborator

@cuttestkittensrule cuttestkittensrule left a comment

Choose a reason for hiding this comment

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

lgtm, other than some testing things.
In the tests, the test command to run never finishes, and is also never canceled, which is not good.

Comment on lines +41 to +43
public void resetFeatures() {
FakeFeatures.reset(registry);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you are scheduling commands in these tests, you should make sure all of them are canceled by running CommandScheduler.cancelAll()

Comment on lines +65 to +72
static class SimpleCommand extends Command {
boolean ran = false;

@Override
public void execute() {
ran = true;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This command will never finish, as the command will only finish if Command.isFinished() returns false

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.

2 participants