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!

Did you find some helpful content from our video or article and now looking for its code, model, or application? You can purchase the specific Title, if available, and instantly get the download link.

Thank you for reading this blog. Do share this blog if you found it helpful. If you have any queries, post them in the comments or contact us by emailing your questions to [email protected]. Follow us on LinkedIn Facebook, and Subscribe to our YouTube Channel. If you find any bug or error on this or any other page on our website, please inform us & we will correct it.

If you are looking for free help, you can post your comment below & wait for any community member to respond, which is not guaranteed. You can book Expert Help, a paid service, and get assistance in your requirement. If your timeline allows, we recommend you book the Research Assistance plan. If you want to get trained in MATLAB or Simulink, you may join one of our training modules. 

If you are ready for the paid service, share your requirement with necessary attachments & inform us about any Service preference along with the timeline. Once evaluated, we will revert to you with more details and the next suggested step.

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