Falcon Encoder Returning 0 in Code

Hi all,

We’re having an extremely weird issue…I followed all documentation, and our encoders are returning a good value in PhoenixTuner, but when I cout leftMaster.GetSelectedSensorPosition(0), it reads 0 no matter what (even though there’s a good value in PhoenixTuner for PID ID 0).

Here is our motor initialization:
WPI_TalonFX leftMaster(11);
leftMaster.ConfigSelectedFeedbackSensor(FeedbackDevice::IntegratedSensor, 0, 30);
leftMaster.SetSensorPhase(true);
leftMaster.SetInverted(true);
leftMaster.Config_kF(0, 0.048927863, 30);
leftMaster.Config_kP(0, kP, 30);

Any ideas?

I wouldn’t expect this to cause the sensor to read 0, but the integrated sensor should never be out of phase with the motor…

3 Likes

I don’t know what would cause this to happen, but one thing to try is to call ConfigFactoryDefault() when you initialize the motor, to make sure that you don’t have some other settings that interferes with what you are setting in code.

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