-
Notifications
You must be signed in to change notification settings - Fork 611
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
[cmd] Add Commands.choose (aka SendableChooserCommand) #6355
base: main
Are you sure you want to change the base?
[cmd] Add Commands.choose (aka SendableChooserCommand) #6355
Conversation
I implemented something similar recently. The Command chooser = Commands.choose(
chooser -> SmartDashboard.putData("Drive Command Chooser", chooser),
tankDrive, arcadeDrive, curvatureDrive
);
SmartDashboard.putData("Drive Command", chooser); I wonder if this change could increase in scope and if var chooser = new SendableChooserCommand(tankDrive, arcadeDrive, curvatureDrive);
// Does nothing unless sent to a Dashboard
SmartDashboard.putData("Drive Command", chooser); |
Why do you need to publish the command to the dashboard? |
Dashboards support starting and stopping commands that you upload. https://docs.wpilib.org/en/stable/docs/software/dashboards/glass/command-based-widgets.html |
Sure. That's separate functionality, and isn't needed for SendableChooserCommand. The primary use case for SendableChooser is selecting a command for auto, and the SendableChooser needs to be published for selections to be possible; there's no need (and practically no benefit) to put the command on the dashboard as well. |
c85ea89
to
11e62a9
Compare
wpilibNewCommands/src/test/java/edu/wpi/first/wpilibj2/command/SendableChooserCommandTest.java
Outdated
Show resolved
Hide resolved
#7340 might be resolved by this, though the discussion of the impl in that issue is different from the impl in this PR. (Hence why I'm avoiding the auto-linking words for now) |
Wow I forgot I wrote this. This PR does what I was thinking of in that issue. Is this missing something? |
I think there should be an overload that accepts a string and a command vararg in addition to the sendable chooser lambda overload. |
What would that string be used for, and what's the motivation for that overload? |
|
It shouldn't be coupled to SmartDashboard. Accepting an absolute NT key would be good, though. |
There doesn't appear to be a standard way to add a sendable to an arbitrary NT key, unfortunately. Maybe fix the merge conflicts for this PR and make an issue to add that capacity later? |
No description provided.