# How do I tune kF for an integrated feedforward PID controller like the TalonFX?

Correct if I am wrong here as it says on the specs it is just PID, but there is this command I see in the talonFX API which seems to let me set a kF constant. I saw this post about tuning it Control Modes Configuration for TalonFX and Falcon500 - #3 by dawonn
but they just gave me this magical formula and I am worried that it might vary a bit per falcon500. Also, does tuning the kF first using the equation effect tuning the PID constants using the Ziegler Nichols method?

The `kF` term of the onboard Talon feedforward corresponds to the `kV` term of the WPILib feedforward classes, but in funky units. You can estimate it with ReCalc, or measure it directly with SysId.

The presence of a feedforward does not fundamentally change the tuning procedure, but it will probably make it a lot easier to find an acceptable set of feedback gains.

So it will accelerate after 1023 seconds!?!?!?!

I’m not sure what you mean by this?

To be more precise the “magical formula” was to measure the velocity reading at a given velocity then taking a self test snapshot, so if I got a motor output of 73.13% at 15000u/100ms, kF is apparently `(0.7313 * 1023)/15000.0`. But if it says that kV is volts * seconds / distance, doesn’t that imply that it would take 1023 seconds for the encoders to reach there?

As I said, the `kF` term is in funky units. You’ll have to do some dimensional analysis.

What is dimensional analysis? I’ve never used SysId before

There are multiple ways to measure all of the physical quantities involved in these systems. Different controllers have different standard units of measure, and you have to be able to convert between them. WolframAlpha can be really helpful here.

Per the CTRE docs, the Talon `kF` gain is in units of `talon outputs * deciseconds / encoder ticks`, where (assuming you have voltage compensation enabled and the nominal battery voltage is set to 12 volts) `1 talon output = 12/1023 volts`.

what is efficiency and shooter ratio? its two falcons with one on each side with one of them inverted and one following the other. recalc seems easier and what exactly is 1 talon output?

Please read the post thoroughly before responding; I told you exactly what a `talon output` is at the bottom.

If you don’t know enough mechanical design to fill out the fields in ReCalc, you might want to find a mentor on your team to help you.

So does kF have to be exactly at the velocity? Or do you put it like in a range like it will vary from 60% to 80% you calculate for 70%?

`kF` (more accurately, `kV`) depends on the dynamics of your system, not your setpoint. It is a description of the behavior of the motor (technically, it’s a combination of a back-EMF term and a friction term).

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