1. Trang chủ
  2. » Luận Văn - Báo Cáo

vehicle automatic control system autonomous vehicle driven by image processing in adruino and python programming

21 4 1

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

HO CHI MINH CITY UNIVERSITY OF TE CHNOLOGY AND EDUCATION FACULTY FOR HIGH QUALITY TRAININGVEHICLE AUTOMATIC CONTROL SYSTEMAUTONOMOUS VEHICLE DRIVEN BY IMAGE PROCESSING IN ADRUINO AND PYT

Trang 1

HO CHI MINH CITY UNIVERSITY OF TE CHNOLOGY AND EDUCATION FACULTY FOR HIGH QUALITY TRAINING

VEHICLE AUTOMATIC CONTROL SYSTEM

AUTONOMOUS VEHICLE DRIVEN BY IMAGE PROCESSING IN ADRUINO AND PYTHON PROGRAMMING

LE MINH NHAT 19144056

VU TRAN QUANG DUY 19145169

NGUYEN LAM TRUONG SON 19145175

HO DUONG DUY ANH 19145164

Major: AUTOMOTIVE ENGINEERING TECHNOLOGY LECTURER: LE THANH PHUC, Ph.D

Ho Chi Minh City, May 2022

Trang 2

THE SOCIALIST REPUBLIC OF VIETNAM Independence – Freedom– Happiness

-Ho Chi Minh City, May 2022 COURSE PROJECT ASSIGNMENT

Major: Automotive engineering Class: 19145CLA3,4

Date of assignment:

_ Date of submission: _ 1 Project title: _

2 Initial materials provided by the advisor:

3 Content of the project:

4 Final product:

CHAIR OF THE PROGRAM

(Sign with full name) (Sign with full name)ADVISOR

Trang 4

LIST OF ACRONYMS

Trang 5

LIST OF FIGURES Figure 1 The normal coordinate.

Figure 2 The Hough Space Figure 3 The structure of cv2.line[4] Figure 4 Image through Canny Figure 5 The structure of cv2.Canny[5] Figure 6 Component of model [6] Figure 7 Arduino Vehicle Mainboard [7]

Figure 15 Import library codes Figure 16 Color conversion codes Figure 17 ROI codes

Figure 18 display lines code Figure 19 Call “def-name” code Figure 20 Declare to Arduino board Figure 21 Set pins to output Figure 22 Setting for car go straight Figure 23 Setting for car turn right Figure 24 Setting for car turn left

Trang 6

LIST OF TABLES Table 1 UNO Adruino Specifications[8]

Table 2 L-298N specification[10]

Trang 7

During driving, people use their optical vision to control the vehicle The line acts as a projection continuum for the vehicle One of the prerequisites for an automated car is the development of an Auto Detection system Computer vision is a technology that can allow cars to understand their surroundings It is a branch of artificial intelligence that allows software to capture the content of images and videos Modern computer vision has come a long way thanks to advances in deep learning, allowing it to recognize different objects in images by examining and comparing millions of examples and cleaning up accurate live patterns define each object.

Although effective specifically for these types of tasks, deep learning must have limited importance and can fail in unpredictable ways This means that a drive less vehicle could load onto a truck during the day or worse, accidentally hit a rider Currently, tablets used in autonomous vehicles are also vulnerable to adversaries, by manipulating the AI's channel headers to make it error.

Using computer vision techniques in Python, we will identify road lane lines in which autonomous cars must run This will be a critical part of autonomous cars, as the self-driving cars should not cross it’s lane and should not go in opposite lane to avoid accidents.

Trang 8

1 INTRODUCTION 1.1 Self-driving car

A self-driving vehicle is a sort of vehicle that needn't bother with an individual to work it It utilizes progressed tactile innovation like Lidar, Sonar, GPS, radar, or inertial estimations to distinguish natural changes and adjust to re-establish safe speed or distance.

The most important system in an autonomous vehicle is the lane-keeping assist system.

1.2 Lane keeping assistance

Lane-keeping Assistance is a type of driver assistance system that provides the driver with lane-keeping and lane-keeping warning features when the vehicle begins to leave the assigned lane LAS recognizes lane markers using the windshield camera

Image processing is a method to perform some operations on an image, in order to get an enhanced image or to extract some useful information from it It is a type of signal processing in which input is an image and output may be image or characteristics/features associated with that image Nowadays, image processing is among rapidly growing technologies It forms core research area within engineering and computer science disciplines too.

Image processing basically includes the following three steps: Importing the image via image acquisition tools;

Analysing and manipulating the image;

Output in which result can be altered image or report that is based on image analysis 2 LITERATURE REVIEW

2.1 Adruino

Arduino is an open-source electronics platform based on easy-to-use hardware and software.[1] It can be used for controlling the models Moreover, this software can connect and process through many software, like OpenCV with many languages programming 2.2 Python, OpenCV

Python is a language programming likes C,C++ or C#,… Its help the users have the new language to run the programme, writting the game, websites or something else Besides, Python can receive the signal and send process to boards, such as: Arduino board,… Especially, with the proliferation of the internet, python help coders can write the new programme more and more easier than the past.

OpenCV is a tool that help the user can communicate between Python and Arduino From that, the users can easily code and put the new commands for Arduino to experiment 2.3 The Hough Transform

- This state detect lane or lines follow Hough Transform After using this command, we need to transform from normal lines with normal coordinate lines from y=mx+b to the new coordinate axes

1

Trang 9

Figure 1 The normal coordinate.

Figure 2 The Hough Space.

2

Trang 10

Figure 3 The structure of cv2.line[4] 2.4 Canny

Canny() Function in OpenCV is used to detect the edges in an image From the image we have, through Canny, the image will show the special lines and changes it more white

Figure 4 Image through Canny.

3

Trang 11

Figure 5 The structure of cv2.Canny[5]

3 MODELING 3.1 Hardware

Figure 6 Component of model [6]

In order to make a model car for this project, we use a chassis which is made of plastic and specific for study.

3.1.1 Adruino UNO

The Arduino UNO is a micro-processing board based on the ATmega328P It has 14 digital input/output pins, six analog inputs, a 16 MHz ceramic resonator, a USB port, a power connection, an ICSP header, and a reset button.

4

Trang 12

Figure 7 Arduino Vehicle Mainboard [7] The Arduino UNO's technical specs:

Table 1 UNO Adruino Specifications[8]

5

Trang 13

3.1.2 L-298N

Figure 8 L-298N [9]

The L298N Motor Driver Module is a high-performance motor driver for DC and Stepper Motors An L298 motor driver IC and a 78M05 5V regulator make up this module Up to four DC motors can be controlled by the L298N Module, or two DC motors with directional and speed control.

L298N Module specs:

Table 2 L-298N specification[10]

6

Trang 14

3.1.3 Motors: 3V-9V geared motor

- No-load speed: 125 rpm (3V) (With 66mm wheel: 26m/1min) - 208 RPM (5V) (With 66mm wheel: 44m/1min).

- No-load current: 70mA (250mA MAX) 3.1.4 Electric Wires

We will utilize electric wires to link the model car's electrical components Because these components operate at low voltage, we just need to utilize wire with a tiny diameter.

7

Trang 15

Figure 10 the wires 3.1.5 Camera

Figure 11 Camera

To capture the lane of the road for the self-driving car, we use the camera to take a photos and analyze them by Opencv for controlling the motors.

3.1.6 Battery and battery tray

8

Trang 16

Figure 12 Battery tray

Figure 13 Battery

To ensure the power supplied of the model we use two 3.7v rechargeable batteries And then we have installed into a complete model

9

Trang 17

Figure 14 Model 3.2 Software

3.2.1 Python codes

Figure 15 Import library codes - Firstly, we use the cv2 and numpy to declare the library.

Figure 16 Color conversion codes

We define a function for bluring the image to easily detech the line and change the photo to the canny form.

10

Trang 18

Figure 17 ROI codes

Then we choose a region of interest to increase the accuracy of the lane detecting process.

Figure 18 display lines code

The code above help us to display the line of the lane we had detected through camera.

Figure 19 Call “def-name” code

This is the main part of the program, first we import the video from the camera, next we change it into gray scale and then we call the function we had defined before for image processing We also call a function to choose a region of interest

For drawing the lines we have detected we use Hough line transform and then we call the function to display the line which is detected camera.

3.2.2 Adruino codes

- Firstly, we need to declare which port connect between L298N and Arduino board.

11

Trang 19

Figure 20 Declare to Arduino board - Secondly, set all the motor control pins to outputs.

Figure 21 Set pins to output

- Next, codes that send to arduino board, helping the car go follow directions: + Going straight:

Figure 22 Setting for car go straight

+ Turning right:

12

Trang 20

Figure 23 Setting for car turn right

+ Turning left:

Figure 24 Setting for car turn left

13

Trang 21

4 CONCLUSION

We succeeded in programming a program that can process images to get lanes; however the limitation of the project is that we cannot make the program be able to handle left or right turning Moreover, we need to be careful about which COM that PC is communicating with Arduino Board.

On over the world, the level of autonomous vehicle is stopping at the level “2+”, in the future, this programme will more and more grow up to reach the level “5”, which is known as the highest level of this programme.

What is Arduino? : https://www.arduino.cc/en/Guide/Introduction

What is Python? : Edpresso Team https://www.educative.io/edpresso/what-is-python

[3] Line detection in python with OpenCV | Houghline method:

[7], [8] Arduino UNO R3 là gì?: http://arduino.vn/bai-viet/42-arduino-uno-r3-la-gi

[9] Mạch Điều Khiển Động Cơ DC L298N :

Ngày đăng: 20/04/2024, 09:32

Xem thêm:

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w