mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-30 02:31:44 +00:00
committed by
Peter Johnson
parent
b115c75226
commit
b78f580d47
@@ -188,6 +188,56 @@ bool Command::Run() {
|
||||
return !IsFinished();
|
||||
}
|
||||
|
||||
/**
|
||||
* The initialize method is called the first time this Command is run after
|
||||
* being started.
|
||||
*/
|
||||
void Command::Initialize() {}
|
||||
|
||||
/**
|
||||
* The execute method is called repeatedly until this Command either finishes
|
||||
* or is canceled.
|
||||
*/
|
||||
void Command::Execute() {}
|
||||
|
||||
/**
|
||||
* Called when the command ended peacefully. This is where you may want
|
||||
* to wrap up loose ends, like shutting off a motor that was being used
|
||||
* in the command.
|
||||
*/
|
||||
void Command::End() {}
|
||||
|
||||
/**
|
||||
* Returns whether this command is finished.
|
||||
* If it is, then the command will be removed and {@link Command#end() end()}
|
||||
* will be called.
|
||||
*
|
||||
* <p>It may be useful for a team to reference the {@link Command#isTimedOut()
|
||||
* isTimedOut()} method for time-sensitive commands.</p>
|
||||
*
|
||||
* <p>By default this will always return false, which means it will never end
|
||||
* automatically. It may still be cancelled manually or interrupted by another
|
||||
* command. For most real-world scenarios you will override this method with
|
||||
* additional logic.</p>
|
||||
*
|
||||
* @return whether this command is finished.
|
||||
* @see Command#isTimedOut() isTimedOut()
|
||||
*/
|
||||
bool Command::IsFinished() { return false; }
|
||||
|
||||
/**
|
||||
* Called when the command ends because somebody called
|
||||
* {@link Command#cancel() cancel()} or another command shared the same
|
||||
* requirements as this one, and booted it out.
|
||||
*
|
||||
* <p>This is where you may want to wrap up loose ends, like shutting off a
|
||||
* motor that was being used in the command.</p>
|
||||
*
|
||||
* <p>Generally, it is useful to simply call the {@link Command#end() end()}
|
||||
* method within this method, as done here.</p>
|
||||
*/
|
||||
void Command::Interrupted() { End(); }
|
||||
|
||||
void Command::_Initialize() {}
|
||||
|
||||
void Command::_Interrupted() {}
|
||||
|
||||
Reference in New Issue
Block a user