3
\$\begingroup\$

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:

(int)cruiseControl.CalculateCorrection(8, rmc.Speed);

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.

Any ideas?

\$\endgroup\$
  • \$\begingroup\$ Couldn't you limit currentThrottle and/or use a negative Kd to reduce overshoot? \$\endgroup\$ – AndreKR Feb 12 '11 at 0:07
  • \$\begingroup\$ It's a cruise control for a cruise missile. A car with such control will crush on first traffic light. \$\endgroup\$ – Gregory Kornblum Apr 15 '16 at 16:47
1
\$\begingroup\$

...would frequently windup when the car didn't respond fast enough.

Sounds like your loop gains are outta wack (technically speaking). PID loops are bound by the frequency response of the system they are driving. I would think the throttle response is violently faster than the GPS velocity information...making high frequency hunting a given.

Start with a small Kp and all other loop gains at zero. Work Kp up until you get a response that is slow and smooth...so you are following an offset of the curve of the set-point. Only when you have something "under-damped" can you start bringing gains up and closing the error.

If the GPS is really slow, some interpolation of the velocity data between updates will allow the loop rate to be increased. A rate limit loop around the output would also help.

A PID loop is a model of a system....the system you have....not the system you want :)

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.