We have used PID control successfully for the last 2 years. I have seen several threads that suggest using F and P to set velocity control for a flywheel. Wondering where a good place to start with our F value if want our NEO to run at 4200 rpm and how is that determined?

The impact F has on your system is `kF*setpoint`

, meaning it doesnâ€™t use a sensor.

Although you can technically calculate it, Iâ€™d start small and work your way up. Plot desired velocity vs actual velocity, and increase F until theyâ€™re close together. Then add P, I, and D as you need. I believe the robot characterization tool has an option for

a generic sensored system (@Oblarg?)

The CTRE Phoenix docs say the same thing. Start increasing F until the system is responding close to how you want, and then start adding P, I, D terms.

https://phoenix-documentation.readthedocs.io/en/latest/ch16_ClosedLoop.html

(while these docs are specific to CTRE devices, the theory is the same)

Flywheels are pretty easy to control, you can get a good starting point just thinking about units.

If the formula for feedforward control is K_f * setpoint = output, and given the assumptionsâ€¦

a. The speed of a DC motor is governed by the equation \omega = K_v * V, where \omega is angular velocity, V is voltage, and K_v is the speed constant of your motor

b. Your setpoint is measured in RPM

c. Your output is in volts

â€¦then we can take the feedforward formula, transform it into K_f = output / setpoint, which basically means that K_f is the amount of volts per RPM that we want to add to the motor. This is equal to 1/K_v

REV helpfully lists the K_v value of the NEO at 473, so assuming that your units are the same as this example, 1/473 = ~.002 might be a good starting value.

Correct me if Iâ€™m wrong, but I believe you put Kv on the wrong side of that equation.

Wikipedia lists it as K_v = \omega_{no-load} / V_{peak}, which is the same thing (a little more specific).

Whoops, total brain blip.

How would you plot?

If you pass your calculated velocity from your encoder to your shuffleboard, you can simply right click on it to plot. Also, if you are using Talon SRX there is a plot option in the ctre phoenix tuner. I am pretty sure Spark MAX has a similar way of plotting velocity.

Assuming you donâ€™t have a sparkmax/talonSRX/talonFX:

Look into plotting a variable with shuffleboard or smartdashboard.

Youâ€™ll need a sensor to collect the velocity data.

â€śGraph widgets for numerical dataâ€ť

https://docs.wpilib.org/en/latest/docs/software/wpilib-tools/shuffleboard/getting-started/shuffleboard-tour.html

You can also use shuffleboard to dynamically adjust a variable, so if you expose the kF/kP/kD values as variables then you can tweak them without having to re-deploy code. Just make sure to capture your work when youâ€™re done!

Yes, Phoenix Tuner and the REV SparkMax Client have similar features.

this whitepaper has some good information that my team has used to great effect

I like to think of my F value as â€śWhat would I set my motor to if I didnâ€™t have a PIDâ€ť. Thatâ€™s a decent layman way to explain it.

I read or watched somewhere â€“ possibly here? - it explained this way:

Imagine that youâ€™re riding a bicycle, and youâ€™re trying to match the speed of a car driving slowly at a constant rate. The PID is you pedalling and adjusting to keep your bike in sync with the car. Wouldnâ€™t it be nice if your bike had an electric assist that would give it a little fixed speed boost? Thatâ€™s the kF.

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