High Frequency C++ control loops & Feed Forward

Hey!

We are in the process of trying adding feed forward to our control loop for the FIRST time this year and would ask for your kind assistance.

How do you normally calculate motion profile for feed forward? How do you calibrate Kf? What about using feed forward with the TalonSRX?

Currently interesting cases are: Fly wheel control, chassis simple turn / drive distance.

Also, how can we run our PIDF loops at higher frequency then base command based robot frequency? (we program in c++ and would appreciate examples if relevant)

Many thanks and good luck to all!

This](Motion Profile - Filter Method - Google Sheets) works quite well.

How do you calibrate Kf?

Kf is there to convert velocity to motor command. You can derive it from first principles, or you can measure it.

What about using feed forward with the TalonSRX?

Read paragraph 12.4 of the Talon SRX Software Reference Manual, available for download on the manufacturer’s website.

How about motion profiles for velocity closed loop? I saw that I can calibraet Kf for the talonSRX but I couldn’t understand how does the constant translate to output.

Do you know how can I run high frequency PID loops in c++?

Thanks!

Why do you think you need motion profile to control the speed of your flywheel? Most teams using the SRX built-in PIDF for that application just use simple setpoint commands. If you are concerned about high current draw at initial spinup, just use the voltage ramping or closed-loop rate control of the SRX PIDF.

Do you know how can I run high frequency PID loops in c++?

How high is “high frequency” in this context? The PIDF in the SRX runs at 1KHz.

…drive distance…

You can use motion profile for that. Use v(t) from the profile as your feedforward input, and x(t) as your setpoint input. i.e. closed-loop position control with velocity feedforward.