Help with Feed Forward

My team is trying to use feed forward on our robot. We don’t know how to get the setVelocity. We are using falcons.

Here is out code:

double PIDOutput = extensionPIDController.calculate(getExtension(), desiredExtension);
double feedForwardOutput = extensionFeedForward.calculate(???);
double motorOutput = (PIDOutput + feedForwardOutput);

In the method .calculate for the feed forward, it requires desired velocity. How do we get this?

What mechanism are you controlling with this?

We trying to control the arm’s extension using feed forward.

hmm. I’m not entirely sure how you would use the feedforward for that. Normally a simple motor feedforwards are used when you need to maintain a target velocity for a mechanism. There’s an arm feedforward from WPIlib, but its based on the arm swinging up / down, so the calculation is based on the arm’s angle.

There’s definitely still a way to use a feedforward, I’m just not sure what it would be. It’ll also depend on how exactly the arm mechanism works / interacts with the rest of the robot.

You need a motion profile of some sort, or else you have no defined velocity setpoints and there is no useful feedforward that can be done.