TimedRobot
- class wpilib.TimedRobot(period: wpimath.units.seconds = 0.02)
Bases:
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.
- Parameters:
period – Period.
- addPeriodic(callback: Callable[[], None], period: wpimath.units.seconds, offset: wpimath.units.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.
- Parameters:
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() None
Ends the main loop in StartCompetition().
- kDefaultPeriod = 20.0
- startCompetition() None
Provide an alternate “main loop” via StartCompetition().