Class PathEvent

java.lang.Object
com.crossbotics.ftchelper.auto.PathEvent

public final class PathEvent extends Object
Something to do once while a path or a driveTo runs, when the robot gets to a place along it: "spin up the launcher 12 in before the end". The robot layer's PathAt makes these for you (PathAt.inchesLeft(12, "Spin up", robot.launcher::spinUp)); this is the plain form that AutoRoutine.followPath(String, PathJob, double, java.util.List) checks every loop.
  • Each event fires once. Every loop the routine checks the events in the order you wrote them, so two that are reached in the same loop fire in that order.
  • When the path gets to its end, every event that is reached at the end fires then (a path follower may stop a little short of the end: "1 in left" still fires).
  • When the path ends early (timed out, STALLED, NO_ODOMETRY, cut short), the report lists the events that did not fire: To the goal: STALLED, not fired: Spin up.
Docs: docs/modules/pedro.md ("Do things along the path")
  • Constructor Details

    • PathEvent

      public PathEvent(String name, Predicate<PathEvent.Progress> reached, Runnable action)
      Parameters:
      name - for the report, e.g. "Spin up"
      reached - true once the robot is far enough along (checked every loop until it fires)
      action - what to do, once (it must not wait: start things, like a run step)
  • Method Details

    • name

      public String name()
      The name given, for the report.