Skip to content

henrysg1/autonomous-vehicle-with-cv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Autonomous Vehicle Computer Vision System

image

This project involves the development of an autonomous vehicle capable of line following and symbol recognition using computer vision. The system is implemented using C++ and OpenCV on a Raspberry Pi, with additional control provided by Arduino microcontrollers.

Introduction

This project demonstrates the creation of a computer vision system for an autonomous vehicle. The system is capable of following lines on the ground and recognising symbols to perform various tasks. The primary components include a Raspberry Pi, a camera, and several Arduino microcontrollers.

System Overview

Hardware Overview

The hardware setup includes:

  • Raspberry Pi with a connected camera
  • Three Arduino Nanos for various controls
  • Motors and servo for vehicle movement
  • Ultrasonic sensor for distance measurement
  • Inertial Measurement Unit (IMU) for incline detection
  • Audio amplifier and speaker for audio output
  • Level shifter for voltage compatibility between Raspberry Pi and Arduinos

Software Overview

The software is implemented in C++ using OpenCV for image processing and Pi2c for communication between Raspberry Pi and Arduinos. The main tasks include:

  • Line following using color detection
  • Symbol recognition for executing specific sub-routines
  • Traffic light detection
  • Shape detection
  • Incline and distance measurement

Design and Implementation

Color Detection

image

Color detection is achieved by converting the camera image from BGR to HSV color space and filtering specific colors. This technique is used for both line following and symbol recognition.

Line Following

image

The vehicle follows a line by detecting the color of the line and adjusting the motor speeds to keep the line centered in the camera's view. The system uses HSV values to identify the line and calculates the position of the line's middle pixel to determine the vehicle's direction.

Symbol Recognition

image

The system recognizes symbols by capturing images from the camera, converting them to HSV, and comparing them to known symbol images stored in an array. Contour detection is used to identify the shape of the symbols.

Sub-system Implementation

Servo Control

image

The camera's position is controlled by a servo motor, allowing it to switch between line following and symbol recognition modes. The servo is controlled via I2C commands from the Raspberry Pi to the Arduino.

Level Shifter

image

A level shifter is used to ensure safe voltage levels between the 3.3V logic of the Raspberry Pi and the 5V logic of the Arduinos.

Audio Amplifier and Speaker

image

An audio amplifier circuit using the LM386 IC is implemented to provide audio output from the Raspberry Pi. This is used for outputting measurements and other notifications.

SAE Level of Autonomy

The system achieves SAE Level 4 autonomy, meaning it can handle most driving tasks independently but may not perform well in all conditions without human intervention.

Further Challenge Objectives

Traffic Light Detection

The system includes a function to detect green traffic lights and wait until it is safe to proceed.

Coloured Line Following

The vehicle can switch to following colored lines based on symbol detection, taking shortcuts on the track when indicated.

Shape Detection

image

The system can identify and label basic geometric shapes within the camera's view.

Incline Measurement

Using the MPU-9250 IMU, the system measures the vehicle's incline and provides audio output of the angle.

Distance Measurement

An ultrasonic sensor measures the distance to objects, and the system announces the distance using the speaker.

Conclusion

Completed Challenges

The project successfully implements a functioning computer vision system capable of following lines and recognizing symbols. Additional features include traffic light detection, shape recognition, and audio output for measurements.

Improvements

Future improvements could include more reliable symbol recognition for colored lines, audio output for shape detection, and successful communication of incline measurements to the Raspberry Pi.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages