core / com.acmerobotics.roadrunner.followers / TankPIDVAFollower

TankPIDVAFollower

class TankPIDVAFollower : TrajectoryFollower

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 MecanumPIDVAFollower except adjusted for the nonholonomic constraint). Feedforward is applied at the wheel level.

Parameters

drive - tank drive instance

displacementCoeffs - PID coefficients for the robot axial (x) controller

crossTrackCoeffs - PID coefficients for the robot heading controller based on cross track error

kV - feedforward velocity gain

kA - feedforward acceleration gain

kStatic - signed, additive feedforward constant (used to overcome static friction)

clock - clock

Constructors

<init>

TankPIDVAFollower(drive: TankDrive, displacementCoeffs: PIDCoefficients, crossTrackCoeffs: PIDCoefficients, kV: Double, kA: Double, kStatic: Double, clock: NanoClock = NanoClock.system())

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 MecanumPIDVAFollower except adjusted for the nonholonomic constraint). Feedforward is applied at the wheel level.

Properties

lastError

var lastError: Pose2d

Robot pose error computed in the last update call.

Inherited Properties

clock

val clock: NanoClock

clock

trajectory

var trajectory: Trajectory

Functions

update

fun update(currentPose: Pose2d): Unit

Run a single iteration of the trajectory follower.

Inherited Functions

elapsedTime

fun elapsedTime(): Double

Returns the elapsed time since the last followTrajectory calls.

followTrajectory

fun followTrajectory(trajectory: Trajectory): Unit

Follow the given trajectory.

isFollowing

fun isFollowing(): Boolean

Returns true if the current trajectory has finished executing.