-
Notifications
You must be signed in to change notification settings - Fork 640
[wpilib, commands] Add warnWhenDisconnected() to HIDs #7877
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
base: main
Are you sure you want to change the base?
[wpilib, commands] Add warnWhenDisconnected() to HIDs #7877
Conversation
This PR modifies commands. Please open a corresponding PR in Python Commands and include a link to this PR. |
I think that'll need to be started after the WPILib PR is merged, since the changes to CommandGenericHID depend on the changes to GenericHID. |
This should follow the verbiage used in the other warning suppression methods |
Which other warning suppression methods? The doc comment explicitly calls out that this is NOT the same as |
Even if it is not exactly the same, the phrasing of the method name etc should be similar. That said, the distinctions should be documented (as they are atm) |
How does this interact with #7840 (using alerts for joystick warnings)? Is this just a temporary fix until that is implemented? |
So the name would be
The implementation would be different, but I'm guessing we'd want something with similar semantics, since it'll still be good to indicate that there should not be warnings when particular controllers are disconnected. Alerts are way nicer than DriverStation warnings for not obscuring other stuff happening, but it would still be good to have a clean status without those controllers so people don't get used to ignoring alerts. Thinking more about 2027, maybe this would become |
What's the reason for not warning/alerting when certain controllers are disconnected? I would think that would always be an undesirable condition if you're using it in the code. Note for 2027, we will have an easy way to set up multiple teleop/test modes, so things like "only using a joystick for testing" should be handled by that feature? |
It probably would be enough to have users only bind the testing controllers in a particular mode (as long as we make sure to use |
Not sure if we'd want this to be a decorator method instead (which modifies the instance and returns the instance), but having a setter was really simple and should work for every reasonable use case. A decorator would also be hard to name- Following the convention of
Command.ignoringDisable()
, this would beGenericHID.warningWhenDisconnected()
, which doesn't work well because "warning" is mostly used as a nounI don't think we have unit tests for generic HID, but I tested locally with all 9 permutations of (no call to warnWhenDisconnected() | warnWhenDisconnected(true) | warnWhenDisconnected(false)) x (no controller | xbox controller | controller without enough buttons).
Here's the diff I tested with:
The beep command makes it easier to tell if warnings are still being emitted.