Programming resources for FIRST Robotics team 1318
The “main loop” of the robot is in CoreRobot.java (and Robot.java), which has a few entry points from the WPILib infrastructure that our code depends on. The class CoreRobot typically stays the same from year to year.
The entry points for code execution come from WPILib at the following times:
robotInit(), we initialize the mechanisms, logger, timer, and driver that the robot will use.teleopInit(), we run generalInit(). In generalInit() we apply the driver to each of the mechanisms and ensure that the timer has been started.autonomousInit(), we tell the driver that it is beginning autonomous mode, and then call generalInit().disabledInit(), we call the stop function for each of our mechanisms, the timer, and the driver.teleopPeriodic(), we call our generalPeriodic() function because we have structured our code to be the same for our teleop and autonomous modes. In generalPeriodic(), we first call the readSensor() function for each of our mechanisms, then call update() on the driver, and finally call the update() function for each of our mechanisms.autonomousPeriodic(), we again call generalPeriodic().