Drone Follow Road


In recent years drones have been usen fo multiple purpouses in urban and rural roads such as:
  1. Real-Time Monitoring: drones can fly over congested areas to transmit live images so and detect traffic jams, accidents, or blockages, reacting more quickly than fixed cameras.
  2.  Emergency Management: in the event of an accident, drones can arrive first on the scene, assess the situation, and help coordinate emergency services more effectively.
  3.  Traffic Violation Control: drones can be equipped with high-resolution cameras to identify the plates of vehicles committing violations like making illegal turns or speeding.
  4.  Infrastructure Inspection: they can also be used to inspect highways, bridges, or tunnels without interrupting traffic, helping to detect damage or maintenance needs.
In this exercise we have to program a drone to follow a road, to simulate one of the many applications mentioned before.

The drone is a quadcopter with two cameras, one in the front and other on the ventral part, similar to the one in the next image:

To detect the road we will use the images of both cameras. To detect the center of the lines painted on the road observed by the frontal camera, firstly we will applied a color filter to remove all the green parts of the image:



Then, we used the Canny edges detection along with a mask using the OpenCV function "fillPoly()" to only detect the lines on the bottom part of the image:

Finally, we get the lines from the edges using the Hough Line Transform:



For the ventral image we used the same transformations, but in this case we detected the lines for the whole image instead of only using the lower zone.

We use the center of the image as reference of where the center of the road should be, by calculating the deviation between the estimated center and the real one, we can feed a PID controller to modify the yaw rate in order to stay on the center of the road.

For the control of the drone we used a controller with non-zero values for the three componets (Proportional-Integral-Derivative). This controller was fine-tuned by trial and error. 


In the next videos we can see two executions of the application, in both cases we can see in the GUI images the reference (blue) and the real position of the road lines (red) 

-Clockwise:

-Reverse:










Comments

Popular posts from this blog

Local Navigation with VFF

Autoparking

Global Navigation with GPP