RoboticsClubAtUCDavis / micromouse

4 stars 3 forks source link

Pid #87

Closed blhough closed 7 years ago

blhough commented 7 years ago

closes #66

Adds PID controller class

The reason for having the getDelta functor object is we might find it better to use delta distance in some instances rather than just delta time. Delta distance is the product of both time and speed so hopefully that would make the error correction more stable at varying speeds. For now only deltaTime is implemented.

blhough commented 7 years ago

I just realized that having all the PIDController objects share the same DeltaTime object is not a very good idea because operator() aka getDelta is not side effect free like I was thinking. The order you called PIDController::getCorrection on each object would make a huge difference. I think the functor object was a bit overkill too. To address this I will make getCorrection take the delta units as an argument instead and it will be the caller's responsibility to supply the delta.