SUGISAKAMASANORI

Journal of Robotics, Networking and Artificial Life
Vol. 9(3); December (2022), pp. 263–267
ISSN (Online):2352-6386; ISSN (Print):2405-9021
https://alife-robotics.org/jrnal.html

Research Article

Fuzzy Theory Applied in Identification System for Tiny Self-Driving
Cars
Chun-Chieh Wang

Department of Automation Engineering and Institute of Mechatronoptic Systems, Chienkuo Technology University, Taiwan

A RT I C L E I NF O
Article History
Received 10 November, 2021
Accepted 01 August 2022
Keywords
Fuzzy theory based identification system (FTBIS)
Raspberry Pi
PythonTiny self-driving cars (TSDC)

ABSTRACTIn this paper, a fuzzy theory based identification system has been developed to improve the self-driving
image recognition technology. The Raspberry Pi microprocessor is used as the main controller of thecar. The author writes a Python program to deal with the image recognition problem. The image
processing techniques include grayscale, binarization, morphology, image cutting and so on. There are
four main functional tests in the scenario setting. It includes road identification, conversion of lane
turning arc into front wheel turning angle, intersection identification, and traffic light identification.
The purpose is to verify the functionality of fuzzy-based identified self-driving cars. The experimental
results show that the developed recognition system based on fuzzy theory can successfully improve
the recognition effect and reduce the probability of self-driving walking errors.
© 2022 The Author. Published by Sugisaka Masanori at ALife Robotics Corporation Ltd
This is an open access article distributed under the CC BY-NC 4.0 license(http://creativecommons.org/licenses/by-nc/4.0/)1000 fps. In 2021, Syeda Shahista et al. [5] proposed avision-based traffic light structure detection andconvolutional neural network (CNN)-based state recognition
method that is robust to different lighting and weather
conditions. Not only that, the authors presented a deep fusion
network for robust fusion without the need for a large amountof labeled training data covering all asymmetric distortions.
The following year, Qingyan Wang et al. [6] presented a new
YOLOv4 algorithm by using the shallow featureenhancement mechanism and the bounding box uncertainty
prediction mechanism. Its main purpose is to improve the
network's ability to locate small objects and color resolution,and then improve the accuracy of traffic light detection andrecognition.
Based on the above, in order to develop teaching-type
autonomous vehicles, Chun-Chieh Wang [7] proposed a smart
identification technology to complete road identification,
conversion of lane turning arc into front wheel turning angle,
intersection identification, and traffic light identification.
However, the experimental results show that the swing of thevehicle during walking is too large, so that the trajectory of
the vehicle often exceeds the sides of the road. Therefore,
this paper proposes a road identification system with a fuzzy
theoretical framework. In addition, the author also makes
moderate improvements to the tiny self-driving car and its
power supply.

1 INTRODUCTION
Image recognition technology in the 21st century has been
applied to life. In particular, image recognition combinedwith automatic driving systems can bring people moreconvenient and safer driving. In the past 10 years, many good
related studies have been presented.
In 2016, Felipe Jiménez et al. [1] proposed an algorithm
based on vehicle dynamics mathematical model toimproving the lane reference detection for autonomous roadvehicle control. The following year, Toan Minh Hoang et al.
[2] proposed a method to overcome various lighting
problems. Especially severe shadows, these authors obtainbetter road lane detection results by using fuzzy system andline segment detection algorithm. For the problem of traffic
light detection, in 2018, Manato Hirabayashi et al. [3]presented a ROI extraction method for traffic light images
based on the current location on a 3D map. Moreover, theauthors also proposed two methods to identify traffic lightstates on the extracted ROIs. This method can indeed toleratecalibration and localization errors to a certain extent.
However, when the error is too large, the classification isincorrect. After two years, Kento Yabuuchi et al. [4]proposed a method to detect traffic lights from images
captured by high-speed cameras that can recognize flashing
traffic lights. The proposed method can handle more thanCorresponding author’s E-mail: jasonccw@ctu.edu.tw / bigjasonwang@gmail.com

263

center point position according to the road width in the lens,so as to control the turning range of the steering gear.
The coordinate points x1 and x3 on both sides of the track
are taken to calculate the center point (Q) of the road.
Equation 1 is used to calculate the Q point coordinates of Fig.
2. Then, the coordinate points on both sides of the road arelocked, which are A(x0,y0), B(x1,y1), C(x2,y2), D(x3,y3) four
coordinate positions.
The controller needs to determine the turning range inadvance to prevent the vehicle from exceeding the driving
trajectory. Because of this, the coordinates A and C are
additionally set in this paper. Coordinates B and D are where
the car needs to get the center point. When the subtracted
distance between points B and D cannot be directly
expressed as the coordinates of the center point, the x1
coordinate needs to be added to the correct position of pointQ.

2 TINY SELF-DRIVING CARS (TSDC)
2.1 TSDC Platform
The tiny self-driving car body in this article uses thesteering gear to drive the direction of rotation of the vehicle.
Actual view of the car is shown in Fig. 1. In general, themechanism design of the car body is similar to themechanism of [7]. Therefore, this article will not go into
details.
It is worth noting that mobile power supply is utilized toprovide stable power to keep the testing process at its best in
this article. Not only that, a transformer (5V, 2.5A) can
provide stable voltage and current to the Raspberry Pi. The
two upper and lower lenses on the front of the car are used
to identify the road and identify the traffic lights, as shownin Fig. 1-B.

𝑥𝑥 −𝑥𝑥𝑄𝑄 = 𝑥𝑥1 + 3 2 1(A) Side view

(1)(B) Front viewFig.2. The central position of road recognition(C) Right rear side view|𝒙𝒙 −𝒙𝒙|𝜽𝜽 = 𝒕𝒕𝒕𝒕𝒕𝒕−𝟏𝟏 |𝒚𝒚𝒏𝒏−𝒚𝒚𝒏𝒏+𝟏𝟏 |𝜽𝜽𝟎𝟎 =(D) Right front side viewFig.1. Actual view of the car

2.2 Controller and Peripheral Devices
The Raspberry Pi is used as the main controller for thisarticle. It is a microcontroller based on the Linux operating
system. The steering of the car is controlled by the 360degree rotating servo motor-SG90 and the 180-degree hightorque servo motor-MG996R. As for road recognition andtraffic light recognition, Raspberry Pi Camera V1.3 andLogitech C920 cameras are used respectively. For actual
photos of all the above equipment, please refer to [7].

3 FUZZY THEORY BASED IDENTIFICATIONSYSTEM (FTBIS)𝜽𝜽𝑳𝑳 −𝜽𝜽𝑹𝑹
𝟐𝟐

𝒏𝒏

𝒏𝒏+𝟏𝟏

Fig.3. Angle range of θL and θR

3.1 Setting Method of Road Coordinate Points
This paper sets the coordinate positions on both sides of
the road to keep the car in the center of the road. The
coordinate position of the road width is used to obtain thecenter point to ensure that the car's route is in the center ofthe road. If the car turns when it is walking, it will obtain the

264

(2)
(3)

necessary to remove the bright spot in the middle of the LED
light to facilitate color judgment. Not only that, thecoordinates of x1, x2, y1 and y2 are set to obtain the positionof the light signal. Next, the position of the light spot isprocessed and the parts that may affect the recognition are
removed. Dilation needs to be performed after the light spot
is removed. Fig. 6 is the result before and after processing
the light spot for traffic lights.

Fig.4. Schematic diagram of the coordinates of the roadturning
The green area in Fig.3 is the suitable turning range.
Equation 2 is used to calculate the angle of θ｡to adjust themagnitude of the steering gear. As shown in Fig.3, θL is theamplitude of the left wheel steering and θR is the amplitudeof the right wheel steering. It should be noted here that the
θ｡generated by the coordinate changes on both sides may bedifferent. Therefore, Equation 3 is used to ensure that thecorrect θ｡ can be obtained. Fig.4 is the coordinate positionon the road. According to the curvature and direction of theroad, an appropriate angle θ｡ is generated to control thevehicle to drive along the road.

(A) 4 coordinate settings

3.4 Road Boundary Detection
To make road recognition more accurate, this section
firstly plans the judgment conditions for road recognition.
The way to judge the turn is to transmit the image of thecamera to the Raspberry Pi to get the boundary points of theroad so that the width of the road can be calculated. The
judgment method will be divided into the calculation
formula of the right boundary (line_R) and the left boundary(line_L). Taking Fig.7 as an example, if the X coordinate ofline_R minus line_L is less than 120, it means that thecaptured boundary area appears as a straight line. If the X
coordinate position of line_R is less than 10, the trajectory isdeviated and a right turn is required. If the X coordinate ofline_L is greater than 120, it means that the car is too far to
the right and must turn left to return to the center of the road.
When encountering a fork like Fig.8, Fig.9 and Fig.10, thecounter will change from 0 to 1. For example, assuming thatthe self-driving route is A2, in Fig.11, it can be determined
whether to turn or go straight at the next intersection.

3.2 Control Flow Design
Camera lenses are turned on for image recognition to
identify images of road and traffic signs. First, the image
captured by the camera lens is judged whether it is theentrance of the starting point. Secondly, the controller will
judge according to the system flow chart shown in Fig. 5 tomake sure that the driving route is correct. As for flowchartof road identification and flow chart of traffic light
identification, please refer to [7].
Start

Carry out road detection

Detection signal lightNo
Turn on the camera

Initialization

Yes
Is there an intersection?

Is there a signal light?

Drive the chosen route

No

Yes
Choose route (A/B/C)(B) The processed lightFig.6. The result before and after processing the light spotYes
Is it a green light?

Obtain the turning
angle according to theanalysis result.

Self-propelled carturn left

Adjust the front wheel
angle and walk.

Self-propelled carturn right

Did you reach the end?

Self-propelled car
going straightFig.7. Road boundary detection point

A

No
B

Self-propelled car stop

No

C

Yes

Fig.8. Straight curve
detection positionEnd

Fig.5. System flow chart
3.3 Traffic Light Detection
To identify the status of the R, Y, and G colors of the traffic
lights, it is necessary to obtain the grayscale value of eachlight first. In addition, to obtain an accurate light status, it is265

Fig.9. Curved cornerdetection position

Fig.10. T-shaped cornerdetection position

Fig.11. A2 route curve
detection position

3.5 Fuzzy Theory Based Identification Rule Design
To reduce the probability of the vehicle's trajectory going
beyond the sides of the road, this paper proposes a roadrecognition system with a fuzzy theoretical framework. Oncethe center point of the track is determined by visual
recognition, the fuzzy controller is activated immediately,

so that the car can be corrected back to the original middleof the road in the shortest time.
First, the error (e) between the center point (Cm) capturedby the camera and the road center point (Q) is defined as the
input of the fuzzy controller. That is, e=Cm-Q. e>0 means
the car is to the right. Conversely, e<0 means that the car isto the left. The output of the controllers are set as the rotation
angles of the motor (θL, θR). In addition, the error (e) is
divided into small positive error (SPE), medium positive
error (MPE), large positive error (BPE), small negative error(SNE), medium negative error (MNE) and large negative
error (BNE). Similarly, the output (θL, θR) are also divided
into small positive error (SPA), medium positive error(MPA), large positive error (BPA), small negative error(SNA), medium negative error (MNA) and large negative
error (BNA). Here, the symbols of the forward and reverse
rotation of the motor are defined as P for forward rotation
and N for reverse rotation. The membership function of the
input and output range are designed in Mamdani type.
Combining the above, the design of Fuzzy IF-THEN rules
are expressed as follows.
If e is BPE, then θL is BNA and θR is BPA.
If e is MPE, then θL is MNA and θR is MPA.
If e is SPE, then θL is SNA and θR is SPA.
If e is SNE, then θL is SPA and θR is SNA.
If e is MNE, then θL is MPA and θR is MNA.
If e is BNE, then θL is BPA and θR is BNA.

Fig.13. Schematic diagramof route A

Fig.14. Actual walking
screen of Route A

Fig.15. Schematic diagramof route A1

Fig.16. Actual walking
screen of Route A1

Fig.17. Schematic diagramof route A2

Fig.18. Actual walking
screen of Route A2

Fig.19. Schematic diagramof route D

Fig.20. Actual walking
screen of Route D

Fig.21. Schematic diagramof route D1

Fig.22. Actual walking
screen of Route D1

4 EXPERIMENTAL SCENARIO DESIGN
The position and number of traffic lights in this article are
as shown in Fig.12. During the experiment, only two traffic
lights will be placed on each path for testing.

Fig.12. Road site simulation map (6 traffic lights)

5 EXPERIMENTAL RESULTS
Please refer to the following URL directly for theexperimental results. https://youtu.be/hZut2Adu0Rw
Fig.13-Fig.30 are screenshots (including schematic diagrams)of self-driving walking pictures of 9 routes.
266

Fig.23. Schematic diagramof route D2of the road, the fuzzy controller will be activated
immediately. The purpose is to make the car correct the
trajectory and return to the middle of the original road in avery short time.
To realize the function of self-driving cars, there are fourmain functional tests in the scenario setting. It includes road
identification, conversion of lane turning arc into front wheel
turning angle, intersection identification, and traffic light
identification. The test results prove that the developed
fuzzy-based recognition system can effectively improve roadrecognition and reduce the probability of self-driving
derailment.

Fig.24. Actual walking
screen of Route D2

REFERENCES

Fig.25. Schematic diagramof route S

Fig.27. Schematic diagramof route S1[1] Felipe Jiménez, Miguel Clavijo, José Eugenio Naranjo, andÓscar Gómez (2016), Improving the Lane Reference Detection
for Autonomous Road Vehicle Control, Journal of Sensors, Vol.
2016, Article ID 9497524.
[2] Toan Minh Hoang, Na Rae Baek, Se Woon Cho, Ki Wan Kim
and Kang Ryoung Park (2017), Road Lane Detection Robust to
Shadows Based on a Fuzzy System Using a Visible Light
Camera Sensor, Sensors, 17, 2475.
[3] Manato Hirabayashi, Adi Sujiwo, Abraham Monrroy, Shinpei
Kato, Masato Edahiro (2018), Traffic Light Recognition using
High-Definition Map Features, Robotics and Autonomous
Systems, Vol. 111, pp.62-72.
[4] Kento Yabuuchi, Masahiro Hirano, Taku Senoo, Norimasa
Kishi and Masatoshi Ishikawa (2020), Real-Time Traffic Light
Detection with Frequency Patterns Using a High-Speed Camera,
Sensors, 20, 4035.
[5] Syeda Shahista and Afreen Khatoon Khan (2021), Detection of
the Traffic Light in Challenging Environmental Conditions,Fig.26. Actual walking
screen of Route S

International Conference on Artificial Intelligence and Soft
Computing (ICAISC-2021), EasyChair Preprint no. 4950.

Fig.28. Actual walking
screen of Route S1[6] Qingyan Wang, Qi Zhang, Xintao Liang, Yujing Wang,
Changyue Zhou and Vladimir Ivanovich Mikulovich (2022),
Traffic Lights Detection and Recognition Method Based on the
Improved YOLOv4 Algorithm, Sensors, 22, 200.
[7] Chun-Chieh Wang (2022), Smart Identification System of
Teaching-type Autonomous Vehicles, International Conferenceon Artificial Intelligence Life and Robotics (ICAROB-2022),
pp.630-634.

Authors Introduction

Fig.29. Schematic diagramof route S2Prof. Chun-Chieh Wang
He is a professor of Department ofAutomation Engineering and Institute of
Mechatronoptic Systems of Chienkuo
Technology University.
His areas ofresearch interest include robotics, image
detection, electromechanical integration,
innovative inventions, long-term care aids,
and application of control theory. He is
now a permanent member of Chinese
Automatic Control Society (CACS) and Taiwan Society of
Robotics (TSR). He is also a member of Robot Artificial Life
Society.

Fig.30. Actual walking
screen of Route S2

6 CONCLUSION
This article successfully developed a tiny self-driving carwith fuzzy based identification system. In order to test
whether it is fully functional, the experimental field isplanned, in which 9 different paths are designed to allow thetiny self-driving car to perform visual identification based on
different paths.
In addition, to reduce the probability of the vehicle's
trajectory going beyond the sides of the road, a roadrecognition system with a fuzzy theoretical framework is
proposed. When the trajectory of the tiny car crosses any side267