Automatic generation of rules for a fuzzy robotic controller G. Castellano, G. Attolico, E. Stella, A. Distante Istituto Elaborazione Segnali ed Immagini - C.N.R. Via Amendola, 166/5 - 70126 Bari - ITALY Phone (39) 80-5481969 Fax (39) 80-5484311
[email protected] Abstract
Fuzzy logic is a useful tool for realizing a direct mapping between perceptual situations and control commands in robotic applications that do not require internal representation or planning. It allows explicit programming and automatic learning from suitable training data to be mixed in several ways in order to produce the necessary control rules. Automatic learning enables both the reduction of the annoying and errorprone explicit programmimg work and the evolution in time of the controller in order to cope with dynamically changing environments. At any time an expert can verify and eventually modify the knowledge of the fuzzy system according to its personal experience. Two methods for the automatic extraction of rules from training data have been proved on a fuzzy control system for wall-following. The system is intended to grow including all the behaviors required for the safe navigation of a autonomous mobile vehicle and their arbitration. Distance measures supplied by an ultrasonic sensor ring have been choosen as sensory data. The training data have been collected during operator-driven runs of the vehicle. The same data have been used by the two methods for building rule bases that have proved eectively in driving a real AGV (a TRC Labmate base) in an indoor environment.
1 Introduction
Some tasks involved in autonomous mobile vehicle navigation can be solved eciently without using plan-based methods, that need some internal representations to be built and updated. Obstacle detection and avoidance, wall-following, door-crossing are examples of low-level strategies that can be realized by the reactive approach that directly maps the sensory data into control commands and avoids the delaying update of an environment model (including all the obstacles and the vehicle itself) according to detected changes. Moreover a reactive controller can often be based on the use of simple and
cheap sensors, like sonars. Unfortunately, due to the uncertainty of sensory data and the complexity of spatial situations, the mapping between perceptual situations and control commands cannot be described mathematically: approximation techniques are needed. Both neural networks ([1], [2], [3]) and fuzzy controllers ([4], [5], [6]) have proved to give good results as function approximators in reactive navigation applications. Despite their theoretical equivalence [7], neural and fuzzy systems turn out to be quite dierent in practice. The learning process for neural networks is generally slow and the nal knowledge is represented in a way dicult to evaluate, integrate and re ne. The linguistic representation of fuzzy rules is easily understandable instead, allowing validation and correction at any time using information provided by human experts. Moreover, the learning process for a fuzzy controller is quicker and scales gracefully with the size of the problem. The design of fuzzy systems requires the choice of input and output data, the de nition of linguistic values (with the associated membership functions) for each fuzzy variable and nally the derivation of rules, describing the fuzzy algorithm, from the available knowledge (human experts and real data). To make automatically these choices means to improve the autonomy of the system in learning the initial strategy and in its tuning during on-the-job runs in a dynamic environment. The automatic generation of fuzzy rules is receiving an increasing attention. In [8] and [9] the rules are obtained by iteratively dividing the input and the output space into regions to which numerical inputoutput data are assigned (in [9] the input space is divided in advance while in [8] variable regions are considered). Also machine learning approaches [10], neural networks [11] and genetic-based learning algorithms [12] have been used to derive a feasible set of rules.
Generally the success of a rule learning algorithm, depends strongly on the quality of the training examples (records of the system state and of the associated operator response), which must be signi cative and complete in order to allow the system to appropriately build rules and correctly generalize in situations for which no training data are available. In mobile vehicle navigation, the training data are in general collected moving the vehicle in representative situations a few times in a supposedly similar way: it is not easy to guarantee that there are no contradictory data (similar situations in which dierent actions have been performed) or that the whole perceptual space has been covered with no overlap (which implies a fusion of dierent commands). This paper addresses the problem of automatically building the rule bases of a fuzzy robotic controller for the wall-following task. Two dierent methods have been used to extract fuzzy rules from training data acquired by an ultrasonic sensor ring during operatordriven sessions. The rst method uses a learning process similar to the one proposed by [13]. The learning is accomplished in a single step going through the training set. The fuzzy rule base can be easily updated processing only the new provided data. Unfortunately the rule base size depends on the number and on the granularity of input variables and is in general quite large. A second method, using a well known machine learning technique (the ID3 algorithm) for estimating the relevance of each input signal in the control decisions, has therefore been used for building a more compact rule base. It has been successful in reducing the rule number without weakening the controller. In order to verify the eect of limitations in the acquired training data on the performance of the controllers, their rule bases have also been proved after a completion step during which the the similarity between rules has been used for deciding the controller behavior in regions where no real data were available. The experimental results provided show the eectiveness of the fuzzy controllers in driving an AGV (based on a TRC Labmate base) along arbitrarily shaped walls, especially with respect to their ability to deal successfully with real noisy data, even furtherly corrupted by arti cial noise.
1.1 Notations and de nitions
Let us consider a fuzzy system with n inputs x1; :::; xn and a single output y (this is not a limitation, since a fuzzy algorithm with m outputs is equivalent to m fuzzy algorithms each with n inputs and one output).
FRONT LEFT FRONT
RIGHT FRONT LEFT BACK RIGHT BACK
Figure 1: Arrangement of ultrasonic sensors and sensor suits Let be UI and UO the continue input and output universes of discourse. Each input linguistic variable Ak 2 UI ; k = 1; ::; n, is characterized by Nk linguistic terms Ak1; Ak2; :::; AkNk. The linguistic variable B 2 UO is characterized by M linguistic terms B1 ; B2; :::; BM . For what follows, it is convenient to introduce a crisp representative value of a fuzzy set, that we de ne as the modal point for triangular or gaussian shaped sets. Trapezoidal sets instead will be represented by the midpoint of the range of points having membership value 1.0. We will denote by aki and bj the representative value for sets Aki and Bj respectively. Let the rule that maps the ith multivariate fuzzy input variable Ai to the j th univariate output set be labelled by rij , i.e.: rij : IF (x is Ai ) THEN (y is B j ) or more explicitly: rij : IF (x1 is Ai1 ) ^ : : : ^ (xn is Ain) THEN (y is B j ) where Aik (respectively B j ) is the linguistic value that the input fuzzy variable Ak (respectively the output fuzzy variable B ) has Q in rule rij . The number of possible rules is N = nk=1 Nk .
1.2 Input and output de nition
The input signals to our fuzzy controller are the measures provided by a ring of 18 ultrasonic sensors distributed around the robot. Each sensor could be considered as an input variable but the number of fuzzy rules increases as more inputs are added to the controller. In order to keep the rule base manageable some preprocessing is necessary to reduce the amount of input data. Moreover, dealing with reduced input data helps the human operator driving the robot during the training in monitoring the current situation and providing the most appropriate control command. Finally, the input data preprocessing has the additional advantage of " ltering" noise,
N
F
VN N
QN
F
2 Rule base construction
VF
(mm) 10000
(mm) 150
300
500 (a)
150 200 300
10000
500
600
(b)
Figure 2: Membership functions of the input variables. NB
NM NS Z PS PM
-160
-30 -20
PB
NB
NM NS Z PS PM
PB
-15
30
mm/s -300
0 20 30
(a)
160
300 -60
deg/s -30
-5 0 5 15
60
(b)
Figure 3: Membership functions of the output variables: linear (a) and steering (b) velocity. providing more stable input measures that result in a better constructed rule base. Our preprocessing consists in grouping the sensor measures into suits and keeping only the smallest measure for each suit. First we have disabled the 5 behind sensors. The remaining 13 sensors have been grouped into 5 suits: Front, LeftBack, LeftFront, RightFront and RightBack. Figure 1 shows the sensor system with suits. We considered two dierent fuzzy variables associated to sensor suits measurements, not only to reduce the number of rules (that depends on the granularity of the input fuzzy variables), but also because, in a wall-following task, the same attention is not required for both the sides of the robot. In fact even the linguistic values describing the distances of an obstacle at the right and at the left side of the vehicle are not the same. The right suits are chosen as the most important while following walls on the right side. Thus measures from RightBack and RightFront suits are fuzzi ed into a fuzzy variable with ve terms: VF (VeryFar), F (Far), M (Medium), N (Near), VN (VeryNear). For the remaining three suits we consider a very low level of granularity with only two terms: Far and Near. With this de nition the number of possible rules is 52 23 = 200. The fuzzy controller has two outputs: the linear velocity v and the steering velocity !, that are fuzzi ed into variables with seven terms. The membership functions for input and output fuzzy variables are shown in g. 2 and g. 3 respectively.
In this section we present two dierent methods for automatically constructing rules from a set of training samples of the form (x; y) = (x1; x2; :::; xn; y).
2.1 First method
The rst method is a fast learning algorithm similar to that suggested in [13], which is based on the simple idea that the consequent of a rule is determined by the degree to which the training data match its antecedent. Therefore only training examples that match the antecedent Ai are considered in determining the consequent B j of a rule rij . Precisely, for each possible antecedent Ai , we build the subset of training samples whose inputs satisfy it with some degree, that is:
Ti = f(x; y)jAi (x) > g where
Ai (x) =
Yn
Aik (xk )
k=1
(1)
represents the matching level of input x for antecedent Ai , and is a threshold that controls the matching degree. The generation of rule rij consists in associating to its antecedent Ai a consequent B j de ned as the output fuzzy subset for which the weighted average of outputs y in set Ti has maximal membership. Formally, we have:
Bj (wi) = l=1 max (w ) :::M Bl i where:
P x;y 2T A (x)y wi = P x;y 2T A (x) (
(
)
)
i
i
i
i
is the average of the output elements in Ti , weighted by their input membership degrees. A property of this method is that each training sample in uences the generation of a single rule (if we x > 0:5) or at most two rules (with 0:5). In our simulations we have xed = 0:0.
2.2 Second method
Following the machine learning approach of [10], we have developed a second construction method, which applies the ID3 algorithm to construct a decision tree representing the rule base. The root of each subtree represents an input variable, while its branches represent the fuzzy values for that variable. The cost associated to a branch is the number of occurrences of that value for the variable. The leaves of the tree represent the output fuzzy values.
The rule construction algorithm involves building a decision tree by recursively taking the most important input variable as root of each subtree, that is the variable with greater information content (more homogeneous number of training data associated to each output) and whose values generate less homogeneous branches (in terms of training data belonging to them), according to an information measure. In this way the resulting tree will contain the less signi cant variables in the lower levels, that can be pruned o without loosing information. At each level of the decision tree we de ne: nt the total number of training samples at that point of the tree nBj the number of the nt samples with y in Bj nAki is the number of the nt samples with xk in Aki nAki Bj is the number of the nt samples with xk in Aki and y in Bj . In order to evaluate the importance of each input variable, the Quinlan's Gain Ratio has been adopted as information measure. For an input variable xk this is de ned as: (y) ? Mk GR(xk ) = INF INF (xk ) where M n X nBj Bj INF (y) = ? n log2 n t
j
t
is the total expected information content for the output variable,
Mk =
N M n X nA (X ? A k
i
nAki Bj log 2 nBj nBj )
nt
B
ki j
ki
j
is the information content if xk is selected as root of the current subtree, and N X INF (x ) = ? nA
ki log2 nnAki n t t i is the total information value of the input variable xk . After the contruction of the tree, rules are obtained by crossing all the possible branches from the main root to a leaf node. The advantage of this method is the possibility of selecting the most important input variables according to their in uence on the output, thus avoiding the generation of redundant rules.
k
k
3 Rule base completion
The application of the construction algorithms does not guarantee the completeness of the resulting rule bases. Since training data cannot cover all the input
universe, it may happen that no sample matches an antecedent, which remains with an unde ned consequent. In order to ll in rules with empty consequent, we adopted an interpolative approach similar to that proposed in [13]. It consists in iteratively comparing the antecedent of an empty rule with the antecedent of all the currently lled rules. Let E and NE be the current set of empty and nonempty rules respectively. Our completion method computes for each empty rule the similarity to each signi cative rule and then considers a weighted averaging of all the similarity measures. We de ne the similarity measure between two rules rhl and rij as: h i sim(rhl ; rij ) = 1 ? d(da ; a ) max
(2)
where ai = (ai1 ; :::; ain) is the crisp representative vector of the antecedent Ai , and dmax is the maximum distance between two points ai in the input space. The distance d(,) has been chosen to be the Euclidean distance. The consequent B ? of the empty rule rh? is de ned as the fuzzy set of the output variable such that: B? (zh ) = maxl=1:::M Bl (zh ), with Pr 2NE sim(rh? ; rij )bj zh = Pij rij 2NE sim(rh? ; rij ) The algorithm is able to complete the rule base in a single step trough the set of empty rules. Moreover, all the currently non-empty rules in uence the completion of a rule, unlike the weighted averaging method proposed in [13], that takes in account only the initial set of signi cative rules.
4 Implementation details
The constructed rules are stored in a n-dimensional Fuzzy Associative Matrix (FAM) in which the size of the kth dimension is Nk . An element (i1 ; i2 ; :::; in), corresponding to antecedent Ai , contains the output linguistic term B j that appears in the consequent of rule rij . We have adopted a nonsingleton fuzzi cation, which is more adequate when dealing with data corrupted by measurement noise [7]. Our fuzzi er maps an input crisp value x into the fuzzy set A? for which A? (x) > 0:5. A product-max inference has been applied. We have chosen the product operator for rule evaluation, because it retains more input information than the min operator and generally gives a smoother output surface [7], a desiderable attribute for a controller.
LeftB LeftF Front RightF RightB ! F F F F F Z F F F F F NM ...... ...... ...... ...... ...... ...... F F F F N Z F F F F N NM Table 1: Some contradictory training data expressed with fuzzy terms. Figure 4: The mobile vehicle SAURO Given an input x = (x1 ; x2; ::; xn), the ring strength of a rule is
rij (x) = Ai (x) =
Yn
k=1
Aik (xk )
(3)
while the nal maximum membership value for the output set Bj , j = 1:::M after the inference of all rules is given by: max ( (x))) Bj (y) = min(Bj (y); i=1 ::N rij
(4)
where y is the variable representing the support values of the output membership functions. The center of area defuzzi cation method has been adopted, since it yelds a better performance of the controller than the mean of maxima method [7]. However, to reduce the computational cost of the method, we have considered the crisp representative value bj of the set Bj instead of its centroid. Thus the crisp control value is obtained as: PM B (bj )bj j y? = Pj =1 (5) M (b ) j =1 Bj j
5 Experimental Results
The Sistema AUtonomo RObotizzato (AUtonomous RObotic System) SAURO, an autonomous vehicle oriented to transportation tasks in indoor environments ( g.4), has been used for collecting the training data and for testing the fuzzy wall-follower. The SAURO architecture is based on a LABMATE mobile base on which a VME bus processing system is installed. The fuzzy controller has used a ring of 18 ultrasonic sensors, each having a beam opening angle of 30 degrees and minimum detectable distance equal to 15cm. The ultrasonic sensors have been grouped
into suits, according to the required spatial resolution, each one providing a single value to the control system ( g.1). Also the number of linguistic labels associated to each fuzzy variable depends on the position (and relevance for the wall-following task) of the corresponding suit ( g.2). The motion control of the mobile robot is realized by setting its steering velocity ! and its driving velocity v ( g.3). However, for simplicity, our rst set of experiments have concerned the robot moving at a constant forward speed, with the controller choosing the suitable steering velocity in the range [-127,127] deg/s. The training set has been obtained during navigation sessions of the vehicle driven by a human operator. The sensory input and corresponding control output have been stored during repeated guidances of the robot along a wall on its right-hand side in dierent situations. The presence of contradictory samples in the training set (see table 1 for some examples) precludes the evaluation of controllers using their performance on the the training data. Instead they have been tested in many real environmental situations. The results have shown that both the rule bases can successfully drive the mobile robot along walls in unknown situations also quite dierent from the training ones. In addition, the vehicle has been able to avoid static obstacles and to timely react to slowly approaching objects. Infact, for their reactive nature, our fuzzy controllers can accomplish the wall-following behavior with no need of prede ned environmental representations, but simply according to the current spatial situation. Therefore the vehicle is able to address the occurrence of unespected obstacles, that are just regarded as particular walls from which a safe distance is kept. Figure 5 shows the trajectories followed by the vehicle driven by the two controllers in a simple environmental situations. It can be seen that the two
controllers have very similar performances in terms of distance kept from the wall (see g. 6 for a direct comparison).
START
START
(a)
START
START
(a)
(b) Figure 5: Trajectories of SAURO controlled with the rst (a) and the second (b) rule base in a simple test situation. The z -axis represent the distance taken by the vehicle from the wall. First method Second method 200
Distance
150
100
50
0 0
200
400
600 800 Navigation steps
1000
1200
1400
Figure 6: Performance of the two controllers in terms of distance (in cm) taken by the vehicle from the wall during the trajectory of g. 5.
(b)
Figure 7: The trajectory of the vehicle driven by the rst (a) and the second (b) controller in a complex test environment. The vehicle changes its trajectory to avoid an unespected obstacle while keeping the wallfollowing behavior. Even in more complex environmental situations, like the one depicted in gure 7 the two fuzzy rule bases assure a correct control of the vehicle. It can be noted that the robot is able to avoid unespected obstacles by correctly changing its trajectory and still following the wall. However the two learning methods are not equivalent as concerns the complexity of the resulting rule base. Infact the rst method has produced 167 fuzzy rules, with a visible level of redundancy: not all the input variables do aect all the control commands. Using the second method, instead, only 77 rules have been obtained. because only the most relevant input variables have been considered. Table 2 and 5 show some of the rules obtained with the two methods. It can be noted that in the rst group of rules in table 2 the input variables LeftBack and LeftFront are redundant because they do not in uence the output. Note instead that these rules have been compacted in a single rule (the rst in table 5)
by the ID3 method. Likewise the second rule in table 5 corresponds to the second group of rules in table 2. LeftB LeftF Front RightF RightB ! N N F N F Z N F F N F Z F N F N F Z F F F N F Z ...... ...... ...... ...... ...... ...... N N N QN VF PB N N N F N PB ...... ...... ...... ...... ...... ...... F N N N QN PM Table 2: Some of the control rules obtained with the rst learning method LeftB LeftF Front RightF RightB ! F N F Z N N N PB N F N QN PB F N N VN VN PM F N N F PB N F VN VN Z N F VN N PS N F N VF NS N F F QN NS F F N F F NM Table 3: Some of the control rules obtained with the second learning method However the number of rules obtained with the second method is still far from the 15-25 rules used by other controllers for the same task (e.g.[10]). This is due to the ambiguity of the training data: an input sample corrupted by noise may force the algorithm to generate all the branches of a subtree, even though few of them are actually necessary for the classi cation of the remaining samples. The application of the completion process has not introduced signi cant improvements on the performance of the two controllers. This means that, despite the uncertainty in the collected training data, the two learning methods produce rule bases with a good generalization ability. Finally, in order to evaluate the robustness of the fuzzy controllers against the uncertainty of the input data, we have carried out some navigation trials in
which the acquired sensor data (that are naturally noisy) have been furtherly corrupted by random gaussian noise. The results have shown that even working on data corrupted with noise quantities up to 5 cm, both the controllers still drive appropriately the robot.
6 Conclusions
Fuzzy logic provides a formal system for reasoning on uncertain information and can be used within intelligent control systems for representing general, nonlinear relationships between imprecise data. Fuzzy navigation controllers can be an eective solution for the implementation of navigation behaviors that do not require internal representations of the environment, so hard to acquire and to update, necessary for conventional plan-based techniques. Automatic learning and continuous adaptation of the control strategy by collecting and processing appropriately representative real data, a crucial property for dealing with real dynamically changing contextes, can produce the system knowledge, stored in form of fuzzy rules, that experts can then evaluate and tune with their skills. A fuzzy navigation controller has been developed for driving a vehicle along a right-handside wall, mapping noisy and uncertain data (distances between the vehicle and the environment provided by an ultrasonic sensor ring) onto control commands. Two methods for automatic deriving the fuzzy rule base from training data acquired during sessions controlled by a human operator have produced successful controllers. Their rst comparison con rms as a qualitative description of relationship between input and output data, that can be automatically deduced by analyzing the training data, may enable a more synthetic description of the fuzzy control algorithm keeping unchanged the robustness of the resulting system. Further investigation are in progress for reducing the size of the rule base while keeping the crucial property of dealing successfully with real noisy data (the systems have been deliberately proved not in simulation but on a real vehicle). This is especially important in prospect of the extending the control system to the complete set of behaviors required by a safe navigation in indoor environments and to their dynamic arbitration.
References
[1] D.A. Pomerleau. Ecient training of arti cial neural networks for autonomous navigation. Neural Computation, 3, 1991. [2] H. Meng and P.D. Pincton. Neural network for local guidance of mobile robots. In Proc. of
[3]
[4]
[5]
[6]
[7] [8]
[9]
[10]
[11]
[12]
Inter. Conference on Automation, Robotics and Computer Vision, pages 1238{1242, Singapore, November 1994. A. Dubrawski and J.L. Crowley. Learning locomotion re exes: a self-supervised neural system for a mobile robot. IEEE Robotics And Autonomous Systems, 12:133{142, 1994. W. Li. Fuzzy logic based robot navigation in uncertain environments by multisensor integration. In Proc. of the 1994 IEEE International Conference on Multidensor Fusion and Integration for Intelligent Systems (MFI '94), pages 259{265, Las Vegas, NV, October 1994. H.R. Beom and H.S. Cho. A sensor-based obstacle avoidance controller for a mobile robot using fuzzy logic and neural network. In Proc. of IEEE/RSJ Inter. Conference on Intelligent Robots and Systems, pages 1470{1475, 1992. M.G. Kay S.G. Goodridge, R.C. Luo. Multilayered fuzzy behavior fusion for real-time control of systems with many sensors. In Proc. of the 1994 IEEE International Conference on Multidensor Fusion and Integration for Intelligent Systems (MFI '94), pages 272{279, Las Vegas, NV, October 1994. M. Brown and C. Harris. Neurofuzzy Adaptive Modelling and Control. Prentice Hall, 1994. M. Lan S. Abe. Fuzzy rules extraction directly from numerical data for function approximation. IEEE Transactions on Systems, Man and Cybernetics, 25(1):119{129, January 1995. L.X. Wang and J.M. Mendel. Generating fuzzy rules by learning from examples. IEEE Transactions on Systems, Man and Cybernetics, 22(6):1414{1427, November 1992. J.Y. Hsu S.C. Hsu and I.J. Chiang. Automatic generation of fuzzy control rules by machine learning methods. IEEE Proc. of Int. Conference on Robotics and Automation, pages 287{ 292, 1992. Y. Lin and G. A. Cunningham III. A new approach to fuzzy-neural system modeling. IEEE Transactions on Fuzzy Systems, 3(2):190{197, May 1995. A. Homaifar and Ed McCormick. Simultaneous design of membership functions and rule sets
for fuzzy controllers using genetic algorithms. IEEE Transactions on Fuzzy Systems, 3(2):129{ 138, May 1995. [13] T. Sudkamp and R.J. Hammell. Interpolation, completion, and learning fuzzy rules. IEEE Transactions on Systems, Man and Cybernetics, 24(2):332{342, February 1994.