|
Re: Using encoder with talon SRX
Hey riftware,
The code looks right, assuming the sensor and motor both move in the positive direction.
For tweaking gains (and general diagnostics) you're best bet is to look at the Self-Test results (and the gain values that are under the self-test results). That displays your motor-output, the ClosedLoopErr, and sensor pos/vel.
This will tell you how much error the closed-loop sees between the target and sensor. Most likely your gains just need tweaking.
ClosedLoopErr is what is multiplied by Kp, and is equal to your target - current sensor position (or velocity if that's selected). Since you are using quad encoder, then there is 4XCPR units per rotation where CPR=countsPerRotation. Talon is always in 4X mode.
Integral accum sums closedLoopErr every 1ms.
dErr is the change in ClosedLoopErr per 1ms.
See section 2.4 in Talon SRX Software Reference Manual for how to get the self-test results.
|