SimpleFeedforward

A simple feedforward controller for velocity control.

Feedforward control predicts the motor output needed to achieve a desired motion, without waiting for error to accumulate (unlike feedback/PID control). This is typically used in combination with a feedback controller for best results.

The feedforward equation is:

output = kS * sign(velocity) + kV * velocity + kA * acceleration

Where:

  • kS compensates for static friction

  • kV compensates for back-EMF and viscous friction

  • kA compensates for inertia during acceleration

Parameters

coefficients

The SimpleFFCoefficients containing kS, kV, and kA gains.

Constructors

Link copied to clipboard
constructor(coefficients: SimpleFFCoefficients)
constructor(kS: Double, kV: Double, kA: Double = 0.0)

Constructs a SimpleFeedforward instance using individual feedforward coefficients.

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun <U : Unit<U>> calculate(state: MotionState<U>): Double

Calculates the feedforward output from a MotionState.

fun calculate(velocity: Double, acceleration: Double = 0.0): Double

Calculates the feedforward output for a desired velocity and acceleration.

Link copied to clipboard
fun maxAchievableAcceleration(maxVoltage: Double, velocity: Double): Double

Calculates the maximum achievable acceleration given voltage and velocity constraints.

Link copied to clipboard
fun maxAchievableVelocity(maxVoltage: Double, acceleration: Double): Double

Calculates the maximum achievable velocity given voltage and acceleration constraints.

Link copied to clipboard
fun minAchievableAcceleration(maxVoltage: Double, velocity: Double): Double

Calculates the minimum achievable acceleration given voltage and velocity constraints.

Link copied to clipboard
fun minAchievableVelocity(maxVoltage: Double, acceleration: Double): Double

Calculates the minimum achievable velocity given voltage and acceleration constraints.