RobotBuilder generated code

Main robot program

Main robot program

This is the main program generated by RobotBuilder. There are a number of parts to this program:

  1. This class extends IterativeRobot. IterativeRobot will call your autonomousPeriodic() and teleopPeriodic() methods every 20ms (each time the driver station exchanges Joystick and other data with the robot).
  2. Each of the subsystems is declared here These are public static variables so that they can be referenced from throughout your robot program by writing Robot.<subsystem-name>.method(), for example Robot.elevator.setSetpoint(4).
  3. The subsystems are instantiated in the robotInit() method that is called after the construtor runs for this class. It is important to be create the subsystems after the constructor to avoid recursive loops. Also instance of the OI() class (for your operator interface) and the autonomous command are created here.
  4. In the autonomousInit() method which is called every 20ms, make one scheduling pass. That is call the isFinished() and execute() methods of every command that is currently scheduled.
  5. In the teleopPeriodic method which is called every 20ms, make one scheduling pass.