Fuzzy Logic Controller For An Autonomous Robot Computer Science Essay

Published:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

In this paper an autonomous wall-following robotis presented. The inputs are obtained from ultrasonic sensors mounted. These inputs are sent to a Microchip PIC16F877microcontroller onboard the robot, which analyses the data and provides the necessary control signal. A fuzzy logiccontroller is used to control the robot's motion along the predefined path. The robot was first modeled in MatlabSimulink and the fuzzy logic rules were optimized for the best results possible. Later the microcontroller was programmed in C language using a PCW C-compiler and tested. Experimental results are presented to show the performance of the controller.

INTRODUCTION

Mobile robots are mechanical devices capable of moving in an environment with a certain degree of autonomy. Autonomous navigation is associated with the availability of external sensors that capture information from the environment through visual images, or through distance or proximity measurements. The most common sensors are distance sensors (ultrasonic, laser, etc.) capable of detecting obstacles and of measuring the distance to walls close to the robot path. When advanced autonomous robots navigate within indoor environments (industrial or civil buildings), they have to be endowed with the ability to move through corridors, to follow walls, to turn corners and to enter open areas of the rooms. In attempts to formulate approaches that can handle real world uncertainty, researchers are frequently faced with the necessity of considering tradeoffs between developing complex cognitive systems that are difficult to control, or adopting a host of assumptions that lead to simplified models which are not sufficiently representative of the system or the real world. The latter option is a popular one which often enables the formulation of viable control laws. However, these control laws are typically valid only for systems that comply with imposed assumptions, and that operate in small neighbourhoods of some nominal state.

The option that involves complex systems has been less prevalent due to the lack of analytical methods that can adequately handle uncertainty and concisely represent knowledge in practical control systems. Recent research and application employing non-analytical methods of computing such as fuzzy logic, evolutionary computation, and neural networks have demonstrated the utility and potential of these paradigms for intelligent control of complex systems. In particular, fuzzy logic has proven to be a convenient tool for handling real world uncertainty and knowledge representation.

MATHEMATICAL MODEL

1.Types of Robotic Behaviors and Controllers

A mobile robot could be modeled in numerous ways, but the most important factor for defining the model would be the application and the complexity involved. The mobile robot designed in this work is a wheeled robot intended for indoor use as opposed to other types (legged, airborne, and submersible mobile robots). This robot type is the easiest to model, control, and build. There are various behaviours that could be modeled, like wall following, collision avoidance, corridor following, goal seeking, adaptive goal seeking, etc. With the competition in mind we thought of implementing a wall following robot. This robot would follow the boundaries of the playing area and cover a maximum area in a predefined path programmed into its onboard microcontroller. Various control techniques have been proposed and are being researched. The control strategies of mobile robots can be divided into open loop and closed loop feedback strategies. In open loop control, the inputs to the mobile robots (velocities or torques) are calculated beforehand, from the knowledge of the initial and end position (and of the desired path between them in the case of path following). This strategy cannot compensate for disturbances and model errors. Closed loop strategies, however, may give the required compensation since the inputs are functions of the actual state of the system and not only of the initial and end points. Therefore disturbances and errors causing deviations from the predicted state are compensated by the use of the inputs.

Of the many available closed loop control systems, including P (proportional) control, PI (proportional integral) control, and PID (proportional integral derivative) control, fuzzy logic control was selected as it was easiest to implement for a highly nonlinear robot model. Although a relatively new concept, fuzzy logic is being used in many engineering applications because it is considered by designers to be the simplest solution available for the specific problem. What gives fuzzy logic advantages over more traditional solutions is that it allows computers to reason more like humans, responding effectively to complex inputs to deal with linguistic notions such as 'too hot', 'too cold' or 'just right'. Furthermore, fuzzy logic is well suited to low-cost implementations based on cheap sensors, lowresolution analog-to-digital converters, and 4-bit or 8-bitmicrocontroller chips. Such systems can be easily upgraded by adding new rules to improve performance or add new features.

In many cases, fuzzy control can be used to improve existing traditional control systems by adding an extra layer of intelligence to the current control method. In many cases, the mathematical model of the system to be controlled may not exist, or may be too "expensive" in terms of computer processing power and memory, and a system based on empirical rules may be more effective.

Implementing the enhanced, traditional P controller can be a challenge, especially if auto-tuning capabilities to help find the optimal P constants are desired. However, the theory of P control is very well known and widely used in many other control applications.

On the other hand, fuzzy control seems to accomplish better control quality with less complexity (if tuning or gain scheduling is needed for the P approach).

Approximation of the second-order switching curve used in time-optimal control systems by a polynomial of the first or higher order makes fuzzy control a better candidate for time-optimal control applications [10]. As a relatively new control method, fuzzy logic provides more space for further improvements.

Originally advocated fuzzy logic has become a means of collecting human knowledge and experience and dealing with uncertainties in the control process. Now fuzzy logic is becoming a very popular topic in control engineering. Considerable research and applications of this new area for control systems have taken place. Control is by far the most useful application of fuzzy logic theory, but its successful applications to a variety of consumer products and industrial systems have helped to attract growing attention and

interest. Based on its design simplicity, its ease of implementation, and its robustness properties, a fuzzy logic controller is used in this paper to control the navigation

behaviour of an autonomous mobile robot.

3. Equations defining the Robot

For a differential drive the kinematics equations in the world frame are as follows [13].

Fig. 1 Kinematic model of the robot

Fig. 1 shows the variables used in the kinematic and dynamic equations discussed below. With respect to ICC the angular velocity of the robot is given as follows

FUZZY LOGIC CONTROLLER

The FLC used has two inputs: error in the position and error in the angle of the robot. Thus the FLC is a two input, two output system.

Fig. 2 Robot in Cartesian space.

Fig. 2 shows the robot in Cartesian space. It is clearthat the two inputs are error in angle of orientation θ and error in distance x. The output of the controller (that is, the control signals) would be pulse-width-modulated signals to control the angular velocity of the two servo wheels. The block diagram of the robotic system is given in Fig. 3.

Fig. 3 Block diagram of the robotic system.

1. Fuzzy Inference System

In the fuzzy inference system designed in our system, the membership functions of the linguistic variables are sum normal triangular functions. That means that the sum of the membership functions of any variables at any given point in the domain is equal to one. The triangular membership functions are used for their simplicity as is quite commonly done. Calculating fuzzified inputs and the areas of these functions is simple and fast when compared to other membership functions such as Gaussian. The rule base for the FLC proposed in this study is listed in Tables I and II below. Thus we see that there are 18 total rules for the two wheels combined. Of these rules, at any instant only two given rules are fired thus making it easier to understand and debug the rules.

TABLE I

RULE BASE FOR ∆wr.

Hardware Model Description

The robot has two wheels on its sides which are driven separately by two modified servo motors, and there is a roller wheel in front for balance as well as for smooth turning. The two servo motors used are MX 50Hp manufactured by MPI and are rated at 4.8 VDC. These are run using PWM signals generated from the PIC16F877 microcontroller. A pulse with a 15 ms time period and an on -time of 1500 us will stop the rotation of the motors. If the on-time of the pulse is changed from 1500 to 1000 us the wheel rotates with increasing velocity in the clockwise direction. Similarly if the on-time of the pulse is changed from 1500 to 2000 us the wheel rotates with increasing velocity in the anticlockwise direction. The sensors used on the robot are SRF04 ultrasonic range finder, two on a side and one in the front. The transmitter works by transmitting a pulse of sound outside the range of human hearing at 40 KHz. This pulse travels at the speed of sound away from the ranger in a cone shape and the sound reflects back to the ranger from any object in the path of sonic wave. If received back at the ranger, the ranger reports this echo to the microcontroller and the microcontroller can then compute the distance to the object based on the elapsed time. Due to the hardware limitations it is not possible to achieve good robot control results by doing the fuzzy calculations on board the autonomous robot, as the system clock is only 4 MHz. This results in about 0.4 seconds to complete the whole process of fuzzification and defuzzification, and thus the response of the system in real time is too slow to allow the robot to attain a steady state. Thus we have used a lookup table instead for fuzzy logic control, and also two PIC16F77 chips are used. One is exclusively used to generate the PWM signals to run the two servo motors. The other microcontroller is connected to the sensors and calculates the present errors in distance and angle and sends the necessary control signals to the microcontroller connected to the servo motors. Figure 5 shows a block diagram of the hardware setup.

Simulink Model Description

The Simulink model is shown in Fig. 6. The fuzzy block in the Simulink model is a customized Matlab m-file function block replacing Matlab's fuzzy logic toolbox. The output variables X, Y, and T are the two Cartesian coordinates of the robot position, along with its angular orientation. The Xref input is intended to keep the robot a certain distance away from the wall which it is following. The Tref input is zero, as it is intended that the orientation of the robot be maintained at a zero angle relative to the wall. The process and measurement noise are shown in the Simulink block diagram as white noise.

SIMULATION RESULTS

The plots in Figs. 7 and 8 shown below comparethe simulation results obtained of the response of the robot both with a FLC and a P controller. The P controller wastuned for optimum results using a genetic algorithm. The robot is asked to maintain a distance of 4 inches from the wall. It is seen that the robot starts from zero and aligns itself to the reference distance. Fig. 7 shows the angle of orientation of the robot as a function of time. Fig. 8 shows the distance from the wall as the robot tries to reach the reference distance. The solid lines represent the response of the robot with a fuzzy logic controller and the dashed lines represent the response of the robot with a P controller. It is obvious that the FLC is performing much better than the P controller, as it is seen that the robot reaches a steady state much earlier with a FLC than a P controller.

The results above are those obtained with computer simulations in Simulink. These were verified to be comparable with those obtained during real time implementation / experimentation with the PIC16F877 microcontroller. It was also observed that due to speed limitations of the microcontroller, the response was comparable only when a lookup table was used to implement the FLC, rather than calculating the control

signals using the FLC equations.

CONCLUSION

In this paper a fuzzy logic controller to control the motion of differential drive mobile robots has been presented. Simulations were carried out on a non-holonomic mobile robot to test the performance of the proposed fuzzy controller. The mobile robot was seen to reach any end position in an efficient manner, and whatever its initial configuration in the x-y Cartesian plane. Thus a Fuzzy Logic Controller has been implemented in real time to control the motion of an autonomous mobile robot. This type of control (with some modifications) can be used in a lot of real world applications, like interoffice mail delivery, exploration of buildings in disaster areas, autonomous cars, etc. The major enhancement of the system would be to use a better, faster microcontroller so that the fuzzy calculations could be done onboard rather than using a lookup table. Also it would be possible to add a few more ultrasonic sensors to allow it follow a corridor rather than a wall. Finally, the membership functions could be changed from triangular to other functions to have a more smooth control response.

Writing Services

Essay Writing
Service

Find out how the very best essay writing service can help you accomplish more and achieve higher marks today.

Assignment Writing Service

From complicated assignments to tricky tasks, our experts can tackle virtually any question thrown at them.

Dissertation Writing Service

A dissertation (also known as a thesis or research project) is probably the most important piece of work for any student! From full dissertations to individual chapters, we’re on hand to support you.

Coursework Writing Service

Our expert qualified writers can help you get your coursework right first time, every time.

Dissertation Proposal Service

The first step to completing a dissertation is to create a proposal that talks about what you wish to do. Our experts can design suitable methodologies - perfect to help you get started with a dissertation.

Report Writing
Service

Reports for any audience. Perfectly structured, professionally written, and tailored to suit your exact requirements.

Essay Skeleton Answer Service

If you’re just looking for some help to get started on an essay, our outline service provides you with a perfect essay plan.

Marking & Proofreading Service

Not sure if your work is hitting the mark? Struggling to get feedback from your lecturer? Our premium marking service was created just for you - get the feedback you deserve now.

Exam Revision
Service

Exams can be one of the most stressful experiences you’ll ever have! Revision is key, and we’re here to help. With custom created revision notes and exam answers, you’ll never feel underprepared again.