Skip to content

Feedforward Elements

A feedforward element is any type of open-loop (feedforward) control.

To add a feedforward element, call the feedforward function in a control system builder.

kotlin
controlSystem {
    feedforward(/* feedforward element */)
}

Basic Feedforward

A basic feedforward is a feedforward with velocity, acceleration, and static components. Pass either the three gains or a BasicFeedforwardParameters object.

kotlin
controlSystem {
    basicFF(v, a, s)
}

Elevator Feedforward

An elevator feedforward is a feedforward with velocity, acceleration, static, and constant gravity components. Pass either the four gains or a GravityFeedforwardParameters object.

kotlin
controlSystem {
    elevatorFF(g, v, a, s)
}

Arm Feedforward

An arm feedforward is a feedforward with velocity, acceleration, static, and cosine gravity components. Pass either the four gains or a GravityFeedforwardParameters object.

IMPORTANT

Your position error must be in radians. To do this, use a custom filter. You can see how to do this on the arms example page.

kotlin
controlSystem {
    armFF(g, v, a, s)
}

Custom Feedforward Elements

To create a custom feedforward element, implement the FeedforwardElement interface and pass it to the feedforward function in a control system builder. For example:

kotlin
class FullPowerFeedforward : FeedforwardElement {
    override fun calculate(reference: KineticState): Double {
        return 1.0
    }
}

controlSystem {
    feedforward(FullPowerFeedforward())
}