-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExamplePauseCommand.cpp
More file actions
41 lines (32 loc) · 936 Bytes
/
ExamplePauseCommand.cpp
File metadata and controls
41 lines (32 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/** An example Pausable Command that drives the drivetrain
* forward for 8 seconds, and allows itself to be paused
* @author Jordan Burklund
* @date Oct. 2015
**/
#include "ExamplePauseCommand.h"
ExamplePauseCommand::ExamplePauseCommand() : PausableCommand("ExamplePausable") {
}
/** Initialization **/
void ExamplePauseCommand::initialize() {
// lazy initialization
drivetrain = Robot::getInstance()->drivetrain;
}
/** Keep on truckin! **/
void ExamplePauseCommand::execute() {
drivetrain->drive(0.5, 0);
}
/** Stop the drivetrain when done **/
void ExamplePauseCommand::end() {
drivetrain->stop();
}
/** Command is finished when 8 unpaused seconds have elapsed **/
bool ExamplePauseCommand::isFinished() {
return getTime() > 8000;
}
/** Stop the drivetrain when paused **/
void ExamplePauseCommand::onPause() {
drivetrain->stop();
}
/** Do nothing special on resume **/
void ExamplePauseCommand::onResume() {
}