## 5 Design of Autonomous Navigation Simulator  
In this study, a mobile-robot navigation simulator was developed using MATLAB, and it was applied for the verification of the autonomous navigation performance of the robot. The navigation environment was developed using the MATLAB function \"world\" in the matrix form with the same size as the floor area of the indoor environmental simulator (Figure 1), which was 60 cm \(\times\) 80 cm. The size of the matrix was 600 \(\times\) 800, which implies that the interval between elements was 1 mm, and each element had a color value; for example, \"1\" for white and \"0.5\" for grey. In addition, the MATLAB function \"image\" was used to visualize the navigation environment consisting of a white background with grey obstacles. The motion of the robot was indicated as an overlapped rectangle by using the MATLAB function \"patch\", corresponding to the calculated moving direction and the speeds of the two wheels. Figure 9 depicts the sequence of the data-processing operation performed in the navigation simulator. Because the x and y coordinates, representing the robot's position, are calculated by using the speeds of the two wheels, the denser path in the simulator indicates a slower speed. The eight distance sensors that produce the input values (d1-d8) for the fuzzification process do so by calculating the distances between the location of each sensor and obstacles placed in front of the heading direction of the sensors.  
Figure 10 shows the algorithm of the MATLAB code for fuzzification of the left sensor data in the proposed navigation simulator. The figure describes the code for the input membership function illustrated in Figure 6a, and it can be used to generate 12 fuzzified variables--L, F, R_Close, L, F, R_Med, L, F, R_Far, L, S, and R_pos--from the front, right, and left sensor signals. The fuzzification of 6d calculated using the output of the fuzzy positioning system was performed using the MATLAB code for the input membership function, as illustrated in Figure 6b.  
Figure 11 shows the algorithm of the MATLAB code for the rule evaluation and defuzzification algorithm (based on (1)) developed as part of the proposed navigation simulator.  
Figure 11: Rule evaluation and defuzzification algorithm.  
Figure 9: Flowchart of data processing in robot simulator.  
The behavior rule evaluation and defuzzificaton procedures are used to calculate the rotational speed (LVel, RVel) at the center of the wheels of the mobile robot. The outputs from the fuzzy navigation system are expressed as follows:  
\[v_{L}=LVel\ K\ r=\omega_{L}\ r, \tag{6}\]  
\[v_{R}=RVel\ K\ r=\omega_{R}\ r \tag{7}\]  
where \(K\) (rad/s) is the coupling constant between the outputs (_LVel_, _RVel_) from the fuzzy navigation system and the real rotational velocity (\(v_{L}\), \(v_{R}\)) of the wheels, and r is the radius of the wheel. Finally, the renewal position coordinate of the robot, as shown in Figure 12, is calculated using (8) and (9), where T is the sampling interval that was set to 0.33 s in this study.  
\[\theta(k+1)=\theta(k)+\left(\frac{V_{R}-V_{L}}{d}\right)T \tag{8}\]  
\[\left\{\begin{array}{l}x(k)\\ y(k)\end{array}\right\}=\sqrt{C_{1}^{2}+C_{2}^{2}}\left\{\begin{array}{l} \cos\theta(k+1)\\ \sin\theta(k+1)\end{array}\right\} \tag{9}\]  
While the fuzzy logic navigation approach calculates the steering angle and moving distance in the next step based on the velocity difference between the two wheels of the mobile robot, as shown in (8) and (9), the potential field navigation approach only calculates the steering angle for steering the robot in the direction where the value of the total potential is minimized. Hence, the moving distance of the potential field approach was calculated with a function that linearly relates the moving distance of the robot in each step to the minimum value among 36 distance data.