TalonFX VelocityVoltage Control Question/Help

Hey all, we are using Phoenix 6 for the first time this year on a shooter wheel, geared 1:1.

In previous years with Phoenix5 it was pretty straight forward to get a wheel up to our desired speed following their closed-loop docs using a combination of kF and kP to have a really nice consistent shot.

In Phoenix 6 we seem to have a mismatched set of expectations or results based on our configuration.

Here’s our Talon configuration:

        # Perform any other configuration
        config: TalonFXConfiguration = TalonFXConfiguration()
        config.slot0.k_s = 0.15  # Measured .15 volts to overcome static friction
        config.slot0.k_v = 0.19  # Measured .19 for 1ps
        config.slot0.k_a = 0.01  # complete guess, not measured
        config.slot0.k_p = (
            0.18  # an error of 1 RPS should add almost .19 more to correct
        )
        config.slot0.k_i = 0
        config.slot0.k_d = 0

What I was expecting was with that configuration, that if we instantiate the request like this:
self._motor_output = VelocityVoltage(0, enable_foc=False, slot=0)

and then use it like this:
self._motor_output.output = 52

That polling the velocity of the motor controller we’d see a value around 52. What we see is some non-linear (appears to be non-linear) growth in the measured velocity versus the set velocity.

Some representative values:
Set point 52 = 57 rps measured
Set point 55 = 63 rps measured
Set point 65 = 85 rps measured

What are we missing in our understanding such that putting the velocity at 52 rps as the output set point results in 52?

How did you determine kV?

Phoenix Tuner and plotting the velocity with their graphing utility.

That doesn’t really answer my question. What did you do with those tools?

I set the control value in Phoenix Tuner until I got a 1 rps measured result by viewing their plot utility. So I guess the how would be guess and check until I got the result I was trying to see.

I based the config off of their closed loop docs, so I was targeting 1 rps.

However, I think re-reading their comment attached in their docs:
slot0Configs.kV = 0.12; // A velocity target of 1 rps results in 0.12 V output

I can see that anything north of 63 is going to produce 100% output (12+ volts) as the result.

Follow-on thought:

So, if it’s a multiplicative relationship then my target of 52 rps * kV = 9.88 volts of output – which actually produces a measured result of 57 rps.

That’s what I mean by non-linear I think.

1 RPS is a fairly low excitation to tune around if your setpoint is near 50, but that aside - you still haven’t described how you calculated the kV value. Can you give a formula?

Well, the answer might be SysiD, which we haven’t broached that subject yet as a team…BUT

I think tomorrow we need to go back, set the output to get to our desired RPS (52), observe the voltage and divide it by 52 (RPS). That would result in a kV that is coupled with that target RPS.

Following that methodology, and looking to the future when we want to shoot at different targets, say, Amp at a given angle, Speaker at different angles, we’re going to need to occupy the 4 PID slots with the measured kVs.

Is there a solid way to measure a kV such that a setpoint of 52 rps results in the measured 52, but a set point of 35 also results in 35? That sort of measurement could only exist if the relationship of RPS and voltage is truly linear (which could be true, but I haven’t tried to see).

Thanks for the help though, I think it’s becoming clearer what we need to do.

You need to think about whether this makes sense given your entire feedforward model. What about kS?

Try writing out the feedforward equation for steady-state (no kA term), and solve backwards to find kV.

My team tuned a Falcon 500 flywheel yesterday. After the initial kS dead area, the kV curve is a very flattened “S”. kV is low (and a bit erratic from measurement errors) at very low speeds and somewhat high at very high speeds. It was quite flat in the broad middle.

I can vouch for all of @Oblarg comments: it looks like you forgot to subtract kS from the total voltage that you measured causing some non-linearity in kV from that error especially at low speeds.

1 Like

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