Package edu.wpi.first.wpilibj.command
Class TimedCommand
- java.lang.Object
-
- edu.wpi.first.wpilibj.command.Command
-
- edu.wpi.first.wpilibj.command.TimedCommand
-
- All Implemented Interfaces:
Sendable
,AutoCloseable
- Direct Known Subclasses:
WaitCommand
public class TimedCommand extends Command
ATimedCommand
will wait for a timeout before finishing.TimedCommand
is used to execute a command for a given amount of time.
-
-
Constructor Summary
Constructors Constructor Description TimedCommand(double timeout)
Instantiates a TimedCommand with the given timeout.TimedCommand(double timeout, Subsystem subsystem)
Instantiates a TimedCommand with the given timeout.TimedCommand(String name, double timeout)
Instantiates a TimedCommand with the given name and timeout.TimedCommand(String name, double timeout, Subsystem subsystem)
Instantiates a TimedCommand with the given name and timeout.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
isFinished()
Ends command when timed out.-
Methods inherited from class edu.wpi.first.wpilibj.command.Command
cancel, clearRequirements, close, doesRequire, end, execute, getGroup, getName, getSubsystem, initialize, initSendable, interrupted, isCanceled, isCompleted, isInterruptible, isRunning, isTimedOut, requires, setInterruptible, setName, setRunWhenDisabled, setSubsystem, setTimeout, start, timeSinceInitialized, toString, willRunWhenDisabled
-
-
-
-
Constructor Detail
-
TimedCommand
public TimedCommand(String name, double timeout)
Instantiates a TimedCommand with the given name and timeout.- Parameters:
name
- the name of the commandtimeout
- the time the command takes to run (seconds)
-
TimedCommand
public TimedCommand(double timeout)
Instantiates a TimedCommand with the given timeout.- Parameters:
timeout
- the time the command takes to run (seconds)
-
TimedCommand
public TimedCommand(String name, double timeout, Subsystem subsystem)
Instantiates a TimedCommand with the given name and timeout.- Parameters:
name
- the name of the commandtimeout
- the time the command takes to run (seconds)subsystem
- the subsystem that this command requires
-
TimedCommand
public TimedCommand(double timeout, Subsystem subsystem)
Instantiates a TimedCommand with the given timeout.- Parameters:
timeout
- the time the command takes to run (seconds)subsystem
- the subsystem that this command requires
-
-
Method Detail
-
isFinished
protected boolean isFinished()
Ends command when timed out.- Specified by:
isFinished
in classCommand
- Returns:
- whether this command is finished.
- See Also:
isTimedOut()
-
-