Fuzzy Sets and Systems 32 (1989) 207-219 North-Holland
FUZZY ALGORITIllVlIC CONTROL OF A MO~EL B Y O R A L I[NSTRUC'NON$
207
CAR
M. SUGENO, T. MUROFUSHI, T. MOF~I, T. TATEMATSU, J. TANAKA Deparmtent of Systems Science, Tokyo instils of Technology, 4259, Nagatsuta, M~iori.ku, Yokohanm 227, Japan Received October 1987
Abstract: This paper is concerned with an experimental study of fuzzy algorithmic control of a model car. A fuzzy algorithmic controller is designed by referring to an operator's experience and knowledge. The car is equipped with ultrasonic sensing devices and ~ micro-computer. It is controlled by oral instructions such as "go straighf', "turn right", "et~tergarage", and "go
out of garage". Keywords: Control theory; linguistic modelling; fuzzy algorithm; car control.
L |n~u~eu So far we have studied fuzzy control of a model car: (i) moving a car through a turn [2] and parking a car [3], (ii) linguistic control [4]. In the first study, its purposes were to learn fuzzy control rules by observing an expert's way to drive a car and to execute such control rules by an ~ct~] cat to see how well they work. Only the angle of the fron~ wheels has been controlled in moving a car through a turn, but the speed of the car has been also controlled in parking it. In the second study, its main purpose was to move a car by linguistic iz~structions such as "turn left", "change direction". We have not applied ordinary rule-based control but used a fuzzified control equation for a stee~'ing wheel. Following those studies, we adopt fuzzy algorithmic control in this study. The idea of fuzzy algorithm was first proposed by Zadeh [6]. "A fuzzy algorithm is an ordered set of fuzzy instructions upon which execution yie|ds an approximate solution to a specified problem" [7]. Much of what we do are fuzz~ algorithmic routines: "we employ fuzzy algorithms both consciously and subconsciously when we walk, drive a car, search for an object, tie a knot, pa~k a car, c~ol~ ~ J~leai, find a number in a telephone directory, etc." [7]. These examples sho~vn by Zadeh are too complex or too ill-defined for precise control. Throughout past experiences, we have learned that it is better to u~e a fu~y algorithmic control method rather than to use ordinary rule-ba~ed cow~trol methods as far as car co~trol is concerned. When we drive a car, we take sequential actions concerned with both speed and steering regulatiol~ in a 0165-0114/89/$3.50 (~) 1989, Elsevier Science Publishers B.V. (North-Holland)
208
M. Suseno et 02.
macroscopic movement. For example, in turning at a comer, you drive straight until your car comes close to the comer, and then you slow down; next, you turn the wheel and keep it until the car almost finishes turning; last, you turn back tile wheel and accelerate.
2. Model ¢sr control system We design a fuzzy algorithmic controller to control the angle of the front wheels and the speed of a model ca~, by which the car can execute macroinstructions such as "go straight", "turn right", "enter garage", and "go out of garage". We perform experiments using an actual model car (Figure 1) on such a course as is illustrated in Figme 2. Figure 3 shows the outline of information flow of t ~ ~:~odel car control system. An operator first gives a linguistic instruction through a :~peech recognition device to the car. Then, by considering its present states and surroundings, the car det~rmines its move. The car executes macro-instructions referring to inforn~ation obtained by the sensing devices. Figure 4 shows the hardware configuration of the system. The operator'~ instructions are recognized by the speech recognition device and put into a personal computer. In this personal computer, an instruction is interpreted and actions to be taken are sequentially determined according to a fuzzy algorithm. Then the signals concerned with actions are transmitted by a wireless transmitter from the personal computer to the car. The car is equipped with an on-board microcomputer which controls the car speed, the angle of the front wheels, and the sensors. The information obtained by the sensors is also transmitted from the car to the personal computer.
Fig. 1. The model car.
TNSTRUCTION
(INTERPREZI'ATION) SELECTIONOF FUZZY ALGORITHM
M. Sugeno et al.
210
~
m
I I I
io. BoArD I i.xc~oco.ptn~! 680
II
| i I
| I
s
|
1
|
I I--"L'rRAB~'"ZC II It-/c~t Rct~1'Jz~'~o.voR
i
] I
~i~cuz'q
~RlC°~R°Z' S'r~.~;.O. ez.CUI'r Jl II
I.. . . . . . . . . . . . . . . . . . . . . . . . . . .
~'tg. 4. ~ w a r e
J
configuration of model car control system.
with the sensing de V'ice shown in Figure 5. x: front fence distance, y side fence distance, and 0: heading angle. Two sensors are put at right angles to each ot~3~.r: one measures x and the other y as shown in Figure 6. A sensor consists of a 40 KHz ultrasonic transducer. It can measure distance by counting the time difference between th~ time of emitting an ultrasonic wave and that of receiving its echo reflected by the front or the side fence. The resolution of sensing is about 1 on. The sensor can measure at most 2 meter's distance. This is the reason why the garage is very near a corner in Figure 2.
y
./
° Fence
Fig. ~. Measurement variables.
Fuzzy algorithmiccontrol
211
Fence
O Fence
Fig. 6. The ultrasonic sensors; E,, Ey: Emitter, R,, R:, R2: Receiver.
The sensing unit adjusts itself to the front and side fences by turning clockwise or counterclockwise as is shown in Figure 7. That is, for any direction of the car the two sensors are kept always parallel with the corresponding fences. This is carried out by the mecha~Jasm shown in Figure 7 where the position of the sensors is controlled so that the distances measured by the receivers R~ and R2 ~re equal to each other. With the aid of this r hanism, the heading angle O can be measured by ~ing the potentiometer: the rotation of the sensing unit is measured by the potentiometer. The resolution is about 3°. The i~f~,nnation which ean~aot be sensed with the ultrasonic sensors, the width of the r¢,~. ~he location of the garage, and the space between the fence and the road, are g~ven to the controller beforehand. Fence
0 Fence
Fig. 7. The movem~.nt of the sensors.
2~.
M. Sugeno et aL
Contro~ ef front wheels: The angle of the front wheels is controlled by a DC servomotor The output of the fuzzy ~ntroller is transvatted to the motor through a D / A converter. The resolution of this control is about 0.86°/bit. When the rotation angle of the front wheel is ~ , the change of the direction of the car is about 1/60 ° after 4 cm run. Can~rol of car speed: Car . ~ e d is controlkd by changing the rotation speed of t~e DC servomotor, not by changing gears. 2.2. Instructions and interpretation We used the following fourteen instructions. (i) macto-instructiot~: go straight, men right, enter garage, go out of g a r ~ . (ii) micro-instructions: ~tart, stop, go bark, speed up, s!o~, down, steer right, sieur middle, steer b:fi~, ~ ~ensor. (~ii) conjut~cfion for macro-actions: then. A macro-ms, ruction makes the car take a senes of actmns. If the instruction "u~rn right" is ~Jven, the' ¢,~i~,~xecutes sequenual actions as mentioned at the end of Section 1. If "go straight" is given, the car moves straight along the side fence by rule-based control. A micro-instruction makes the,. car take a single action. For example, if "steer ight is give~, the ear turns the wheel right and k~eps it. The instruction "//x sensor" stops the movement ot the ultrasonic se~t~ing devices; this instruction is used (n the case tha~ the car ts controllec on*,3 by nficro-~nstrucfions. By giving m~croqnstructtons, we . can move the car h!~e an ordina~ radio-controlled car. When an m.truct~on is given, an action to be taken is one of the follow~ng: (!) ~h¢ h~struction is executed immediately, (2) the instruction is executed after the execution of the preceding macro~nstr~cfio~ is finished, (3) the insh~ction is rejected or disregarded. For examplt~, let us assume that the ~nstructio~ "go straight"is given while the car is executing the algorithm for "turn right". If the car is s01| before a corner, the execution of "turn right" is interrupted ,rid "go ~trei~ht" is executed. If the ear is t~ mmg a corner, the car e~ecutes "go ~tra~:;h~ after it finishes tum:~,ng. Far,her if ~'go out of garage" h given while the ca~ is e~ecuting "turn right", then the car always rejects it. The micro-instructions ~xcept "start", "speed up" and "do,, down" airways i~¢rrupt the execution pre:ess of a macro4nstructio~,. Using the conjunction "then", we can give a number o~ sequential macroinstructions such a~ "go straight" "then" "'turn right" "then '~ "enter 8ara:~e". •
•
~
•
e
][
'~
•
*
.
e
.~
~
lit
•
2.'~. Control The macro-instr¢ctions " ~ r n righ,~", '~enter garage", and "go o~t of garage', ate execated by a fuzzy algorithmic method. Fc~ ~exa~p~e, the flowchart ok" the fuzzy algorithm for "turn r~ht is shown in F~u~e ~j: the ear gc~¢~straight on until is comes near a corner, and then the ca~- r~duces its speed; ihc car ~ c ~ forward until the turning point, and then the f r m t wheels are turned to the right; ~he
Fuzzy aigorunnUcconuol
213
:ar
Corner
?~
GO FORWAI~D*
[H':DUCE -'.H'EI.:D
Turn~ne.
No
TIII|N
WII};ICh .,~
Fa I I od't
Allno u t. Turnod?
GOBACK ~
HODIPY DIREC'!ION
~:exeeu~ed
by r u l e - b a ~ e d
eon~ro~
Y(,,I
Gr s'rP,A I O,ll,?~
Fi~. 8. Fuzzy algorithm for "'turn ril~hF'.
angle of the front wheels is kept until ~he car almost finishes a~rning; and last the c~t comes into the actions for the m~c;o-instruction "go straight". The flowcharts of the other ~nstructions are omitte~ because of their complexity. The branching co;~dition~ h~ Figrte q except "Failed?" are fuzzy. In our study i~:~] branchings are e~:ecutvd by seR;~g thresholds That is, for example, the i :.~action "w x is smc:7 "mE~ stop ~.s~ go to 7" is oquivalen't to "w ~,m~m(x)> a~ ~a;~,~ stop EtSE g~ ~O 7", where ~m~. is a members|ap function representin~ small and a~ Zs~ give" *hresho~d. Let us consider the fuzzy condition ~'Turning Point?" in F~gure 8. It is expresseo ~n the programmi~g language C as
L
D(so'r(neav( )), te#_fa :ing( )))
VERY_ aUE.
2~4
M. $ ~
et M.
This sta~:ement means that "the car is near a co:ner and the direction of the car is right, or the car .s not near a corner and the direction is left". The values of the functions near (), riOt_facing (), and left. iacing( ) are the degrees of the truth of the statements "the car is near a come::', "the direction of the car is right", and "the direction of the car is left", resFectively. The fuzzy sets labeled near a corner, ~ght, and left are shown in F i / ~ ¢ 9. l _ ~ , b._oR, and NOT are logical c o n n i v e s define~ as I_.~¢D(z, y) -- r~in(x, y), b_ott(x, y) = rain(l, x + y), and N o . x ) = 1 - x. "Is venV_TRUE" meaJls "is greater than 0.7"; the threshold is 0.7. Ordinary rule-ba~d control is applied to execute the macro-instruction "'go straight" ~ d such indirections in fuzz" algorithms as "go forward" and "go back" shown i~ ~igure S. The, angle of the front wheels is controlled so that the car moves on a ~eference line, which is imaginarily put parallel to the side fence. Figure 10 ~lustrates the ~Hab|es used in the rules, d: the distance between the referen~ ~me and the car, 0: the angle between the reference fine and the car, and ~" the angle ~)f the front wheels. TI~ f u r y control rules fog going forward are the following: Rt~le 1: m d is left and 0 is middle ~ e ~ ~ is right, Rule 2: w d is right and 0 is middle THaN O iS left, Rule 3: w 0 is left ~ N Rule 4:
¢ is right,
0 is right THEN ~ iS left,
m
where ~he fuzzy sets are shown in Figure 11. Rule 1 and Rule 2 move the car close to ~he reference line, and Rule 3 and Rule 4 correct the direction of the car. The reasoning method is the second one described in [5]: a fiw~zy set in a consequence of a rule has a monotone membership function an~ ~efuzzification is coi~puted as a weighted mean (see Appendix A). '~p
~ CoPner
0 Fe~oe
|
g
PO°
0
90:'
e
Fig. 9. Fuzzy sets for ",~.Jmi~ point?".
Fuzzy a l g o r i ~ ¢.o~rol
215 Reference l i n e
Fig. 10. The variab|es in the eontro| rules for "go swaight".
The following ~re tt',e thresholds we have used: NOT_COMPLETELY _FALSE 0.0, IiATHE~'r~_TItUL
0.3,
TaUE
0.5,
wa~.,_'rRuE
0.7,,
VEInY_VERY_tRUE
0.9.
The logical connectives used in our system '~re only I_A~D, b..oR, and NOT. The fuzzy sets are represented as L-R typ~ fiat fuzzy numbers ri] (mr, mz, c~, ~)t.a with L(x}= R(x)=max(0, 1 - Ixl) (see Appendix B). The parameters for the membership functions and the thresholds are det,~rmi~ed 8y modifying those obtained in computer simulation. left
rig;"
-20
0
20
left
-90"
mZddle
right
0°
90 ~
0
Fig. 11. Fuzzy sets for "go ~Iraight".
.30'~
0o
30°
216
M. Sugeno et ~.
Some results of experiments are shown in Figure 12(a)-(e). Occasionally the control failed because of a sensing e~or, communication error, or speech recognition error.
/ .! m
m
~
i
Fig. ~.°~ ,~¢suIts of fuzzy control (a), (b): '~tarn rig:u"'~ ~c), f~.', "e~ter garage"; (e): "'go ou~ of getage"
Fuzzy algorithn~ control
217
The design of a fuzzy (algorithmic) controller is not difficult due ~¢othe usage of linguistic expressions in an algorithm. This fact should ~ pointed out also in o~r work. E~q.,eriences in designing fuzzy controllers show the reaIL~ation of this advantage. Linguistic expressions based on fuzzy sets are useful to branching conditions as well as control rules. In the case of branching conditions, their advantages come out when .fuzzy sets are connected by compensatory o~rations like b_oR(X, Y)= miu(1,x +y). See the program of the branching condition "Turning Point?" mentioned in Section 2•3 and its results (Figure 12(a) and (b)). If the direction of the car is in the middle between "right" and "left", the car turn at the middle point between '°near" and "No~" near"• In the case b..oR(x, y ) = max(x, y), which is not compensatory, the car cannot turn ~f the direction of the car is in the middle. An obvious drawback in fuzzy algorithmic control is that a man who cannot ~aanually control a system cannc~t make a good controller. One of the authors who first charged himself with the algorithm for "enter garage" could not make it, because he cannot drive a car ~nd thus had never put a car into a garage. In this study we have determined the parameters for membership functions by computer simulation• We should investigate a parameter-determining method by learmng. For e;¢ample, we can develop a system which learns parameters by hngaL t~. teaching such as "Turning point is too far from the corner ~' or even a self-learning system wffh ]earhiag rules such as "i~ the case of 'turn righf, if the car cannot finish the turn, set the turning point a little bit apart fr~n the corner". Our f u r y algorithmic controller has been de,~igned by an oper :~.tor's experience and knowledge, and it h~s shown good performance. It is, however, often the case that an operator can~ ot verbalize his knowledge. In such ca~es it is useful to deri,~e fuzzy control rules from an operator's actions, and we designed the =u~e-based controllers b~, such derivation in the past studies [2, 3j. Summing up ~he past expcrie~ces, v,e nc.w think that a fuzzy algorithm can baldly be derived only by a r~rely numerical method like [2, 3] and that an operator's linguistic support is necessary for its derivation. •
=
•
,i
Append~ A Here we explain the process of reasoning of the fuzzy controller for the instruction "go straight". The control rules and the fuzzy sets used for them are shown ia Section 2.3. Let the distance and the angle be*ween the r~.fere o¢. line and t~e car be do cm and 0~, respectively. Then the weights, i.e., the compatibilities w~, ~,~. w: and w,, ¢f the prein!ses, are calculated by
w2 =
w4 --
218
M. Sugeno et ~.
/:
,
,,
m
0
Fig. 13. L-R fiat fu,',~, number.
Next we find the outputs of the rules ~,#t, ~2, ~3 and ~ for which
Then the output ~Poof the co~troller is inferred:
w~ + w2 + wa + w4
Kcre we explain L - R type fiat frowzynumbers. An L - R type fiat f ~ y number M ffi (mr, m2, t% i~)L~ (ml ~. m2, ¢ > 0, ~ > 0) is a fuzzy ~¢t of the real line with tb ~ following men~bershtp function ~M:
{ L<(~n,.-z)/~), R((x - m2)/jS),
m l < X < m2, m2 ~ X,
w*~re L and R are non-increasing functions de'~ned on [0, ~) satisfying ,I) L t x ) - x if x = 0,
¢2) L ( - x ) = L(x). Figure t.3 shows an example of an L - R type ~at fuzzy number (m~, mz, o:, /~]LR with L(x~ ~ R ( x ) -- max(O, 1 -[x[)~
"7h¢ autho~ wish to thai~k Mr K. Katayama (Tokyo Gas Co. Ltd.) ~ d Mr Y.
~r~ai (Unive ~ity of Elect~o-Communicafions) for th,'~irh~Ip.
Fuzzy a l g o ~ c o n ~ o l
219
Refereu [1] D. Dut,ois and H. Prade, Fuzz~ Sets and Systems: Theory and Appticcuions (Academic Press, Hew York, 1980). [2] M. Sugeno and M. Nishida, Fu2zy cont~! of model car, ~z~,y Sets and Systems ~6 (1985) 103--113. [3] M. Sugeno and K. Murakami, An experimental :.~dy on fuzzy parking control using a ~odel car, in: M. Sugeno, Ed., Industrial Applications of Fuzzy Control (North-Holland, Amsterdam, 1985) 125-138. [4] M. Sugeno and K. Katayama, Linguistic control of n iodel ear, First IFS,~ Congress (Mallow°, 198S). [5] M. Sugeno, An introductory survey of |azzy control, Inyorm. $ci. 36 (1985) 59-83. [6] L.A. Zadeh, Fezzy algorithm, inform. Control 12 (1968) 94-102. [7] L.A. Zadeh, Outlil~e o~ ~ ~cw approach eo the ana|ysis of ¢~mp|ex systems and decision processes, IEEE 7~'a~. Systems Man ¢~ybcrnet. 3 (1ff73) 28-44.