core / com.acmerobotics.roadrunner.followers / TrajectoryFollower

TrajectoryFollower

abstract class TrajectoryFollower (source)

Generic Trajectory follower for time-based pose reference tracking.

Parameters

admissibleError - admissible/satisfactory pose error at the end of each move

timeout - max time to wait for the error to be admissible

clock - clock

Constructors

<init>

Generic Trajectory follower for time-based pose reference tracking.

TrajectoryFollower(admissibleError: Pose2d = Pose2d(), timeout: Double = 0.0, clock: NanoClock = NanoClock.system())

Properties

clock

clock

val clock: NanoClock

lastError

Robot pose error computed in the last update call.

abstract var lastError: Pose2d

trajectory

Trajectory being followed if isFollowing is true.

lateinit var trajectory: Trajectory

Functions

elapsedTime

Returns the elapsed time since the last followTrajectory call.

fun elapsedTime(): Double

followTrajectory

Follow the given trajectory.

open fun followTrajectory(trajectory: Trajectory): Unit

internalUpdate

abstract fun internalUpdate(currentPose: Pose2d, currentRobotVel: Pose2d?): DriveSignal

isFollowing

Returns true if the current trajectory is currently executing.

fun isFollowing(): Boolean

update

Run a single iteration of the trajectory follower.

fun update(currentPose: Pose2d, currentRobotVel: Pose2d? = null): DriveSignal

Inheritors

HolonomicPIDVAFollower

Traditional PID controller with feedforward velocity and acceleration components to follow a trajectory. More specifically, the feedback is applied to the components of the robot's pose (x position, y position, and heading) to determine the velocity correction. The feedforward components are instead applied at the wheel level.

class HolonomicPIDVAFollower : TrajectoryFollower

RamseteFollower

Time-varying, non-linear feedback controller for nonholonomic drives. See equation 5.12 of Ramsete01.pdf.

class RamseteFollower : TrajectoryFollower

TankPIDVAFollower

Traditional PID controller with feedforward velocity and acceleration components to follow a trajectory. More specifically, one feedback loop controls the path displacement (that is, x in the robot reference frame), and another feedback loop to minimize cross track (lateral) error via heading correction (overall, very similar to HolonomicPIDVAFollower except adjusted for the nonholonomic constraint). Feedforward is applied at the wheel level.

class TankPIDVAFollower : TrajectoryFollower