Hoping someone could help with this...
Using CTRE math in the `Speed Closed Loop.lvproj` to calculate the F value of a Armabot RS7 encoder with 12CPR on a 775pro, we are having an issue with the produced F value being too small to run the motor at the desired value.
CTRE Code.
Code:
VelocityNativeUnits = Change In Sensor / 100mS
also
VelocityNativeUnits = RPM / 600 * SensorUnitsPerRotation
Fgain = 100% X 1023 / VelocityNativeUnits ,
where VelocityNativeUnits is measured at 100% throttle
Mag Encoder has 4096 units per rotation.
Example: VelocityRPM is 10198 at 100% throttle
=> VelocityNativeUnits = (10198 / 600 * 4096) = 69618
=> Fgain = (1023 / 69618) = 0.01469
We are setting the CPR using the Talon SRX API VI. And multiply the CPR by 4 to get the SensorUnitsPerRotation.
Since the CPR is being set the `Sensor Velocity` is returned as RPM. So to get the VelocityNativeUnits we use the second equation.
Running the motor in %vbus at 10% we get a VelocityNativeUnit of 31 so we use the equation Fgain = (1023 * 0.1) / 31 = 3.3. Trying to run this Speed mode this applies a throttle of 1%.
Am I doing something obviously wrong?