Skip to content
Open
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
11 changes: 11 additions & 0 deletions commandsv3/src/main/java/org/wpilib/command3/Mechanism.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package org.wpilib.command3;

import java.util.List;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import org.wpilib.annotation.NoDiscard;
import org.wpilib.units.measure.Time;
Expand Down Expand Up @@ -145,6 +146,16 @@ public Command idleFor(Time duration) {
return idle().withTimeout(duration);
}

/**
* Returns a command that idles this mechanism until the given condition becomes true.
*
* @param condition What condition the mechanism should wait for.
* @return A new idle command.
*/
public Command idleUntil(BooleanSupplier condition) {
return idle().until(condition).withAutomaticName();
}

/**
* Gets all running commands that require this mechanism. Commands are returned in the order in
* which they were scheduled. The returned list is read-only. Every command in the list will have
Expand Down
Loading