# PID constants

So I thought it would be cool to see how everyone’s PID constants compare and how that are affected by gear ratio and flywheel type so please post your Kp, Ki, Kd, gear ratio, and if you have a double or single flywheel, and your type of wheel.

PID constants are also affected by the way you calculate velocity. My code sets the encoder to zero, waits 30ms, and then reads the encoder value, and keeps that as velocity. Other teams from my school do this and then convert to RPM before calculating PID. My PID constants were around .25, .00001, and .1, and the other teams looked more like .00025, .0000001, and .00001. I use TBH now, and my gain is .15.

I use a weird combination of bang bang and TBH, and my gain is 1. Gear ratio is 36:1, single flywheel with 5in wheels.

Is your encoder on the same shaft as the motors? (I saw you said you were using turbo motors, so this is the same setup I am using… I seems to require high gain)

The encoder is geared down from the flywheel 5:1. Are you saying I loops require high gain, or you specifically require a high gain?

I see, so its separate from the main gearing. I was curious.
Well you said your loop required a gain of 1. which generally seems quite high… Of course, you use some sort of different program. Which probably throws all general stereotypes of constants out the window.
I made a mistake with my question there. Not meaning that all turbo 1:15 flywheel require high gain, but rather wondering why yours requires such high gain. Then I realized you weren’t using a normal velocity control loop.
Anyway. My gain is 0.15 on a single flywheel, to answer part of the threads question.

The gearing means that my error is at most 140 ticks, and the program only considers error if it’s less than 15.

I’m running a 1:35 6 motor 5" flywheel with a doubled up wheel. I use TBH and on my old algorithm had a gain of .012, but just reworked it to be more stable and got a gain of .00020. I run between 1500 and 2300 rpm and this gain was tuned for one oscillation on the lowest power setting giving no oscillations on max. I might try what puzzler said with hybrid bangbang and tbh, but my controller already runs at 120 until the first overshoot. Interesting concept though.

My fire rate is still a pitiful ~1.2 secs/ball, but the bang bang/tbh improved it from 2.5 secs/ball.