System Identification and SimpleMotorFeedforward: When is acceleration used?

Hi all!

I’ve been trying to wrap my head around system identification and the SimpleMotorFeedforward controller. I’m looking specifically at the documentation at Introduction to System Identification — FIRST Robotics Competition documentation and the API of the SimpleMotorFeedforward at Feedforward Control in WPILib — FIRST Robotics Competition documentation

So I understand that system identification will give me coefficients for friction, velocity response, and acceleration response, and that I can have the controller give me an output voltage when i use calculate.

In testing, what is surprising to me is that I can calculate with a nonzero velocity but zero acceleration. That works (and the math says it should work, i.e. a zero acceleration still gives me an output that’s a function of Ks and Kv) and, if I run a flywheel with the controller, it seeks to the desired RPM pretty quickly. So when would I ever make use of a nonzero acceleration? Is the idea that if I wanted the motor to have the behavior that it was instantaneously at velocity V and acceleration A, I should apply the voltage I’d get from m_controller.calculate(desiredInstaneousv, desiredInstantaneousA)?

(And, more broadly, when I’m controlling the robot, I generally care about reaching a desired target velocity as quickly as it can be reached. In what circumstances would I want to specify a desired acceleration also?)

An acceleration feedforward would be needed/useful if you wanted to track a moving reference velocity (think drivetrains).

1 Like

I think I’m starting to get it. If I don’t specify a target acceleration in that context, I’d be generally lagging getting my velocity where I want it to be when I need it to be there. For a flywheel, that’s a bit less important (or, more specifically, setting to target velocity, 0 acceleration is what I want; I want my steady state to be “holding velocity at target with no acceleration”).

For a drivetrain, where would one get the current acceleration? I’ve tried running a path-follower by stringing together steps using trapezoid profiles, but the trapezoid tracks desired position and velocity; it doesn’t output a desired acceleration. Looks like if one sets up a Trajectory the resulting points have accelerations though.

1 Like

Compute it from the change in velocity setpoints, or use the calculate overload that takes a current velocity, prev velocity, and timestep instead.

2 Likes

Ah, okay! Now I understand why that overload has so much more code in it.

Thank you for your help!

1 Like

Somewhat related question: why does that overload have so much more in it that the (velocity, acceleration) one? Could acceleration not be calculated from two velocities and a dt without involving the linear plant libraries?

It does a more accurate calculation that accounts for the fact that the time-evolution of the velocity is exponential.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.