Hi Barry,
Excellent news, I'm glad you're moving forward!
If you're going to use the feedforward terms you need to set pid_Velocity_cmd in your program before you call the pid filter routine, in the same way that you must set pid_Error. In your particular case you'd probably just do something like
Code:
pid_Error = Setpoint - ADValue
pid_Velocity_Cmd = Setpoint
GOSUB PID
pid_Velocity_Cmd is the "input variable" for the feedforward terms. pid_Vel_FF, pid_Acc_FF and pid_LastVelocity_Cmd are "internal" variables and you should not need to worry about those.
In my own use of the filter the setpoint isn't velocity but position so I needed to have a separate input variable for the feedforward. My program then calculates the velocity based on the difference in commanded position between each concecutive loop.
I hope that makes sense, otherwise let me know and I'll try again.
/Henrik
Bookmarks