Wyatt
1.0.1
|
Public Member Functions | |
Command () | |
virtual | ~Command () |
void | init () |
virtual bool | execute ()=0 |
virtual bool | cleanup (bool canceled)=0 |
void | cancel () |
void | stop () |
bool | isRunning () |
bool | isInitialized () |
void | setIsRunning (bool value) |
bool | isFinished () |
Protected Attributes | |
std::mutex | m_lock |
Lock for managing access to member variables in a thread-safe manner. | |
Command::Command | ( | ) |
Create a new command.
Definition at line 7 of file Command.cpp.
|
virtual |
Destroy the command object.
Definition at line 12 of file Command.cpp.
void Command::cancel | ( | ) |
This method is called when a command is canceled. Cancellation only comes from the command manager, so this method should never be directly called. You do not necessarily need to override this function in your command - it will call stop() by default. Only override this if you need custom behavior for when the command is stopped prematurely.
Definition at line 23 of file Command.cpp.
|
pure virtual |
This method is called to cleanup the command (whenever the stop method is called).
canceled | true if command was canceled, false otherwise. |
Implemented in DriveMotorRPM, DriveRobotCommand, and SimpleIteratorCommand.
|
pure virtual |
This method is called periodically during the command execution. Think of it like the Arduino's loop() function. While the command is executing this will be called repeatedly. Do not include while loops in here.
Implemented in DriveMotorRPM, DriveRobotCommand, and SimpleIteratorCommand.
void Command::init | ( | ) |
Initialize the command.
Definition at line 16 of file Command.cpp.
bool Command::isFinished | ( | ) |
Returns if a command is finished or not.
Definition at line 64 of file Command.cpp.
bool Command::isInitialized | ( | ) |
Get if the command is initialized.
Definition at line 49 of file Command.cpp.
bool Command::isRunning | ( | ) |
Get if the command is running or not.
Definition at line 41 of file Command.cpp.
void Command::setIsRunning | ( | bool | value | ) |
Set the running state of this command.
value | bool, running or not |
Definition at line 57 of file Command.cpp.
void Command::stop | ( | ) |
This method is called when a command has completed execution. Use this method to clean up anything that the command needs to clean before it is destroyed.
Definition at line 32 of file Command.cpp.