Follow Line (v 1.0)

After analyzing different designs, the simplest model to follow and that works correctly is the following.


First, it is thresholded again with HSV, but the values ​​of the first algorithm have changed and they were used for the web. Now the color filter works in a more robust way according to the following values:

(im_HSV[:, :, 0] <= 10) & (im_HSV[:, :, 1] >= 100) & (im_HSV[:, :, 2] > 30)


It has been adopted as the center, the center of the image. However, this may vary depending on the initialization of Gazebo, so it should be impeded that the center is in the center of the first threshold with the first initialization. For ease, the center of the image has been simply taken (in columns).


After that, we have searched among the neighboring lines of row 250. Taking this reference, we start from a fixed value that will vary depending on how far it is from the center. With this we obtain the reference to which we will denote as «ref». It will serve as the braking force at the fixed speed that is applied.


The turn is dependent on speed and reference «ref». Therefore, at higher speed, there will be more amount of turn and vice versa. This is important since it is not the same to rotate at high speed than at low speed, since it would derail quickly.

This post has been updated with a video showing how it works. We see that it completes the lap with a simulation time of about 26 seconds.

First approaches

First, it has been download the image that captures the car’s camera.

Car’s camera

Then, it has been applied a HSV change filter to easy find the red line. Like image shown below:

Filtered image

At this point, we need to find two points at the image to know if the car is it at the center of the red line or not. This schema shown this first approach, it has been mark with red points two places at the image where are red line and this points has been joined whith a green line. Then, an orange line marks the distance to the center of the image.

Now, we need write an algorithm that gets this significant points and gives orders to move the car.

Diseña un sitio como este con WordPress.com
Comenzar