-
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] Deprecate Command.schedule() #7072
base: main
Are you sure you want to change the base?
Conversation
This PR modifies commands. Please open a corresponding PR in Python Commands and include a link to this PR. |
Usages (such as Trigger) need to be updated |
80686e6
to
8c8d94d
Compare
wpilibNewCommands/src/test/native/cpp/frc2/command/CommandSendableButtonTest.cpp
Outdated
Show resolved
Hide resolved
83cac71
to
dcc9044
Compare
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.
armbot needs update
Waiting on #7054 to remove it. |
92359e0
to
1a1552f
Compare
3f6f458
to
8aa7f14
Compare
Wait what's the logic over deprecating this again? Scheduling a command in the init block of a class is pretty useful for delayed side effects and such(and having to do CommandScheduler.getInstance().schedule()) is going to be pretty annoying every time this happens |
The purpose is to be annoying. We've seen time after time again that people will use Command.schedule() and be surprised when their commands get cancelled. The intended way to schedule commands is with Triggers, not Command.schedule(). By forcing the CommandScheduler call, the idea is that people will think more about how their schedule call will affect other commands. |
Gotchu; i was just thinking that there should possibly be a utility class for launching side effects(such as SideEffects.waitThenRun(0.4, () -> {...}) to replace the command functionality(although im not sure how much people actually use this). That's probably beyond the scope of this pr though |
8aa7f14
to
1e36eb5
Compare
It's a footgun and syntactic sugar over the CommandScheduler's schedule method. We don't need syntactic sugar for a footgun.
…ableButtonTest.cpp Co-authored-by: Starlight220 <[email protected]>
1e36eb5
to
0739b20
Compare
It's a footgun and syntactic sugar over the CommandScheduler's schedule method. We don't need syntactic sugar for a footgun.