Skip to content
Dimitris Platis edited this page Jan 19, 2016 · 26 revisions

Contents


How does the cruise control work?

In cruise control mode, the vehicle attempts to move at a stable speed, regardless of various external disturbances. External disturbances could include the floor's friction, the weight of the car, the voltage battery drops etc. It is essential, if the user wants to make sure that the car will move at a specific speed, regardless of those factors. The algorithm utilized in order to achieve that is called PID controller. Nevertheless, the fact that the car attempts to maintain its speed, does not necessarily mean that it actually accomplishes that and particularly in an efficient manner.

For maximum performance, a user should optimize their PID controller, using the Kp, Ki and Kd variables as arguments in the enableCruiseControl method, as well as the frequency that the controller will be accessed.

How can I optimize the PID controller algorithm of the cruise control?

To put it very simply, you optimize or tune a PID controller by changing the Kp, Ki and Kd values and observing its behavior/output. If the oscillations in the output in its effort to reach the desired outcome are nominal and if the controller reaches the desired state fast enough, then you have a well tuned PID controller.

There are many ways to do that, but for reference you can have a look at the Ziegler-Nichols method. Alternatively, you can have look at some more empirical and practical approaches here: What are good strategies for tuning PID loops?

How do I calibrate the gyroscope?

The gyroscope, even at its idle state (when it is being still), produces an output, which usually varies between a range. This noise can affect the stability of our readings, if not taken into consideration during the calculations from which we derive the angular displacement. Therefore, we need to define an offset (as well as a threshold) in order to filter out this invalid measurements.

How do I calibrate the speed encoders?

How do I use an existing class with a less complicated name?

How can I add a new sensor in the library?

Where can I buy an already assembled shield and car?

Why does the <X> sensor not work?

How can I use this library with a servo motor and an ESC?

Clone this wiki locally