IterativeRobotBase
- class wpilib.IterativeRobotBase(period: wpimath.units.seconds)
Bases:
RobotBase
IterativeRobotBase implements a specific type of robot program framework, extending the RobotBase class.
The IterativeRobotBase class does not implement StartCompetition(), so it should not be used by teams directly.
This class provides the following functions which are called by the main loop, StartCompetition(), at the appropriate times:
RobotInit() – provide for initialization at robot power-on
Init() functions – each of the following functions is called once when the appropriate mode is entered:
DisabledInit() – called each and every time disabled is entered from another mode
AutonomousInit() – called each and every time autonomous is entered from another mode
TeleopInit() – called each and every time teleop is entered from another mode
TestInit() – called each and every time test is entered from another mode
Periodic() functions – each of these functions is called on an interval:
RobotPeriodic()
DisabledPeriodic()
AutonomousPeriodic()
TeleopPeriodic()
TestPeriodic()
Exit() functions – each of the following functions is called once when the appropriate mode is exited:
DisabledExit() – called each and every time disabled is exited
AutonomousExit() – called each and every time autonomous is exited
TeleopExit() – called each and every time teleop is exited
TestExit() – called each and every time test is exited
Constructor for IterativeRobotBase.
- Parameters:
period – Period.
- autonomousExit() None
Exit code for autonomous mode should go here.
Users should override this method for code which will be called each time the robot exits autonomous mode.
- autonomousInit() None
Initialization code for autonomous mode should go here.
Users should override this method for initialization code which will be called each time the robot enters autonomous mode.
- autonomousPeriodic() None
Periodic code for autonomous mode should go here.
Users should override this method for code which will be called each time a new packet is received from the driver station and the robot is in autonomous mode.
- disabledExit() None
Exit code for disabled mode should go here.
Users should override this method for code which will be called each time the robot exits disabled mode.
- disabledInit() None
Initialization code for disabled mode should go here.
Users should override this method for initialization code which will be called each time the robot enters disabled mode.
- disabledPeriodic() None
Periodic code for disabled mode should go here.
Users should override this method for code which will be called each time a new packet is received from the driver station and the robot is in disabled mode.
- driverStationConnected() None
Code that needs to know the DS state should go here.
Users should override this method for initialization that needs to occur after the DS is connected, such as needing the alliance information.
- enableLiveWindowInTest(testLW: bool) None
Sets whether LiveWindow operation is enabled during test mode.
- Parameters:
testLW – True to enable, false to disable. Defaults to false. @throws if called in test mode.
- getPeriod() wpimath.units.seconds
Gets time period between calls to Periodic() functions.
- isLiveWindowEnabledInTest() bool
Whether LiveWindow operation is enabled during test mode.
- printWatchdogEpochs() None
Prints list of epochs added so far and their times.
- robotInit() None
Robot-wide initialization code should go here.
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.
Note: This method is functionally identical to the class constructor so that should be used instead.
- robotPeriodic() None
Periodic code for all modes should go here.
This function is called each time a new packet is received from the driver station.
- setNetworkTablesFlushEnabled(enabled: bool) None
Enables or disables flushing NetworkTables every loop iteration. By default, this is enabled.
- Deprecated:
Deprecated without replacement.
- Parameters:
enabled – True to enable, false to disable
- teleopExit() None
Exit code for teleop mode should go here.
Users should override this method for code which will be called each time the robot exits teleop mode.
- teleopInit() None
Initialization code for teleop mode should go here.
Users should override this method for initialization code which will be called each time the robot enters teleop mode.
- teleopPeriodic() None
Periodic code for teleop mode should go here.
Users should override this method for code which will be called each time a new packet is received from the driver station and the robot is in teleop mode.
- testExit() None
Exit code for test mode should go here.
Users should override this method for code which will be called each time the robot exits test mode.
- testInit() None
Initialization code for test mode should go here.
Users should override this method for initialization code which will be called each time the robot enters test mode.
- testPeriodic() None
Periodic code for test mode should go here.
Users should override this method for code which will be called each time a new packet is received from the driver station and the robot is in test mode.