Follow Line Formula 1

Follow line

In this practice we will use PIDs in order to create a program which will allow us to drive a formula 1 car efficiently following a line.


What are we going to use?

1) A color filter for getting the line position
 
   We are going to use the opencv library to get the position of the center pixel of the line but, we are not going to use all the line, we will just use the top part of the line in order to get a pixel which will give us more info for the turning and speeds PIDs

2) Two PIDs

-Linear_pid: This pid is jut going to give us a proportional output linear speed that we will subtract to out maximum linear speed using the center pixel of the color filter that we defined before.

 -Angular_pid: This pid is going to give us an angular speed but this time we well use the kp, ki and kd components

3) A recovery condition

An extra condition that basically will search the line turning to the last direction at it was and will reduce our speed to the minimum that we want if we lost the line.


What is the result?

Better that I expected.

In order to compare my solution with a real example, we will use the Montmelo circuit.

The fastest lap in this circuit is 1:18.149 completed by Max Verstappen in 2021, but, what time we got using my program?


1:28 !!!!!! just ten seconds under the fastest lap. 


Its true that is could be more stable. I will also give you a "safer implementation" which have the same logic but just use slower speeds.

2:08 !!! not bad for a safe implementation of the code.





Comentarios

Entradas populares de este blog

Autonomous drone for search and rescue mission

Localized Vacuum Cleaner

OMPL Amazon warehouse