Package com.pathplanner.lib.events
Class EventScheduler
java.lang.Object
com.pathplanner.lib.events.EventScheduler
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
cancelCommand
(Command command) Cancel a command on this scheduler.void
end()
End commands currently/events currently being handled by this scheduler.void
execute
(double time) Run the scheduler.protected static EventLoop
Get the event loop used to poll global event triggersGet the event requirements for the given pathvoid
initialize
(PathPlannerTrajectory trajectory) Initialize the EventScheduler for the given trajectory.protected void
scheduleCommand
(Command command) Schedule a command on this scheduler.
-
Constructor Details
-
EventScheduler
public EventScheduler()Create a new EventScheduler
-
-
Method Details
-
initialize
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
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
Get the event loop used to poll global event triggers- Returns:
- Event loop that polls global event triggers
-
scheduleCommand
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
Cancel a command on this scheduler.- Parameters:
command
- The command to cancel
-