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

[cmd] Add a warning to schedule javadocs #7073

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ private void initCommand(Command command, Set<Subsystem> requirements) {
* using those requirements have been scheduled as interruptible. If this is the case, they will
* be interrupted and the command will be scheduled.
*
* <p>WARNING: using this function directly is often a footgun and should be avoided. Instead
* Triggers should be used to schedule Commands.
*
* @param command the command to schedule. If null, no-op.
*/
private void schedule(Command command) {
Expand Down Expand Up @@ -230,6 +233,9 @@ private void schedule(Command command) {
/**
* Schedules multiple commands for execution. Does nothing for commands already scheduled.
*
* <p>WARNING: using this function directly is often a footgun and should be avoided. Instead
* Triggers should be used to schedule Commands.
*
* @param commands the commands to schedule. No-op on null.
*/
public void schedule(Command... commands) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class CommandScheduler final : public wpi::Sendable,
* interruptible. If this is the case, they will be interrupted and the
* command will be scheduled.
*
* @warning Using this function directly is often a footgun and should be
* avoided. Instead Triggers should be used to schedule Commands.
*
* @param command the command to schedule
*/
void Schedule(const CommandPtr& command);
Expand All @@ -112,6 +115,9 @@ class CommandScheduler final : public wpi::Sendable,
*
spacey-sooty marked this conversation as resolved.
Show resolved Hide resolved
* The pointer must remain valid through the entire lifecycle of the command.
*
* @warning Using this function directly is often a footgun and should be
* avoided. Instead Triggers should be used to schedule Commands.
*
* @param command the command to schedule
*/
void Schedule(Command* command);
Expand All @@ -120,6 +126,9 @@ class CommandScheduler final : public wpi::Sendable,
* Schedules multiple commands for execution. Does nothing for commands
* already scheduled.
*
* @warning Using this function directly is often a footgun and should be
* avoided. Instead Triggers should be used to schedule Commands.
*
* @param commands the commands to schedule
*/
void Schedule(std::span<Command* const> commands);
Expand All @@ -128,6 +137,9 @@ class CommandScheduler final : public wpi::Sendable,
* Schedules multiple commands for execution. Does nothing for commands
* already scheduled.
*
* @warning Using this function directly is often a footgun and should be
* avoided. Instead Triggers should be used to schedule Commands.
*
* @param commands the commands to schedule
*/
void Schedule(std::initializer_list<Command*> commands);
Expand Down
Loading