WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
Scheduler Class Reference
Inheritance diagram for Scheduler:
ErrorBase NamedSendable Sendable

Public Member Functions

void AddCommand (Command *command)
 Add a command to be scheduled later. More...
 
void AddButton (ButtonScheduler *button)
 
void RegisterSubsystem (Subsystem *subsystem)
 Registers a Subsystem to this Scheduler, so that the Scheduler might know if a default Command needs to be run. More...
 
void Run ()
 Runs a single iteration of the loop. More...
 
void Remove (Command *command)
 Removes the Command from the Scheduler. More...
 
void RemoveAll ()
 
void ResetAll ()
 Completely resets the scheduler. More...
 
void SetEnabled (bool enabled)
 
void UpdateTable ()
 Update the network tables associated with the Scheduler object on the SmartDashboard.
 
std::string GetSmartDashboardType () const
 
void InitTable (std::shared_ptr< ITable > subTable)
 Initializes a table for this sendable object. More...
 
std::shared_ptr< ITableGetTable () const
 
std::string GetName () const
 
std::string GetType () const
 
- Public Member Functions inherited from ErrorBase
 ErrorBase (const ErrorBase &)=delete
 
ErrorBaseoperator= (const ErrorBase &)=delete
 
virtual ErrorGetError ()
 Retrieve the current error. More...
 
virtual const ErrorGetError () const
 
virtual void SetErrnoError (llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
 Set error information associated with a C library call that set an error to the "errno" global variable. More...
 
virtual void SetImaqError (int success, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
 Set the current error information associated from the nivision Imaq API. More...
 
virtual void SetError (Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetWPIError (llvm::StringRef errorMessage, Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void CloneError (const ErrorBase &rhs) const
 
virtual void ClearError () const
 Clear the current error information associated with this sensor.
 
virtual bool StatusIsFatal () const
 Check if the current error code represents a fatal error. More...
 

Static Public Member Functions

static SchedulerGetInstance ()
 Returns the Scheduler, creating it if one does not exist. More...
 
- Static Public Member Functions inherited from ErrorBase
static void SetGlobalError (Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber)
 
static void SetGlobalWPIError (llvm::StringRef errorMessage, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber)
 
static ErrorGetGlobalError ()
 Retrieve the current global error.
 

Additional Inherited Members

- Protected Attributes inherited from ErrorBase
Error m_error
 
- Static Protected Attributes inherited from ErrorBase
static priority_mutex _globalErrorMutex
 
static Error _globalError
 

Member Function Documentation

void Scheduler::AddCommand ( Command command)

Add a command to be scheduled later.

In any pass through the scheduler, all commands are added to the additions list, then at the end of the pass, they are all scheduled.

Parameters
commandThe command to be scheduled
Scheduler * Scheduler::GetInstance ( )
static

Returns the Scheduler, creating it if one does not exist.

Returns
the Scheduler
std::string Scheduler::GetName ( ) const
virtual
Returns
the name of the subtable of SmartDashboard that the Sendable object will use

Implements NamedSendable.

std::string Scheduler::GetSmartDashboardType ( ) const
virtual
Returns
the string representation of the named data type that will be used by the smart dashboard for this sendable

Implements Sendable.

std::shared_ptr< ITable > Scheduler::GetTable ( ) const
virtual
Returns
the table that is currently associated with the sendable

Implements Sendable.

void Scheduler::InitTable ( std::shared_ptr< ITable subtable)
virtual

Initializes a table for this sendable object.

Parameters
subtableThe table to put the values in.

Implements Sendable.

void Scheduler::RegisterSubsystem ( Subsystem subsystem)

Registers a Subsystem to this Scheduler, so that the Scheduler might know if a default Command needs to be run.

All Subsystems should call this.

Parameters
systemthe system
void Scheduler::Remove ( Command command)

Removes the Command from the Scheduler.

Parameters
commandthe command to remove
void Scheduler::ResetAll ( )

Completely resets the scheduler.

Undefined behavior if running.

void Scheduler::Run ( )

Runs a single iteration of the loop.

This method should be called often in order to have a functioning Command system. The loop has five stages:

  1. Poll the Buttons
  2. Execute/Remove the Commands
  3. Send values to SmartDashboard
  4. Add Commands
  5. Add Defaults

The documentation for this class was generated from the following files: