The platform that I used for this personal project is from FPT Digital Race 2020 contest.
- 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).
- Receive raw images from ROS server.
- Convert color space from RGB to HSV.
- Perform image thresholding to extract the roadsides.
- 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.
. - Create birdview scene for future usages.
. - To suppress the shadows created by trees, I again used color thresholing and did the bitwise-OR to combine two binary images.
- Perform image thresholding to extract the blue color.
- 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.
- 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!).
- Set an offset point that represent your car's position (the red point).
- 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.
- Compute the relative distance between the red point and the green point.
- Use the above distance as a error parameter of PID controller.