Class PeriodicScheduler


  • public class PeriodicScheduler
    extends java.lang.Object
    The PeriodicScheduler class allows one to easily add tasks to run periodically in every mode except test mode. For example, one can add methods to report information to the driver station, or to check if preferences have been changed. This class should be thread-safe, provided it is OK to run all events from the main thread.
    • Method Detail

      • addEvent

        public void addEvent​(java.lang.Runnable event)
        Add an event to the list of events. This event will run once every time run() is called. If using HYPERRobot, this happens once every autonomousPeriodic, teleopPeriodic, and disabledPeriodic. As of hyperLib 0.3.1, it is safe to call this from within an event, and to call it from any thread.
        Parameters:
        event - A Runnable object representing the task to run
      • clear

        public void clear()
        Remove all scheduled tasks. This is mainly useful for testing.
      • run

        public void run()
        Run all of the events which have been added to the scheduler. If you are using HYPERRobot, you do not need to call this manually.