Pololu describes PID behavior in the example application RotationResist for the Zumo32U4 - it looked like this:
// Calculate the motor turn speed using proportional and
// derivative PID terms. Here we are a using a proportional
// constant of 56 and a derivative constant of 1/20.
int32_t turnSpeed = -(int32_t)turnAngle / (turnAngle1 / 56)
- turnRate / 20;
I was wondering if you could do a little more to describe how PID behavior works. For example, for the Zumo robots, speed is set to +/- 400 which I think assumes a 75:1 motor gear ratio. I don’t thing there is any concern with using these max speeds with what I have - a 100:1 gear ratio, but 100:1 gear ratio may be better suited with a +/- 320 max speed setting (based on wheel rpm); however I notices that +/- 400 is just the speed ratio and could be used for all other gear ratios. Unlike your excellent work on the gyro system which only requires one set of reference variables, the motor system changes with gear ratio, so I’m looking for more insight on that.
Other info that should probably be added to the Micro Metal Gearmotor table that may be useful:
51.45 x 12 = 617.4 CPR (wheel)
75.81 x 12 = 909.72 909.7 CPR (wheel)
100.31 x 12 = 1204.44 CPR (wheel)
40/(625/60) = 3.84 inches per wheel revolution
25/(400/60) = 3.75 inches per wheel revolution
20/(320/60) = 3.75 inches per wheel revolution
3.84/617.4 = 0.0062 inches per count
3.75/ 909.72 = 0.0041 inches per count
3.75/1204.44 = 0.0031 inches per count
1/0.0062 = 161.2903 counts make an inch
1/0.0041 = 243.9024 counts make an inch
1/0.0031 = 322.5806 counts make an inch
Let me know what you think.