public class SampleRobot extends RobotBase
You can build a simple robot program off of this by overriding the robotinit(), disabled(), autonomous() and operatorControl() methods. The startCompetition() method will calls these methods (sometimes repeatedly). depending on the state of the competition.
Alternatively you can override the robotMain() method and manage all aspects of the robot yourself.
m_ds, MAIN_THREAD_ID, ROBOT_TASK_PRIORITY
Constructor and Description |
---|
SampleRobot()
Create a new SampleRobot.
|
Modifier and Type | Method and Description |
---|---|
void |
autonomous()
Autonomous should go here.
|
protected void |
disabled()
Disabled should go here.
|
void |
operatorControl()
Operator control (tele-operated) code should go here.
|
protected void |
robotInit()
Robot-wide initialization code should go here.
|
void |
robotMain()
Robot main program for free-form programs.
|
void |
startCompetition()
Start a competition.
|
void |
test()
Test code should go here.
|
free, getBooleanProperty, initializeHardwareConfiguration, isAutonomous, isDisabled, isEnabled, isNewDataAvailable, isOperatorControl, isReal, isSimulation, isTest, main
public SampleRobot()
protected void robotInit()
Users should override this method for default Robot-wide initialization which will be called when the robot is first powered on. It will be called exactly one time.
Warning: the Driver Station "Robot Code" light and FMS "Robot Ready" indicators will be off until RobotInit() exits. Code in RobotInit() that waits for enable will cause the robot to never indicate that the code is ready, causing the robot to be bypassed in a match.
protected void disabled()
Called once each time the robot enters the disabled state.
public void autonomous()
Called once each time the robot enters the autonomous state.
public void operatorControl()
Called once each time the robot enters the operator-controlled state.
public void test()
public void robotMain()
This should be overridden by user subclasses if the intent is to not use the autonomous() and operatorControl() methods. In that case, the program is responsible for sensing when to run the autonomous and operator control functions in their program.
This method will be called immediately after the constructor is called. If it has not been overridden by a user subclass (i.e. the default version runs), then the robotInit(), disabled(), autonomous() and operatorControl() methods will be called.
public void startCompetition()
startCompetition
in class RobotBase