-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
2f449b1
to
d54988d
Compare
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
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.
There was a problem hiding this 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.
public void resetFeatures() { | ||
FakeFeatures.reset(registry); | ||
} |
There was a problem hiding this comment.
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()
static class SimpleCommand extends Command { | ||
boolean ran = false; | ||
|
||
@Override | ||
public void execute() { | ||
ran = true; | ||
} | ||
} |
There was a problem hiding this comment.
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
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.