GenericFollower
A generic implementation of the Follower interface. For almost all use cases, this implementation should work fairly well. This implementation of the Follower interface depends on a "turn controller" - in essence, a Controller that determines the speed at which the robot is turning.
Methods
GenericFollower(Trajectory trajectory, Controller turnController)
Constructs a new GenericFollower. This constructor also sets the turnController's target to 0.
trajectory: TheTrajectorythe follower should follow. The follower is responsible for operating the robot such that the robot moves in a way dictated by thisTrajectory. After the trajectory has finished, the follower should also finish.turnController: A turn controller, responsible for determining turn values. This controller's target will be set to 0. The controller will receive the current distance from the target angle, in degrees, and should output a value to minimize that distance and bring it as close to 0 as possible.
getTrajectory()
Returns the Trajectory that this follower is currently following.
tick(PointXYZ current, Consumer<Translation> consumer)
"Ticks" the follower once. This method calculates the next marker point from the trajectory, determines the required speed and turn values, and then generates a relative Translation for the robot. This Translation is then passed to the provided consumer to drive the robot. The method returns true if the trajectory is completed, and false otherwise.
toString()
Returns a string representation of the GenericFollower, indicating the trajectory it is following.