Design and implementation of fuzzy-logic based obstacle-avoidance ...

31 downloads 145 Views 846KB Size Report
Email: [email protected]; [email protected]. Abstract— In this ... avoiding obstacles and as well as reaching a pre-defined target point in an ...
Design and Implementation of Fuzzy-Logic based Obstacle-Avoidance and Target-Reaching Algorithms on NI’s Embedded-FPGA Robotic Platform Muhammad Mysorewala, Khaled Alshehri, Eyad Alkhayat, Adnan Al-Ghusain, Omar Al-Yagoub Systems Engineering Department, College of Computer Sciences and Engineering, King Fahd University of Petroleum and Minerals (KFUPM), Dhahran-31261, Saudi Arabia. Email: [email protected]; [email protected] Abstract— In this work we design, simulate and implement two fuzzy-logic based algorithms for mobile robots: one for obstacle avoidance, and another one with the combined objective of avoiding obstacles and as well as reaching a pre-defined target point in an unknown environment. The hardware used in this project is the National Instruments (NI)’s embedded robotic platform which houses the SBRIO (Single-board Reconfigurable Input-Output) that includes a powerful real-time controller, and a field programmable gate array (FPGA). For obstacle avoidance the robot has only one rotating ultrasonic sensor on the front side. The software is implemented using high-level LabVIEW modules for embedded FPGA and real-time programming. Results show the key advantages of this new approach which is its accuracy, simplicity and quicker reaction to sudden changes especially when the robot is moving in an unstructured environment. This is due to the fact that the approach accounts for the size and shape of the robot and generates the speed of motion proportional to the distance from the obstacle. Keywords—Obstacle avoidance; mobile robot; LabVIEW; FPGA; Real-time controller; Fuzzy logic; Target reaching

I.

INTRODUCTION AND BACKGROUND

Mobile robots are being increasingly used on land, underwater, and in air, as sensor carrying agents to perform various missions, such as searching for harmful biological and chemical agents, search and rescue in disaster areas, and environmental mapping and monitoring. The use of robotics for such crucial applications requires that various types of complex operations related to navigation, sensing, computation and communication are performed efficiently. Problems commonly associated with navigation of mobile robots are path planning, localization, mapping, obstacle avoidance, target tracking, etc. Different schemes exist for obstacle avoidance since 90s among which the popular ones used edge-detection [1], potential fields, certainty-grids, Vector-Field Histogram (VFH) [2] etc. The limitations of these methods have also been discussed in the literature in detail. Most of these are computationally very heavy, and in the presence of other complex tasks such as the case for driverless cars and robots formation, it becomes practically impossible to implement these on hardware platforms and perform all these operations in parallel. As an alternate some simple and accurate fuzzy-logic based navigation approaches have been recently

c 978-1-4673-5893-4/13/$31.00 2013 IEEE

developed among which few (see [3, 4]) combine the objectives of obstacle avoidance and target reaching in a single algorithm. Multi-objective decision making using fuzzy discrete event systems have been discussed in [15, 16]. A salient feature of an intelligent task is its requirement for a fast execution (typically within a few micro or nano-seconds) of computationally–complex operations required by advanced control and estimation techniques (such as Kalman filters, particle filters, fuzzy-logic, neural, adaptive neuro-fuzzy, system identification based adaptive, and model predictive control, pattern recognition, etc). The requirement for complex and fast computations has been a major impediment for the real-time hardware implementation of intelligent robots. As such the full potential of several advanced techniques remained virtually unfulfilled until the advent of fast processing hardware brought about by the rapid progress in the field of Very Large Scale Integration (VLSI). The progress went from the use of ApplicationSpecific Integrated-Circuits (AISCs) which were designed for specific applications to the introduction of the powerful Field Programmable Gate Array (FPGA) whose prominent features are fast execution speed, parallelism in the processing of data and re-configurability to allow for the adaptation of the FPGA used to the application at hand. The FPGA thus proved to be an effective tool for real-time hardware implementation of complex tasks and played a key role in ushering in the era of embedded processing in a variety of engineering fields such as control, signal processing, image processing and the like [5, 6]. Whereas microcontrollers are still being used at the low-tomedium end of the embedding spectrum, FPGA have made it possible to target the high end of the spectrum. To further stimulate the use of FPGAs in crafting intelligent engineering solutions, continuous efforts have been made to lower the cost of the software and prototyping of these devices based on the use of the VHDL and Verilog languages. Moreover, for example during the development stage of an embedded control system, the user has to validate his algorithm on the real hardware which usually require frequent changes of several variables, thus making it cumbersome to incorporate these changes into the whole embedded system in a costeffective and faster way. This has therefore prompted both academia and industry to seek a cost-effective solution to this

168

developmental problem in the form of a single platform capable of rapid development and testing of FPGA boards with minimum cost and effort. A notable effort in this regard was made by NI with the introduction of its SBRIO board which combines deployable, embedded devices that feature a real-time processor, reconfigurable FPGA, and analog and digital input-output ports, all residing on a single-board programming in the NILabVIEW software [7, 8]. This software provides a powerful graphical development solution for designing, prototyping and deploying embedded systems. The NI-SBRIO based platform therefore provides a welcoming and important addition to the design and prototyping arsenal for embedded systems engineering. Moreover, the NI platform allows for its own hardware expansion via the addition of variety of analog and digital sensors, motion devices, and communication modules as well as for the enables the extension of its applicability area through designing and programming its own custom FPGAbased module (see project example [9]).

angle. For implementation purposes the ultrasonic sensor is installed on the front side which rotates continuously and senses the distances from obstacles on the Left, Middle and the Right sides. The two outputs of the fuzzy controller are the speed of the Left and Right wheels after fuzzification of the 3 input variables, application of the fuzzy rules, and defuzzification. These inputs and outputs are fuzzified using the membership functions given in figure 1. The same membership functions as discussed in section-IIC are later used for the implementation of the algorithm on the robot. The radius of the robot wheels are 5 cm.

This paper is organized as follows. In section II we describe the first algorithm for obstacle avoidance which includes the design, simulation, implementation of results and discussion. In section III, we discuss the second algorithm which combines the objectives of obstacle-avoidance and goal-reaching in a single fuzzy logic scheme. We explain our approach; include LabVIEW simulation and finally the comparison of results. Finally the results and conclusion are summarized in section IV. II.

ALGORITHM 1: OBSTACLE AVOIDANCE

In the first project a fuzzy logic based approach for robot obstacle avoidance has been developed and implemented on NI’s SBRIO 2-wheel differential drive robotic platform. It uses the ultrasonic sensor mounted on a motor to see how far the obstacles are in front of the robot up to a maximum distance of 1m. The ultrasonic sensor can turn left and right up to 65 degrees on each side (hence sweeping through a 130-degrees frontal area) in order to detect the obstacles in front of the robot. The robot is a 2-wheel differential-drive mobile robot. In order to design this new approach that should provide smoother motion and instant reaction to sudden changes, we started by analyzing the demo program (called ‘roaming’) that captures 65 values of obstacle distances with a 2 degrees step. It then finds the largest gap from these values and then let the robot move in that direction by giving command to its left and right motors up to a maximum angular speed of ±16 rad/sec. In the literature, this approach is called Vector field histogram (VFH) [2, 10]. It is observed that this program is not very accurate and sometimes would ignore the obstacles that are close and hit these in order to reach the largest gap. Therefore a new fuzzy logic controller is designed, simulated in LabVIEW and implemented on SBRIO robot, and its overall performance is analyzed. A. Design of Fuzzy controller The algorithm is designed to use 3 distance linguistic values as inputs, corresponding to obstacle distance at -65 degrees (Left), 0 degrees (Middle), and +65 degrees (Right)

Figure 1. Fuzzy membership functions for the input/outputs (top picture), 8 different scenarios of obstacles shown out of total 27 possibilities considered for simulation (bottom picture)

The input distances are classified either as Close (membership value u decreases from 0 to 0.2 meter), Medium (from 0.1 to 0.5 m) and Far (u increases for the distance from 0.3 to 0.5 m, and then remain constant after that). Each output has three membership functions: Backwards (represents speed

2013 IEEE Symposium on Computational Intelligence in Control and Automation (CICA)

169

from -16 to 0 rad/sec, or -80 cm/sec to 0), Zero (speed from -4 to +4 rad/sec, or -16 to +16 cm/sec), and Forward (from 0 to +16 rad/sec, or 0 to 80 cm/sec). Following are 8 of the rules, out of total 27 rules used for the development of fuzzy controller.

area, whilst avoiding any obstacles in its path and having no final destination. These programs written in LabVIEW are downloaded to the real-time controller on the robot using NILabVIEW-real-time controller tool. In terms of sensors, the robot is also equipped with an ultrasonic sensor mounted on a motor in order to sense the obstacle present in front of it.

1. IF 'Left' IS 'Far' AND 'Middle' IS 'Far' AND 'Right' IS 'Far' THEN 'Right' IS 'Forward' ALSO 'Left' IS 'Forward' 2. IF 'Left' IS 'Far' AND 'Middle' IS 'Far' AND 'Right' IS 'Medium' THEN 'Right' IS 'Forward' ALSO 'Left' IS 'Zero' 3. IF 'Left' IS 'Far' AND 'Middle' IS 'Far' AND 'Right' IS 'Close' THEN 'Right' IS 'Forward' ALSO 'Left' IS 'Backward' 4. IF 'Left' IS 'Far' AND 'Middle' IS 'Medium' AND 'Right' IS 'Far' THEN 'Right' IS 'Zero' ALSO 'Left' IS 'Zero' 5. IF 'Left' IS 'Far' AND 'Middle' IS 'Medium' AND 'Right' IS 'Medium' THEN 'Right' IS 'Forward' ALSO 'Left' IS 'Zero' 6. IF 'Left' IS 'Far' AND 'Middle' IS 'Medium' AND 'Right' IS 'Close' THEN 'Right' IS 'Forward' ALSO 'Left' IS 'Backward' 7. IF 'Left' IS 'Far' AND 'Middle' IS 'Close' AND 'Right' IS 'Far' THEN 'Right' IS 'Backward' ALSO 'Left' IS 'Backward' 8. IF 'Left' IS 'Far' AND 'Middle' IS 'Close' AND 'Right' IS 'Medium' THEN 'Right' IS 'Forward' ALSO 'Left' IS 'Zero'

B. Simulation in LabVIEW The fuzzy logic controller illustrated in figure 1 with 27 rules is implemented using the Fuzzy System Designer (FSD), and PID and Fuzzy Control toolkit of LabVIEW [11], by defining in the toolkit the membership functions for the inputs/outputs, writing the rules and defuzzification procedure, where the defuzzification uses an approach called COA (Center of Area) [12]. Finally this fuzzy controller is called from a simple LabVIEW VI. Figure 1 (middle picture) illustrates 8 different possibilities (out of 27) of obstacles sensed on the left, middle and right side. In each case, each of the 27 rules has different degrees of fulfillment (DOF) depending on the membership function defined in figure 1 (top picture) and the input distances involved. Figure 2 (top picture) shows the snap of the LabVIEW program written in order to implement this fuzzy controller. This program receives three distances on the Left, Middle and the Right side, and generates velocities for the two wheels. Figure 2 (second and third pictures) shows the simulation results for the input values read (Left, Middle and Right sensor), and the output values of speed generated for the Left and Right wheel for cases 5 and 7. It is clear that since for case-5 the obstacle is farthest on the left side, the right wheel should turn faster compared to the left wheel in order to move the robot to the left side. Similarly, for case 7 the obstacle is close on the left side, so the output command moves the robot on the right side. C. Implementation on NI-SBRIO Platform The robotic platform comes with the LabVIEW demo programs that can be downloaded to the FPGA for initial testing. The first step is to understand these simple codes and to basically interface the hardware involved as shown in Figure 3. After creating the IP-based communication between the robot and the computer (PC) through the Ethernet connection, the next task is then to run and test the “Roaming” program which is a program that is designed by NI for this particular robot and whose basic purpose is to make the robot roam in a foreign

170

Figure 2. LabVIEW simulation code for fuzzy controller (top), and inputsoutputs results for case-5 (left) and 7 (right).

2013 IEEE Symposium on Computational Intelligence in Control and Automation (CICA)

controller. The same fuzzy rules, membership functions and the defuzzification procedure written in FSD and PID and Fuzzy Toolkit replaces the VFH-based code running on the robot. The advantage of using this hardware is that same high-level code can be used with some knowledge of LabVIEW FPGA and real-time controller. For implementation purposes the same membership functions which were used in simulation and shown in figure 1 are used. D. Results and Discussion It was observed that with fuzzy logic based controller the robot avoids obstacles very well and reacts to sudden changes. In order to make sure that there is no bumping into obstacles while turning, etc we also took into account constraints such as the shape and width of robot while defining the membership functions. Since the membership functions are linear, we get the speed of the robot proportional to the distance of the robot from the obstacle in the front. The benefits of NI’s embedded real-time controller and FPGA implementation that has been observed are fast execution of obstacle avoidance algorithm using only one ultrasonic sensor. The maximum speed of the wheel as shown in figure 1 is 16 rad/sec, which is achieved when the obstacle is farther than 50 cm. The radius of the wheel is 5 cm which results in maximum speed of 80 cm/sec. This much high speed for obstacle avoidance is only possible using real-time control. For future work, ANFIS (Adaptive-Network-based-Fuzzy Inference System (ANFIS) [13] will be used for the robot to learn the environment in addition to avoiding the obstacles which is developed in this work using a fuzzy-controller. The scheme can be further improved by including sensors on the back side also. III.

Figure 3. Top picture shows SBRIO Robot’s physical structure [8], main components such as the board, motors, range-finder sensor, etc. Bottom picture shows the snapshot of the LabVIEW code which keeps the ultrasonic sensor mounted on the motor running, acquires distance measurements and runs the fuzzy controller in real-time.

ALGORITHM 2: OBSTACLE AVOIDANCE AND TARGET REACHING

There can be two ways of developing fuzzy logic based algorithm for obstacle avoidance and target reaching. One is to just drive the robot following the shortest part to reach the goal and in case of obstacles switch to another mode and run the same obstacle avoidance algorithm that we developed earlier. We choose to develop a single algorithm that combines both objectives as this would be more accurate.

As discussed in section II, the existing algorithm uses VFH approach which relies on 65 values of obstacles distances with a 2-degrees step. It then finds the largest gap from these values and moves the robot in that direction based on binary logic of moving into the direction of largest gap without taking into account other areas.

In this new algorithm there are 4 inputs: Left, Middle, and Right distances which we acquire by scanning using the ultrasonic sensor (this was the case in previous obstacle avoidance algorithm also). The additional 4th input is the deviation from the desired direction which is θ . This input is considered in order to make sure that the robot is always trying to turn towards the goal even when it is trying to avoid the obstacle. The output is the Robot Turning Angle φ .

As mentioned previously, in order to replace this algorithm with the fuzzy controller, we divided the roaming program into 4 categories, which are, initialization, sensing, calculations and actuation, and finally the shut-down part. We modified the calculations and actuation part in order to implement the fuzzy

Figure 4 shows the membership functions for the inputs and outputs. The first and second diagram in figure 4 shows the input membership functions. As indicated in the third diagram in figure 4, the output robot turning angle (Ɏ) has membership functions of NL, NM, NS represents negative small, medium

2013 IEEE Symposium on Computational Intelligence in Control and Automation (CICA)

171

and large angles; PS, PM and PL represents positive small, medium and large angles; Z represents the membership function of zero turning angle.

A. Simulation in LabVIEW In order to perform the simulation an environment of dimensions 35x35 sq. meters (m2) is considered (see figure 5 below), where each pixel in the area is 1m. The robot has a dimension of 1x1 m2 (One full pixel), and it runs with a maximum speed of 1m/s. In the left figure (of figure 5) the robot starts from the lower left corner and the target is set in the upper left corner. The time for the robot to reach the goal, based on out pervious assumptions is 32s. While without the obstacle it will take it in 24s. For the right figure, the robot will start from the lower left corner and the target is set in the upper right corner. The time for the robot to reach the goal, based on out pervious assumptions is 37s. While without the obstacles it will take the robot 21 seconds to reach the goal. In the last simulation environment, the robot starts from the lower left corner and the target is set in the lower right corner. The time for the robot to reach the goal, based on out pervious assumptions is 34s. While without the obstacles it will take it in 26s.

Input Target Direction LEFT MIDDLE RIGHT (ɽ) Distance

Output Robot Turning Angle (ˇ)

F

F

F

N

NS

F

F

M

N

NM

F

F

N

N

NL











M

M

M

Z

PM

M

M

N

Z

PL

M

N

F

Z

NL











F

F

F

P

PS

F

F

M

P

PM

F

F

N

P

PL











Figure 4. Input membership function of left, middle and right distances (first), angle of target direction (second), output membership function of turning angle (third), and few rules out of total 81 rules are shown here.

172

Figure 5. Three scenarios of simulation with different starting and ending points when our fuzzy-logic based algorithm is used with no apriori information available about the environment.

B. Results and Discussion Table I shows the comparison of A* method which is used when the map of the environment is known to the robot in advance [14]. Whereas when the FL-based method is used the robot is in an unknown environment, so it decides adaptively on what location to visit in order to reach the destination. As expected in the absence of obstacles robot will take least time to reach the destination.

2013 IEEE Symposium on Computational Intelligence in Control and Automation (CICA)

TABLE I. Comparison of A* method, FL-method and with no obstacles for 3 different scenarios.

Simulation Environment 1 2 3 IV.

Time in A* Method 28s 31s 30s

Time in Fuzzy-Logic Developed 32s 37s 34s

Time without obstacles 24s 21s 26s

CONCLUSION AND FUTURE WORK

We develop two fuzzy-logic based algorithms for mobile robots: one for obstacle avoidance, and another one with the combined objective of avoiding obstacles and as well as reaching a pre-defined target point in an unknown environment. We also implement the first algorithm on NISBRIO robotic platform. Other testing is performed in LabVIEW simulation environment. The approach accounts for the size and shape of the robot and generates the speed of motion proportional to the distance from the obstacle in realtime. Overall, the approach is found to be accurate, simple to implement and results in quick reaction to sudden changes of obstacles especially when the robot is moving in an unstructured environment. The approach can be improved adding more sensors especially on the back side of the robot. Also, it is planned to use neural network to learn the environment while performing the mapping and obstacle avoidance operations.

[7] [8] [9]

[10]

[11] [12] [13] [14]

[15]

[16]

NI-FPGA details: http://www.ni.com/fpga/ NI-SBRIO details: www.ni.com/singleboard/ A project on “Creating a Smart Grid Monitoring and Control System Using LabVIEW and NI-SBRIO” http://sine.ni.com/cs/app/doc/p/id/cs13487. LabVIEW VI for Simple Vector Field Histogram (VFH), http://zone.ni.com/reference/en-XX/help/372983A01/lvrobovi/simple_vfh/ PID and Fuzzy Logic Toolkit User Manual, National Instruments. 2009. Lefteri H. Tsoukalas, and Robert E. Uhrig, “Fuzzy and Neural Approaches in Engineering”, Wiley-Interscience. 1997. Tahboub, Khaldoun K., and Munaf SN Al-Din. "A Neuro-Fuzzy reasoning system for mobile robot navigation." JJMIE 3.1 (2009). Pi-Ying Cheng, Pin-Jyun Chen, “Navigation of mobile robot by using D++ algorithm”, Intelligent Service Robotics Journal, November 2012, Volume 5, Issue 4, pp 229-243. K. Schmidt and Y. Boutalis, "Fuzzy Discrete Event Systems for Multiobjective Control: Framework and Application to Mobile Robot Navigation", IEEE Trans. on Fuzzy Systems, vol. 20, no. 5, pp. 910-922, October 2012. Y. S. Boutalis, K. Schmidt, "Multi-objective decision making using fuzzy discrete event systems: A mobile robot example", 18th Mediterranean Conference on Control and Automation, pp. 575-580, Marrakech, Morocco, June 23-25, 2010.

ACKNOWLEDGMENT The authors would like to acknowledge the support provided by the Deanship of Scientific Research (DSR) at King Fahd University of Petroleum & Minerals (KFUPM) for funding this work through project no. SB101017. We also acknowledge the help given by the NI’s technical support team who provided us with useful tips and tools while working on their hardware. REFERENCES [1]

[2]

[3]

[4]

[5]

[6]

Borenstein, J.; Koren, Y.;, "Obstacle avoidance with ultrasonic sensors", IEEE Journal of Robotics and Automation, vol.4, no.2, pp.213218, Apr 1988. Borenstein, J.; Koren, Y.; , "The vector field histogram-fast obstacle avoidance for mobile robots", IEEE Transactions on Robotics and Automation, vol.7, no.3, pp.278-288, Jun 1991. Menon, A.; Akmeliawati, R.; Demidenko, S.; , "Towards a Simple Mobile Robot with Obstacle Avoidance and Target Seeking Capabilities using Fuzzy Logic", Instrumentation and Measurement Technology Conference Proceedings, 2008. IMTC 2008. IEEE, pp.1003-1008, 12-15 May 2008. Ganapathy, V.; Soh Chin Yun; Ng, J.; , "Fuzzy and Neural controllers for acute obstacle avoidance in mobile robot navigation", IEEE/ASME International Conference on Advanced Intelligent Mechatronics, 2009. AIM 2009, pp.1236-1241, 14-17 July 2009. J. J. Rodriguez-Andina, M. J. Moure, and M. D. Valdes, “Features, design tools, and application domains of FPGAs”, IEEE Transactions on Industrial Electronics, vol. 54, no. 4, 2007. Ling K.V., Yue S.P. and Maciejowski J.M., "A FPGA Implementation of Model Predictive Control", IEEE American Control Conference, 2006.

2013 IEEE Symposium on Computational Intelligence in Control and Automation (CICA)

173