Skip to content

A personal self-driving car project for the purpose of hands-on with OpenCV and deep learning.

License

Notifications You must be signed in to change notification settings

khanhvu207/FPT-DigitalRace2020

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FPT Digital Race 2020

The platform that I used for this personal project is from FPT Digital Race 2020 contest.

Description

1. Environment

  • The contest used Unity as a simulator.
  • ROS was used to communicate with the simulator (transfering frames, sending car speeds/steering angles between ROS nodes).
    sim

2. Lane detection (tools: C++ and OpenCV3)

  1. Receive raw images from ROS server.
  2. Convert color space from RGB to HSV.
  3. Perform image thresholding to extract the roadsides.
    img_thresholding
  4. I used Hough Line Transform to get two straight lines which almost the regression lines of the two roadsides. The reason why I did not do the normal lines regression is that Hough lines definitely go through points, where regression lines sometimes do not.
    hough.
  5. Create birdview scene for future usages.
    birdview.
  6. To suppress the shadows created by trees, I again used color thresholing and did the bitwise-OR to combine two binary images.

3. Sign detection

  1. Perform image thresholding to extract the blue color.
  2. I used the findContour to detect round shapes in the binary image. Here, we could possibly use the Hough Circle Transform to detect the sign. The Hough circle transform didn't work well for me, since from the car's perspective, signs always look like an oval shape and I had an hard time tuning those params :(. After the sign's position have been determined, just put a minimum bounding box that encloses our sign.
    sign
  3. To know whether the sign is the left sign or right sign, I splitted the box and count white pixels in each half (not so efficient, but simple!).

4. Car controlling mechanism (tools: PID controller)

  1. Set an offset point that represent your car's position (the red point).
  2. Set a green point which has the same Y-coordinate as the red point, and lays in the bisector of the two green Hough lines.
  3. Compute the relative distance between the red point and the green point.
  4. Use the above distance as a error parameter of PID controller.

Demo GIF

demo