The Raspberry Pi camera was used in conjunction with the other sensors for the car. Specifically, the camera’s intended use was to keep the car straight on the path and avoid driving into the grass. In order to accomplish this, the camera took an image and found the center moment of the grass. This was done using a mask – which will take the values found within the assigned hsv threshold, and turn those specific pixels white and the remaining pixels black. This helps to isolate certain colors within an image. The figure below shows a picture taken on the path as the car was veering left.
The mask of the image can be found in the next figure –supporting the idea that the center of the grass would be found to the left.
Assuming that the camera’s position was at the center bottom of the image, we subtracted the x coordinate of the moment from the origin and called this variable error. When error exceeded a certain positive or negative threshold, we would increment the steering angle accordingly.