diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java index 0e80a74c61..15babf85bb 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java @@ -180,6 +180,9 @@ public final class CommandScheduler implements Sendable, AutoCloseable { * using those requirements have been scheduled as interruptible. If this is the case, they will * be interrupted and the command will be scheduled. * + *
WARNING: using this function directly can often lead to unexpected behavior 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) { @@ -230,6 +233,9 @@ public final class CommandScheduler implements Sendable, AutoCloseable { /** * Schedules multiple commands for execution. Does nothing for commands already scheduled. * + *
WARNING: using this function directly can often lead to unexpected behavior 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) {
diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/CommandScheduler.h b/wpilibNewCommands/src/main/native/include/frc2/command/CommandScheduler.h
index 2f43ff7bc2..c45d381155 100644
--- a/wpilibNewCommands/src/main/native/include/frc2/command/CommandScheduler.h
+++ b/wpilibNewCommands/src/main/native/include/frc2/command/CommandScheduler.h
@@ -88,6 +88,10 @@ 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 can often lead to unexpected behavior
+ * and should be avoided. Instead Triggers should be used to schedule
+ * Commands.
+ *
* @param command the command to schedule
*/
void Schedule(const CommandPtr& command);
@@ -112,6 +116,10 @@ class CommandScheduler final : public wpi::Sendable,
*
* The pointer must remain valid through the entire lifecycle of the command.
*
+ * @warning Using this function directly can often lead to unexpected behavior
+ * and should be avoided. Instead Triggers should be used to schedule
+ * Commands.
+ *
* @param command the command to schedule
*/
void Schedule(Command* command);
@@ -120,6 +128,10 @@ class CommandScheduler final : public wpi::Sendable,
* Schedules multiple commands for execution. Does nothing for commands
* already scheduled.
*
+ * @warning Using this function directly can often lead to unexpected behavior
+ * and should be avoided. Instead Triggers should be used to schedule
+ * Commands.
+ *
* @param commands the commands to schedule
*/
void Schedule(std::span