I’ll preface this with the hardware used:

775pro -> 100:1 versaplentary (w/ SRX mag encoder) -> 2:1 gearset moving the arm.

1 rotation (4096units) = the full range of motion of the arm (180 degrees)

This was my first time tuning a PID controller with a TalonSRX / DC motor in general.

Since 1 full rotation provides the entire range of motion, I used a relatively low accel / cruise velocity.

I will probably end up increasing it but it works for now.

200units/100ms accel; 400units/100ms cruise

I had planned on using Ziegler–Nichols method of PID tuning, but since MotionMagic creates a motion profile, I found it to be quite obvious that this would be impossible.

That being said, I raised P until there was a slight oscillation, and tuned D until it no longer oscillated and hit on the exact unit at least 95% of the time.

In this case, P turned out to be 10, and D turned out to be 210. F and I were left at 0.

With these settings, I was able to rotate from 0-4096 units and back with little to no deviation; sometimes it would miss by ± 1 unit.

Note this tuning was done with 0 load on the motor.

This brings me to my first question

- Was this a viable method of PID tuning / do these numbers seem realistic? Am I missing anything?

Since this is controlling an arm, I plan on using Arbitrary FeedForward to compensate for the force of gravity.

From my understanding, assuming the voltage applied through ArbFeedForward is added to the PID output, the PID tuning should work as if there was no load on the motor assuming the compensation is accurate.

To calculate feedforward, I was planning on finding the voltage required to hold the arm parallel to the ground, then multiplying that by the cosine of the angle of the arm & plugging it back into the feedforward calculation as the arm rotates.

- Is this how Arbitrary Feedforward (in theory) should work? Has anyone tried this and found success?

This is a sub-question of question #2:

I read that 1023 represents full voltage.

- If, for example, the voltage required to stall the arm was 1v, would my feedforward value be

(1023/12) * cos(x) ?