Path planner event markers

I am a little confused about the path planner with event markers example on the path planner docs:

// This will load the file "Example Path.path" and generate it with a max velocity of 4 m/s and a max acceleration of 3 m/s^2
PathPlannerTrajectory examplePath = PathPlanner.loadPath("Example Path", new PathConstrains(4, 3));

// This is just an example event map. It would be better to have a constant, global event map
// in your code that will be used by all path following commands.
HashMap<String, Command> eventMap = new HashMap<>();
eventMap.put("marker1", new PrintCommand("Passed marker 1"));
eventMap.put("intakeDown", new IntakeDown());

FollowPathWithEvents command = new FollowPathWithEvents(
    getPathFollowingCommand(examplePath),
    examplePath.getMarkers(),
    eventMap
);

I can see that the example adds an event to drop the intake and another event to print something but how does the path know where to put the markers along the path. How can I specify when to trigger the event?

1 Like

In pathplanner you can place events along the path. You give the events names like marker1 or intakedown. Then in the code it sees these names and corresponds them with commands as shown in the example. So everytime it sees an event with the name it runs the command. When building paths in the pathplanner app click on the icon that looks like a pinpoint and then you can add event markers on your path.

2 Likes

Oh, I see. So I am supposed to add the markers along the path inside of the path planner app and inside the code, I correspond a marker to a command. Thanks!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.