Quote:
|
Originally Posted by Rick TYler
Yeah, but, writing PID from scratch is hard. Does anyone have some sample code I could show to our student programmers?
|
The Navigation code Kevin made for last year's robot has PID in it.
And it's pretty easy.
Code:
error = current - target
integral += error
derivative = error - prevError
output = Kp * error + Ki * integral + Kd * derivative
prevError = error
(The implementation details are left to the reader

)