The variable decay rate is for integral, and it makes its terms shrink exponentially. setting max_rate to 0 means no max. Look at the black line for distance. Look at the blue line for rotation.
This is to test stuff for robotics. I guess I can say I know calculus b4 high school. 2 am is the best time to read calculus books. Pls tell me how to do inertia. A PID controller uses the three terms P (proportion), I (integral, sum of past errors), and D (derivative, slope of the end of the curve) to reach the desired target without overshooting. The formula used in LaTeX code is $$u\left(t\right) = K_{p} \cdot e\left(t\right) + K_{i}\cdot \int_{0}^{t} e\left(\tau\right) d\tau + K_{d}\cdot \left(\frac{de(t)}{dt}\right)$$ u(t) is the rate or speed at time t. e(t) is the error at time t.