use of me.wobblyyyy.pathfinder2.trajectory.TaskTrajectory in project Pathfinder2 by Wobblyyyy.
the class Pathfinder method task.
/**
* Create a new {@link TaskTrajectory} and add it to Pathfinder's
* queue so that it can be executed
*
* @param initial code to be executed the first time the trajectory's
* {@code #isDone(PointXYZ)} method is called.
* @param during code to be executed any time the trajectory's
* {@code #isDone(PointXYZ)} method is called.
* @param onFinish code to be executed whenever the task is finished.
* @param isFinished a supplier that indicates if the task is finished.
* If the task is not finished, it should continue stop
* its execution.
* @param minTimeMs the minimum time, in milliseconds, the trajectory
* will be active for.
* @param maxTimeMs the maximum time, in milliseconds, the trajectory
* will be active for.
* @return {@code this}, used for method chaining.
*/
public Pathfinder task(Runnable initial, Runnable during, Runnable onFinish, Supplier<Boolean> isFinished, double minTimeMs, double maxTimeMs) {
Trajectory trajectory = new TaskTrajectoryBuilder().setInitial(initial).setDuring(during).setOnFinish(onFinish).setIsFinished(isFinished).setMinTimeMs(minTimeMs).setMaxTimeMs(maxTimeMs).build();
followTrajectory(trajectory);
return this;
}
Aggregations