WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
RobotBase Class Referenceabstract

Implement a Robot Program framework. More...

#include <RobotBase.h>

Inheritance diagram for RobotBase:
IterativeRobot SampleRobot

Public Member Functions

bool IsEnabled () const
 Determine if the Robot is currently enabled. More...
 
bool IsDisabled () const
 Determine if the Robot is currently disabled. More...
 
bool IsAutonomous () const
 Determine if the robot is currently in Autonomous mode. More...
 
bool IsOperatorControl () const
 Determine if the robot is currently in Operator Control mode. More...
 
bool IsTest () const
 Determine if the robot is currently in Test mode. More...
 
bool IsNewDataAvailable () const
 Indicates if new data is available from the driver station. More...
 
virtual void StartCompetition ()=0
 

Static Public Member Functions

static RobotBasegetInstance ()
 
static void setInstance (RobotBase *robot)
 
static void startRobotTask (FUNCPTR factory)
 
static void robotTask (FUNCPTR factory, Task *task)
 
static void robotSetup (RobotBase *robot)
 

Protected Member Functions

 RobotBase ()
 Constructor for a generic robot program. More...
 
virtual ~RobotBase ()
 Free the resources for a RobotBase class. More...
 
 RobotBase (const RobotBase &)=delete
 
RobotBaseoperator= (const RobotBase &)=delete
 

Protected Attributes

Taskm_task = nullptr
 
DriverStationm_ds
 

Friends

class RobotDeleter
 

Detailed Description

Implement a Robot Program framework.

The RobotBase class is intended to be subclassed by a user creating a robot program. Overridden Autonomous() and OperatorControl() methods are called at the appropriate time as the match proceeds. In the current implementation, the Autonomous code will run to completion before the OperatorControl code could start. In the future the Autonomous code might be spawned as a task, then killed at the end of the Autonomous period.

Constructor & Destructor Documentation

RobotBase::RobotBase ( )
protected

Constructor for a generic robot program.

User code should be placed in the constructor that runs before the Autonomous or Operator Control period starts. The constructor will run to completion before Autonomous is entered.

This must be used to ensure that the communications code starts. In the future it would be nice to put this code into it's own task that loads on boot so ensure that it runs.

RobotBase::~RobotBase ( )
protectedvirtual

Free the resources for a RobotBase class.

This includes deleting all classes that might have been allocated as Singletons to they would never be deleted except here.

Member Function Documentation

bool RobotBase::IsAutonomous ( ) const

Determine if the robot is currently in Autonomous mode.

Returns
True if the robot is currently operating Autonomously as determined by the field controls.
bool RobotBase::IsDisabled ( ) const

Determine if the Robot is currently disabled.

Returns
True if the Robot is currently disabled by the field controls.
bool RobotBase::IsEnabled ( ) const

Determine if the Robot is currently enabled.

Returns
True if the Robot is currently enabled by the field controls.
bool RobotBase::IsNewDataAvailable ( ) const

Indicates if new data is available from the driver station.

Returns
Has new data arrived over the network since the last time this function was called?
bool RobotBase::IsOperatorControl ( ) const

Determine if the robot is currently in Operator Control mode.

Returns
True if the robot is currently operating in Tele-Op mode as determined by the field controls.
bool RobotBase::IsTest ( ) const

Determine if the robot is currently in Test mode.

Returns
True if the robot is currently running tests as determined by the field controls.

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