Skip to content

The RobotBase Class

Zach Anderson edited this page Jan 21, 2014 · 1 revision

All robots start with the abstract class RobotBase. RobotBase has two implementations, SimpleRobot and IterativeRobot. SimpleRobot requires us to handle timing ourselves by implementing a while loop in each of its functions. IterativeRobot handles timing for us, allow us to simply put code in the appropriate periodic method and the robot will run that code at a regular rate and then allows the cRIO to idle so as not to overload it.

###SimpleRobot SimpleRobot has three important methods:

  • autonomous() is called once at the start of autonomous mode.
  • operatorControl() is called once at the start of teleop mode.
  • test() is called once at the start of test mode

###IterativeRobot IterativeRobot has nine important methods:

  • robotInit() is called once during the entire operation of the robot, as soon as the code is run. initialization code should go here.
  • disabledInit() is called whenever the robot enter disabled mode.
  • disabledPeriodic() is called regularly while the robot is in disabled mode.
  • autonomousInit() is called whenever the robot enters autonomous mode, which should be only once per match.
  • autonomousPeriodic() is called regularly while the robot is in autonomous mode. This is where the code for autonomous mode will go.
  • teleopInit() is called whenever the robot enters teleop mode, which should be only once per match.
  • teleopPeriodic() is called regularly while the robot is in teleop mode. This is where the teleop code will go.
  • testInit() is called whenever the robot enters test mode.
  • testPeriodic() is called regularly while the robot is in test mode.
Clone this wiki locally