Skip to content

Introduction

In this exercise you will set up a PID controller to implement vehicle cruise control. The vehicle in question is the small red one shown in Figure 1 - ie it is a simulation implemented in Processing. In the simulation, the vehicle starts out with certain characteristics including an initial forward velocity. The inclination of the road varies randomly, and when the vehicle is forced to travel uphill, it gradually slows down under the force of gravity until it starts to slip backwards. In a real vehicle, the solution is to accelerate gently to counteract the increased inclination, and that is also the approach that will be taken here.

Cruise control Figure 1. Cruise control

Your goal is to maintain a steady speed of 5. This will compensate for the rate at which the landscape pans to the left, and the vehicle should appear to stay at the same x coordinate on the screen. There will probably be some adjustment as the inclination of the road changes. You should minimise any overshoots, undershoots and oscillations by tuning your controller.

A quick note about forces and units

The physics model used in this simulation is reasonably complete including the vehicle's motive force, gravity and drag; however the 'speed' of the vehicle does not necessarily correspond to any real-world measure. Please feel free to assume any units that help you visualise the situation - eg miles per hour, kilometres per hour, furlongs per minute, etc.