RIT VEXU Core API
Loading...
Searching...
No Matches
CommandController Class Reference

#include <command_controller.h>

Public Member Functions

 CommandController ()
 Create an empty CommandController. Add Command with CommandController::add()
 
 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 ()
 
bool last_command_timed_out ()
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CommandController()

CommandController::CommandController ( std::initializer_list< AutoCommand * > cmds)
inline

Create a CommandController with commands pre added. More can be added with CommandController::add()

Parameters
cmds

Member Function Documentation

◆ 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
cmdthe AutoCommand we want to add to our list
timeout_secondsthe 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
cmdthe AutoCommand we want to add to our list
timeout_secondsthe 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
cmdsthe 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
cmdsthe AutoCommands we want to add to our list Add multiple commands to the queue. No timeout here.
cmdsthe AutoCommands we want to add to our list
timeout_sectimeout in seconds to apply to all commands if they are still the default

Add multiple commands to the queue. No timeout here.

Parameters
cmdsthe AutoCommands we want to add to our list
timeouttimeout 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_cancela 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: