class wpilib.TimedRobot(self: wpilib.TimedRobot, period: seconds = 0.02) → None

Bases: wpilib.IterativeRobotBase

TimedRobot implements the IterativeRobotBase robot program framework.

The TimedRobot class is intended to be subclassed by a user creating a robot program.

Periodic() functions from the base class are called on an interval by a Notifier instance.

Constructor for TimedRobot.


period – Period.

addPeriodic(self: wpilib.TimedRobot, callback: Callable[], None], period: seconds, offset: seconds = 0.0) → None

Add a callback to run at a specific period with a starting time offset.

This is scheduled on TimedRobot’s Notifier, so TimedRobot and the callback run synchronously. Interactions between them are thread-safe.

  • callback – The callback to run.

  • period – The period at which to run the callback.

  • offset – The offset from the common starting time. This is useful for scheduling a callback in a different timeslot relative to TimedRobot.

endCompetition(self: wpilib.TimedRobot) → None

Ends the main loop in StartCompetition().

getPeriod(self: wpilib.TimedRobot) → seconds

Get the time period between calls to Periodic() functions.

kDefaultPeriod = 0.02
startCompetition(self: wpilib.TimedRobot) → None

Provide an alternate “main loop” via StartCompetition().