Hello, I’m sure this question has been asked a million times before but I can’t seem to find the answer I need in search. I’m trying to use the Talon SRX’s builtin PID capabilities to control a motor’s velocity, but the encoder value I’m getting is in the opposite direction from what I need it to be. I read you can fix this by switching the Quad A and Quad B pins, but is there a way to reverse the direction in code? I tried passing in negative P, I, and D constants, but config_kP doesn’t allow me to pass in a negative value it seems. There also doesn’t seem to be a way to reverse the direction in the Phoenix Tuner interface either. Does anyone have a solution, or is this something I can only fix electrically?
One of our documentation sections covers using sensors with Talon SRX, and there’s a step that goes over sensor phase and how to adjust it:
Start from the top and work through all of the steps.
If your problem is that the encoder is sending negative values even though you are setting the motor to a positive value you need to use the method
You need to set it to true if the encoder is negative when the motor output is positive.