Autonomous Vehicle with Fuzzy Logic Controller 

 September 17, 2021

By  Abhishek Tyagi


Until recently, on-board computers were mainly related to secondary tasks, such as temperature control of the passenger compartment, opening car doors, and monitoring fuel, oil, and battery power; however, computers are increasingly driving tasks in some business models.
• Maintain reference speed and acceleration or keep a safe distance from other vehicles,
• Use infrared cameras to improve night vision
• Create maps and suggest alternative routes.
However, many street situations are still difficult to manage, especially in urban environments. Driving problems belong to a class that relies on the underlying system to reason and deal with uncertainty. In tasks related to environmental perception or driving, we must integrate all aspects of intelligence and human behavior so that the vehicle can control the driving mechanism like a human. The automotive organization has two main goals. First, they hope to introduce autonomous driving through a whole series of vehicles tested on real roads. Your second goal is to develop our automation system from modular components that can be used immediately in the automotive industry.

Fuzzy Logic Controller

A fuzzy logic control system is a set of physical components designed to modify another physical system to have specific properties. There are two types of control systems: open control systems and closed control systems. In closed-loop control, the input control effect has nothing to do with the physical system's performance. In contrast, the input control effect in the closed-loop control system depends on the physical system's performance. The system is also called closed-loop control. The first step in managing physical variables is to measure them. The sensor measures the controlled signal. Plants are controlled physical systems. In closed-loop control, the input power signal of the system is determined by the output characteristics of the system. The main problems of adjustment are as follows:

The error signal controls the output of the controlled physical system. The (calculated) planned response and the required response signal errors. A compensator or regulator system can be added to the control loop to provide positive feedback and performance for the closed-loop control system.

When developing fuzzy logic controllers, the process of generating fuzzy rules plays a vital role. The fuzzy rule system has four structures:

  • A set of rules that represents the guidelines and strategies of the decision-maker.
  • The amount of input is evaluated immediately before the actual decision.
  • A method for evaluating any projected action regarding its conformity to the expressed rules once offered data.
  • Create promising stocks and determine when to stop looking for more profitable stocks.
Autonomous Vehicle with Fuzzy Logic Controller

Autonomous Vehicle with Fuzzy Logic Controller

The following steps are used to develop the fuzzy logic controller:

  • Variable identification-here must identify the input, output, and state variables from the corresponding object.
  • Fuzzy subset configuration: The information domain is divided into several fuzzy subsets, and each subset is assigned a language label. Always make sure that these fuzzy subsets contain all the elements in the universe.
  • Get membership function: Get the membership function of each fuzzy subset.
  • Fuzzy rule base configuration: The fuzzy rule base is formulated by assigning the relationship between fuzzy input and output.
  • Fuzzification-Perform the fuzzification process.
  • Combining Fuzzy Outputs: Use rough fuzzy inference to find fuzzy outputs and combine them.
  • Defuzzification-Finally, apply defuzzification to obtain precise results.

Focused Autonomous Vehicle System

In this system, we will design a Fuzzy controller that will be accepting two inputs; distance from another vehicle[m] and speed change[m/s^2], and provide one output that is Acceleration Adjustment[m/s^2].

Rules used by our system:

1. If (Distance is V_small) and (Speed_Change is Declining) then (Acceleration_Adj is -small)

2. If (Distance is V_small) and (Speed_Change is Constant), then (Acceleration_Adj is -Large)

3. If (Distance is V_small) and (Speed_Change is Accelerating) then (Acceleration_Adj is-Large)

4. If (Distance is Small) and (Speed_Change is Declining) then (Acceleration_Adj is Zero)

5. If (Distance is Small) and (Speed_Change is Constant), then (Acceleration_Adj is-small)

6. If (Distance is Small) and (Speed_Change is Accelerating) then (Acceleration_Adj is -Large)

7. If (Distance is perfect) and (Speed_Change is Declining) then (Acceleration_Adj is +small)

8. If (Distance is perfect) and (Speed_Change is Constant), then (Acceleration_Adj is Zero)

9. If (Distance is perfect) and (Speed_Change is Accelerating) then (Acceleration_Adj is-small)

10. IF (Distance is Big) and (Speed_Change is Declining) then (Acceleration_Adj is +Large)

11. If (Distance is Big) and (Speed Change is Constant) then (Acceleration Adj is +small)

12. If (Distance is Big) and (Speed_Change is Accelerating) then (Acceleration_Adj is Zero)

13. If (Distance is V_big) and (Speed_Change is Declining), then (Acceleration_Adj is +Large)

14. If (Distance is V_big) and (Speed_Change is Constant), then (Acceleration_Adj is +Large)

15. If (Distance is V_big) and (Speed_Change is Accelerating), then (Acceleration_Adj is small)

Input Variable- Distance

Input Variable- Distance

Input Variable - Speed_change

Input Variable - Speed_change

Output Variable - Acceleration Adjustment

Output Variable - Acceleration Adjustment

Working of our system




Interference Engine - 1

Interference Engine - 1

Interference Engine - 2

Interference Engine - 2

Interference Engine:

From our above set of rules, four rules will play their role in this situation Rule number 4, 5, 7 and 8.

  • If Distance is Small[0.4] and Speed is Declining[0.25] then maintain acceleration[0.25].
  • If Distance is Small[0.4] and Speed is Constant[0.75] then Acceleration Adjustment is  -small[0.4].
  • If Distance is perfect[0.6] and Speed is Declining[0.25] then Acceleration Adjustment is +small[0.25].
  • If Distance is perfect[0.6] and Speed is Constant[0.75] then maintain acceleration[0.6].




Finally, using rules, we get respective values:













BpRcuDgDpMGl2Wv8BTAAAAABJRU5ErkJggg== | Autonomous Vehicle with Fuzzy Logic Controller | MATLAB Helper ® max







Now using the Approximation COA method

Acceleration_Adj= \frac{\alpha 1C1+\alpha 2C2+\alpha 3C3}{\alpha 1+\alpha 2+\alpha 3}

= \frac{0.4*-1+0.6*0+0.25*1}{0.4+0.6+0.25}

= 12\frac{m}{s^{2}}


We get our required resultant which is -0.12m/s^{2} in this case. This loop continues in an autonomous vehicle while driving to adjust acceleration concerning other vehicles present on the road.

I hope you enjoyed this blog!

Get instant access to the code, model, or application of the video or article you found helpful! Simply purchase the specific title, if available, and receive the download link right away! #MATLABHelper #CodeMadeEasy

Ready to take your MATLAB skills to the next level? Look no further! At MATLAB Helper, we've got you covered. From free community support to expert help and training, we've got all the resources you need to become a pro in no time. If you have any questions or queries, don't hesitate to reach out to us. Simply post a comment below or send us an email at [email protected].

And don't forget to connect with us on LinkedIn, Facebook, and Subscribe to our YouTube Channel! We're always sharing helpful tips and updates, so you can stay up-to-date on everything related to MATLAB. Plus, if you spot any bugs or errors on our website, just let us know and we'll make sure to fix it ASAP.

Ready to get started? Book your expert help with Research Assistance plan today and get personalized assistance tailored to your needs. Or, if you're looking for more comprehensive training, join one of our training modules and get hands-on experience with the latest techniques and technologies. The choice is yours – start learning and growing with MATLAB Helper today!

Education is our future. MATLAB is our feature. Happy MATLABing!

About the author 

Abhishek Tyagi

Abhishek Tyagi is an aspiring Automotive engineer who enjoys connecting the dots: be it ideas from different disciplines, people from different teams, or applications from different industries. He has strong technical skills and an academic background in engineering, statistics, and machine learning.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

MATLAB Helper ®

Follow: YouTube Channel, LinkedIn Company, Facebook Page, Instagram Page

Join Community of MATLAB Enthusiasts: Facebook Group, Telegram, LinkedIn Group

Use Website Chat or WhatsApp at +91-8104622179