6#include <frc2/command/Command.h>
7#include <wpi/SmallSet.h>
8#include <frc/event/EventLoop.h>
10#include "pathplanner/lib/events/Event.h"
11#include "pathplanner/lib/trajectory/PathPlannerTrajectory.h"
12#include "pathplanner/lib/path/PathPlannerPath.h"
14namespace pathplanner {
28 m_eventCommands.clear();
29 m_upcomingEvents.clear();
31 m_upcomingEvents.insert(m_upcomingEvents.end(), events.begin(),
41 void execute(units::second_t time);
56 std::shared_ptr<PathPlannerPath> path) {
57 wpi::SmallSet<frc2::Subsystem*, 4> allReqs;
58 for (
auto m : path->getEventMarkers()) {
59 auto markerReqs = m.getCommand()->GetRequirements();
60 allReqs.insert(markerReqs.begin(), markerReqs.end());
80 static inline frc::EventLoop* getEventLoop() {
81 static frc::EventLoop *eventLoop =
new frc::EventLoop();
86 std::vector<std::pair<std::shared_ptr<frc2::Command>,
bool>> m_eventCommands;
87 std::deque<std::shared_ptr<Event>> m_upcomingEvents;
Definition: EventScheduler.h:15
static wpi::SmallSet< frc2::Subsystem *, 4 > getSchedulerRequirements(std::shared_ptr< PathPlannerPath > path)
Definition: EventScheduler.h:55
void scheduleCommand(std::shared_ptr< frc2::Command > command)
Definition: EventScheduler.cpp:48
void cancelCommand(std::shared_ptr< frc2::Command > command)
Definition: EventScheduler.cpp:70
void initialize(PathPlannerTrajectory trajectory)
Definition: EventScheduler.h:27
void execute(units::second_t time)
Definition: EventScheduler.cpp:5
void end()
Definition: EventScheduler.cpp:29
EventScheduler()
Definition: EventScheduler.h:18
Definition: PathPlannerTrajectory.h:29
std::vector< std::shared_ptr< Event > > getEvents()
Definition: PathPlannerTrajectory.h:71