File-By-File
FollowerGenerator

FollowerGenerator

A functional interface used for generating followers. Pathfinder's movement is controlled via an executor manager, which, in turn, controls several follower executors. Each of these follower executors executes a set of followers. Each of these followers instructs the robot on how to follow a certain trajectory.

Pathfinder can be commanded to follow a path using some of the methods available in the Voyager class. However, Pathfinder can only actually interpret followers - not just trajectories. A FollowerGenerator provides a way for Pathfinder to interpret trajectories as followers, and thus, interpret trajectories and move the robot accordingly.

Included in the "see" tag of this class JavaDoc is a link to the "generic follower generator." This is the simplest (and probably best) option when it comes to generating followers. Instead of creating your own method of creating new followers, the generic follower generator will produce generic followers - pretty simple, right? Unless you have a very specific use case, generic followers should work more than well enough.

Methods

generate(Robot robot, Trajectory trajectory)

Generates a new Follower based on the provided Robot and Trajectory.

  • robot: The Robot instance that this follower will act upon. This robot should be capable of providing positioning using the Robot.odometry() method, as well as providing movement options with the Robot.drive() method.
  • trajectory: The Trajectory that this follower should be following. Each Follower should be responsible for one single Trajectory, so a Follower will be created for this Trajectory.

Returns a newly-generated Follower responsible for the execution of the inputted trajectory.