1 minute read

In this post I’ll explain the first approach in order to complete the first exercise of the subject “Visión Robótica” of the Computer Vision master.

The idea is to get a formula 1 to complete a circuit following a line based on visual feedback from the on-board camera. To achieve this goal, I have developed a proportional controller (P controller) which calculates the angular velocity based on the error between the current position of the car and the position at which it should be. In this case, the linear velocity has been set to 3.851 m/s.

In order to calculate the position where the car should be, which must be the center of the red line at a given height, I’ve implemented a color filter in the HSV color space. After that, I calculate the position of the center of the line at a given altitude (y=270), and compare that center to the where I want the F1 to be (x=320).

The ecuation for this P controller is:

\[u = -Kp * e +b\]

In this case, b is set to 0 and the Kp is set experimentally.

With this implementation, the car gets to complete the circuit in just 2 minutes and 13 seconds.

Here you can watch a video of the cars behavior:

Next day I’ll implement a PD controller, which will make this much more robust.