VEXcode Doxygen
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
vex::competition Class Reference

Use this class to set up your program for competitions. More...

#include <vex_competition.h>

Public Types

enum  tEventType { EVENT_INITIALIZE = 8, EVENT_AUTONOMOUS = 9, EVENT_DRIVER_CTL = 10, EVENT_DISABLE = 11 }
 

Public Member Functions

 competition ()
 Creates a competition object that has access to competition methods.
More...
 
void autonomous (void(*callback)(void))
 Calls back a function when the autonomous period starts. More...
 
void drivercontrol (void(*callback)(void))
 Calls back a function when the driver control period starts. More...
 
bool isEnabled ()
 Gets the status of your robot when under competition control. More...
 
bool isDriverControl ()
 Gets the status of the Driver Control period. More...
 
bool isAutonomous ()
 Gets the status of the Autonomous period. More...
 
bool isCompetitionSwitch ()
 Gets the status of the Competition Control Switch being plugged into the robot. More...
 
bool isFieldControl ()
 Gets the status of the Field Control System being plugged into the robot. More...
 
void test_auton (void)
 
void test_driver (void)
 
void test_disable (void)
 

Public Attributes

mevent PRE_AUTONOMOUS = {(uint32_t)brain::_getIndex(), (int32_t)tEventType::EVENT_INITIALIZE }
 
mevent AUTONOMOUS = {(uint32_t)brain::_getIndex(), (int32_t)tEventType::EVENT_AUTONOMOUS }
 
mevent DRIVER_CONTROL = {(uint32_t)brain::_getIndex(), (int32_t)tEventType::EVENT_DRIVER_CTL }
 
mevent DISABLED = {(uint32_t)brain::_getIndex(), (int32_t)tEventType::EVENT_DISABLE }
 

Static Public Attributes

static bool bStopTasksBetweenModes
 Sets whether or not your program will stop the competition tasks between modes. More...
 
static bool bStopAllTasksBetweenModes
 Sets whether or not your program will stop all tasks and events between modes. More...
 

Protected Member Functions

int32_t _getIndex ()
 

Detailed Description

Use this class to set up your program for competitions.

@prog_lang{block|cpp|pro}

Constructor & Destructor Documentation

◆ competition()

vex::competition::competition ( )

Creates a competition object that has access to competition methods.

@prog_lang{pro} @drawer_cat{constructor} @block_sig{vex::competition Competition = vex::competition();}

Member Function Documentation

◆ autonomous()

void vex::competition::autonomous ( void(*)(void)  callback)

Calls back a function when the autonomous period starts.

@prog_lang{cpp|pro} @drawer_cat{setting} @block_sig{Competition.autonomous(autonFunction);}

Parameters
callbackA reference to a function.

◆ drivercontrol()

void vex::competition::drivercontrol ( void(*)(void)  callback)

Calls back a function when the driver control period starts.

@prog_lang{cpp|pro} @drawer_cat{setting} @block_sig{Competition.drivercontrol(driverFunction);}

Parameters
callbackA reference to a function.

◆ isAutonomous()

bool vex::competition::isAutonomous ( )

Gets the status of the Autonomous period.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Competition.isAutonomous()}

Returns
Returns a Boolean based on if the Autonomous Period is active. If the Autonomous Period is active, the Boolean will return true.

◆ isCompetitionSwitch()

bool vex::competition::isCompetitionSwitch ( )

Gets the status of the Competition Control Switch being plugged into the robot.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Competition.isCompetitionSwitch()}

Returns
Returns a Boolean based on if the V5 is connected to the Competition Control Switch. If the Brain is connected, the Boolean will return true.

◆ isDriverControl()

bool vex::competition::isDriverControl ( )

Gets the status of the Driver Control period.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Competition.isDriverControl()}

Returns
Returns a Boolean based on if the Driver Control Period is active. If the Driver Control period is active, the Boolean will return true.

◆ isEnabled()

bool vex::competition::isEnabled ( )

Gets the status of your robot when under competition control.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Competition.isEnabled()}

Returns
Returns a Boolean based on if the autonomous or driver control periods is active. If either one is active, the Boolean will return true.

◆ isFieldControl()

bool vex::competition::isFieldControl ( )

Gets the status of the Field Control System being plugged into the robot.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Competition.isFieldControl()}

Returns
Returns a Boolean based on if the V5 is connected to the Field Control System. If the Brain is connected, the Boolean will return true.

Member Data Documentation

◆ bStopAllTasksBetweenModes

bool vex::competition::bStopAllTasksBetweenModes
static

Sets whether or not your program will stop all tasks and events between modes.

@prog_lang{cpp|pro} @drawer_cat{setting|none}

◆ bStopTasksBetweenModes

bool vex::competition::bStopTasksBetweenModes
static

Sets whether or not your program will stop the competition tasks between modes.

@prog_lang{cpp|pro} @drawer_cat{setting|none}


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