Class EventScheduler

java.lang.Object
com.pathplanner.lib.events.EventScheduler

public class EventScheduler extends Object
Scheduler for running events while following a trajectory

Note: The command that is running this scheduler must have the requirements of all commands that will be run during the path being followed.

  • Constructor Details

    • EventScheduler

      public EventScheduler()
      Create a new EventScheduler
  • Method Details

    • initialize

      public void initialize(PathPlannerTrajectory trajectory)
      Initialize the EventScheduler for the given trajectory. This should be called from the initialize method of the command running this scheduler.
      Parameters:
      trajectory - The trajectory this scheduler should handle events for
    • execute

      public void execute(double time)
      Run the scheduler. This should be called from the execute method of the command running this scheduler.
      Parameters:
      time - The current time along the trajectory
    • end

      public void end()
      End commands currently/events currently being handled by this scheduler. This should be called from the end method of the command running this scheduler.
    • getSchedulerRequirements

      public static Set<Subsystem> getSchedulerRequirements(PathPlannerPath path)
      Get the event requirements for the given path
      Parameters:
      path - The path to get all requirements for
      Returns:
      Set of event requirements for the given path
    • getEventLoop

      protected static EventLoop getEventLoop()
      Get the event loop used to poll global event triggers
      Returns:
      Event loop that polls global event triggers
    • scheduleCommand

      protected void scheduleCommand(Command command)
      Schedule a command on this scheduler. This will cancel other commands that share requirements with the given command.
      Parameters:
      command - The command to schedule
    • cancelCommand

      protected void cancelCommand(Command command)
      Cancel a command on this scheduler.
      Parameters:
      command - The command to cancel