IterativeRobotBase

class wpilib.IterativeRobotBase[source]

Bases: wpilib.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 only when first disabled - 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()

class Mode[source]

Bases: enum.Enum

An enumeration.

kAutonomous = 2
kDisabled = 1
kNone = 0
kTeleop = 3
kTest = 4
autonomousInit()[source]

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()[source]

Periodic code for autonomous mode should go here.

disabledInit()[source]

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()[source]

Periodic code for disabled mode should go here.

logger = <logging.Logger object>

A python logging object that you can use to send messages to the log. It is recommended to use this instead of print statements.

loopFunc()[source]

Call the appropriate function depending upon the current robot mode

robotInit()[source]

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 1 time.

Note

It is simpler to override this function instead of defining a constructor for your robot class

robotPeriodic()[source]

Periodic code for all robot modes should go here.

teleopInit()[source]

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()[source]

Periodic code for teleop mode should go here.

testInit()[source]

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()[source]

Periodic code for test mode should go here.