profile picture

Chathura Widanage

I am an integrated computer science and engineering undergraduate at university of Moratuwa. I love coding since my childhood.I am curious about the cutting edge technologies that are related to the software engineering. Currently I am acting as a freelance developer with the intention of widening my knowledge and experience.

Multi model Self Driving autonomous car

img

Designed and developed a car that has the ability to avoid the obstacles and travel on the road by detecting the lanes. Lane detection comprises of three different algorithms that suite three different road conditions.

The self driving car has three sub systems.

  1. lane detection
  2. Obstacles detection
  3. Motor Driving & Speed controlling system

Lane detection system

In this project my task was to develop lane detection algorithms using openCV. Here I used javaCV, the java wrapper for the opencv library. To make the process easier, first I developed a java swing based interface, so that I can test the algorithms with different parameters easily. Though we had to demo this project using a robot rower, inside a building, I developed three algorithms to suite three different road conditions.

First algorithms was developed to suite high ways.

high_ways

First the image taken from the camera was scanned for edges using Canny edge detection and then Hough transform was used to find the lines that can be formed with a pre set minimum length. Then the lines were filed so that there angle(w.r.t origin) is between 30 degrees and 150 degrees.

The next step was to find the intersecting point of each line with acute angle with each line with an obtuse angle of inclination. Those points were then averaged to get a point that roughly agrees all the points. Let;s say this point as A

The final step was to determine whether point A is deviated from the center(Center of the captured image). If the point is deviated to the left from the center, then signal was sent to the driving sub system to turn the vehicle to the right. Similarly if point A is deviated to the right from the center, then the signal was sent to driving sub system to turn the vehicle left. Along with the direction, a magnitude was also sent to control the speed of the vehicle and that parameter depends on the deviation.


The second algorithms was for noisy roads

After developing the first algorithm, when I tried to apply it in a noisy road (A road where lines are not very much clear or a road where lots of vehicles are parked on either side.) it didn't work as I expected. The major problem was detecting the shiny edges of the vehicles as the lines.

As a solution for this, I completely altered the algorithm. First I applied gaussian blur filter to make the noises spread. Then the center of gravity(COG) of the noises were calculated with respect to the origin.

The next step was to determine the deviation of the COG from the center. If COG was in the left side that means there high noise in the left. That means road runs in the right side(road is lesser noisy). So vehicle should turn to right. Similarly if COG was in the right side, the vehicle should turn left.

How ever this algorithms was not reliable as the previous one. But this one was sufficient to detect the road inside our university.


The third algorithms was to detect indoor purposely made roads.

indoor

Here there was no any of the problems that I had to solve in above two algorithms. The lanes were always detectable without any break.

First noise of the image was reduced by applying gaussian blur filter. Then image was converted to binary by adjusting the threshold value such that it suits the indoor lighting conditions. (such that it highlights lanes without noise).

Assuming car is centered in lanes initially, a scan was done from center to either sides of the image till a high intesity pixel is detected. If high intensity pixels are detected in both sides that row of pixels are considered as accepted.(will consider for lane detection) Then the center of these two pixels are found and recorded. (stored in an array). Then for the next row(rows are iterating from top to bottom) previous center was considered as the center.

Finally curve fitting was done (Using Apache Math) with above points (centers) to determine the lane and direction.

This algorithm was the most accurate and reliable one among the three algorithms


Obstacle Detection System

For obstacle detection, we used an array of eight sonar sensors. These sonar sensors were continously scanned by an arduino mega and sent them to Driving sub system, which is powered by a rasberry Pi. Rasberry pi analyzes the values sent by the arduino to determine the presence of obstacles. (If shorter length is detected that can be a obstacle). To reduce the noise and also to reduce to unreliability averaging techniques were also used for the sonar readings. If driving sub system determines some point as an obstacle, it completely neglect the data from the vision system and stops the vehicle immediately. (Or slows down depending on the severity).


Driving sub system

As mentioned above driving system which is powered by a rasberry Pi, runs a node server to accept the inputs and feedback from the vision sub system Depending on the feedback taken from vision sub system and obstacle detecion system, this activates the motor controllers to drive the vehicle.


This is the best team project I have ever done here are the most awesome team players in the world :)

team

Me, Lasantha Ekanayake, Yasiru Kassapa, Buddhika Jayawardhane & Mohommad Mursith

^