I am doing a project that requires that I implement a cruise control system on an RC car using a GPS for feedback.
I have implemented PID controllers before, but this is a little bit new to me because instead of generating a correction delta like -8 or +6, the controller has to output a value from 0 to 100, 100 being as fast as the car can go, and 0 being a dead stop.
At first, I attempted to use a solution where I kept a running tally off the current throttle and I simply added the mv from the PID controller to it. This became a big issue because the "currentThrottle" variable essentially became a second integrator and would frequently windup when the car didn't respond fast enough.
One limitation of this project is that I cannot modify the algorithm used for generating the PID correction delta, but I can do whatever I want with the setpoint and mv before/after the PID correction is generated like so:
Where 8 is the setpoint (8kts) and rmc.Speed is the current speed. This will return the correction delta calculated from the PidConfig variables (Kp, Ki, Kd, integrator windup control, etc) when I constructed the PidController object.