#include <command_controller.h>
|
| | CommandController (std::initializer_list< AutoCommand * > cmds) |
| | Create a CommandController with commands pre added. More can be added with CommandController::add().
|
| void | add (std::vector< AutoCommand * > cmds) |
| void | add (AutoCommand *cmd, double timeout_seconds=10.0) |
| void | add (std::vector< AutoCommand * > cmds, double timeout_sec) |
| void | add_delay (int ms) |
| void | add_cancel_func (std::function< bool(void)> true_if_cancel) |
| | add_cancel_func specifies that when this func evaluates to true, to cancel the command controller
|
| void | run () |
|
std::string | toString () |
| | returns the amount of commands in the controller
|
| bool | last_command_timed_out () |
File: command_controller.h Desc: A CommandController manages the AutoCommands that make up an autonomous route. The AutoCommands are kept in a queue and get executed and removed from the queue in FIFO order.
◆ CommandController()
| CommandController::CommandController |
( |
std::initializer_list< AutoCommand * > | cmds | ) |
|
|
inline |
◆ add() [1/3]
| void CommandController::add |
( |
AutoCommand * | cmd, |
|
|
double | timeout_seconds = 10.0 ) |
File: command_controller.cpp Desc: A CommandController manages the AutoCommands that make up an autonomous route. The AutoCommands are kept in a queue and get executed and removed from the queue in FIFO order. Adds a command to the queue
- Parameters
-
| cmd | the AutoCommand we want to add to our list |
| timeout_seconds | the number of seconds we will let the command run for. If it exceeds this, we cancel it and run on_timeout |
◆ add() [2/3]
| void CommandController::add |
( |
std::vector< AutoCommand * > | cmds | ) |
|
Adds a command to the queue
- Parameters
-
| cmd | the AutoCommand we want to add to our list |
| timeout_seconds | the number of seconds we will let the command run for. If it exceeds this, we cancel it and run on_timeout. if it is <= 0 no time out will be applied |
Add multiple commands to the queue. No timeout here.
- Parameters
-
| cmds | the AutoCommands we want to add to our list |
◆ add() [3/3]
| void CommandController::add |
( |
std::vector< AutoCommand * > | cmds, |
|
|
double | timeout_sec ) |
Add multiple commands to the queue. No timeout here.
- Parameters
-
| cmds | the AutoCommands we want to add to our list Add multiple commands to the queue. No timeout here. |
| cmds | the AutoCommands we want to add to our list |
| timeout_sec | timeout in seconds to apply to all commands if they are still the default |
Add multiple commands to the queue. No timeout here.
- Parameters
-
| cmds | the AutoCommands we want to add to our list |
| timeout | timeout in seconds to apply to all commands if they are still the default |
◆ add_cancel_func()
| void CommandController::add_cancel_func |
( |
std::function< bool(void)> | true_if_cancel | ) |
|
add_cancel_func specifies that when this func evaluates to true, to cancel the command controller
- Parameters
-
| true_if_cancel | a function that returns true when we want to cancel the command controller |
◆ add_delay()
| void CommandController::add_delay |
( |
int | ms | ) |
|
Adds a command that will delay progression of the queue
- Parameters
-
| ms | - number of milliseconds to wait before continuing execution of autonomous |
◆ last_command_timed_out()
| bool CommandController::last_command_timed_out |
( |
| ) |
|
last_command_timed_out tells how the last command ended Use this if you want to make decisions based on the end of the last command
- Returns
- true if the last command timed out. false if it finished regularly
◆ run()
| void CommandController::run |
( |
| ) |
|
Begin execution of the queue Execute and remove commands in FIFO order
The documentation for this class was generated from the following files: