Exploring an Unknown Environment Using Ultrasonic and Infrared Sensors

A map-building scheme that uses a fuzzy system and sensors to control a wheeled mobile robot for building a map of an unknown environment is described in this paper. This study applies an infrared localization system and ultrasonic sensors to locate current positions and mark surrounding obstacles. With the information provided by the localization system and the distance detected between the sensor and an object, a map of the surroundings can be established using a curve fitting method during environmental exploration. A map of an unknown environment can be built without using visual sensors. Different map building approaches are applied and a comparison is given .


Introduction
The wheeled mobile robot (WMR) is one of the most discussed topics in mobile robot research. The advantages of the WMR are high-speed mobility, ease of control, and large energy storage capacity. (1)(2)(3)(4)(5)(6)(7)(8) The focus of WMR study is on how to make it work efficiently in various applications. The motivation for this research is to develop an intelligent control system for a WMR exploring an unknown environment. When the robot is working, one must consider how to make it adapt to the environment and improve its efficiency in performing tasks. This study applies fuzzy theory to WMR for the exploration of unknown environments and map building. Most intelligent WMRs combine different techniques in their control system design, such as environment sensing, behavior control and execution, dynamic decision-making, and planning. The purpose of this study was to develop an intelligent control system for a fixed direction WMR instead of an omnidirectional robot for the exploration of unknown environments and map building. (6) Distances obtained from ultrasonic sensors were used as input to the fuzzy controller. A localization system called StarGazer (3) was applied to the control scheme to provide coordinate locations to the WMR. The trajectory of the path of the WMR obtained from the localization system was used as the reference.
Applying sensor fusion, Chen and Juang used ultrasonic sensors and encoded information in WMR path planning and parking control design. (9) A type-2 fuzzy control was applied to a mobile robot for avoiding moving objects. (10) In the development of intelligent WMRs, (11,12) in unknown environments, the authors applied ultrasonic sensors to search for the correct reflective position.
In an actual environment, establishing a route-map through the data collected by ultrasound sensors can help an automobile be practical and effective. Zhao et al. presented an algorithm for large-scale simultaneous localization and mapping (SLAM) to solve a sequence of linear least squares problems. (13) The strategy is based on joining submaps, where submaps are built by other SLAM techniques. Wang and Juang used information from ultrasonic sensors, an encoder, and a localization system for WMR path planning and parking control. (14) Chen and Juang made the WMR able to avoid obstacles based on a vision sensor. An automobile can search for the correct reflection position via ultrasonic sensors in an unknown environment. (15) Zhao and BeMent presented six types of three-wheeled robot models and their control ability. (16) The kinetic model of omnidirectional wheeled robot was analyzed by Leow et al. (17) Chung et al. utilized two wheels with different speeds for position control. (18) A dense stereo vision-SLAM (VSLAM) algorithm that estimated a dense 3D map representation and was more accurate than raw stereo measurements was proposed by Lategahn et al. The VSLAM system took the pose estimates to obtain a locally dense representation from dense stereo correspondences. (19) Most of these studies utilized visual sensors in map building. This study simplified the control strategy without using vision information, and applied fuzzy theory and sensor fusion to a WMR for exploration of an unknown environment and map building. Fuzzy controllers have been applied to many nonlinear systems owing to its simple and flexible control scheme. Without a visual sensor, the proposed sensor fusion system can still perform map building successfully.

WMR Setup
The WMR is 330 mm long, 280 mm wide, and 255 mm high, as shown in Fig. 1. (1) Two wheels are located at the left and right sides under the body of the WMR. The wheels help the WMR move and turn. Each wheel has an 18V-DC motor that provides 7.2 kg•m torque. The maximum speed of each wheel is 1.6 m/s. Two small casters which support the balance and movement of the WMR are located at the rear and front of the WMR. The encoders, which are located at the side of the wheels, provide the calculated amount of body movement. Ultrasound and infrared receivers measure the distance of objects and help collect the information used to build the map. An electronic module with three control panels is located in the inner body of the WMR. The first panel is the sensor board. Its main functions are: (1) transmitting and receiving signals from receivers; and (2) supplying rated voltage and order to DC server motors and receiving feedback values from the encoders. The second panel is the motion control board. Its main functions are: (1) connecting additional receivers (e.g., assistant sonar receivers, temperature receivers, acceleration and inclination receivers); and (2) converting analog to digital signals from receivers Caster X Y and transmitting the data to a PC or digital signal processor (DSP) for further calculation. The third panel is the power board. Its main functions are supplying rated voltage and order to DC server motors and outputs.
The control scheme mainly uses infrared and ultrasound sensors (Fig. 2) to detect the environment around the WMR. The encoder of the WMR can serve as feedback for the WMR. An infrared-based localization system provides the coordinates of the WMR. Additionally, the ultrasonic sensor is used to provide obstacle avoidance information.
Moving distances and turning angles for the WMR are determined by dynamic analysis. The WMR is located on the Cartesian coordinate system with no lateral or sliding movement, as shown in Fig. 3. (4) Coordinate definitions are given as follows: X-and Y-axes are the global coordinate system; X2 and Y2 are axes of the WMR's local coordinate system; x t and y t are the coordinates of the destination with respect to X and Y axes; x k and y k are the coordinates of the WMR center with respect to X and Y axes; X t ' and Y t ' are the coordinates of the destination with respect to X2 and Y2 axes; θ is the included angle between the X-axis and the center of the WMR; θ e is the included angle between the Y2 axis and the object; φ is the included angle between the X2 axis and the object; and de is the distance between the center of the WMR and the object. The velocity component of the WMR can be approximated with the following difference equation where v is the speed of the WMR's center, w is the angular speed of the WMR's center, x k (i + 1) and y k (i + 1) are the coordinates of the center of the WMR at the next time index, x k (i) and y k (i) are the center coordinate of the WMR at the current time index, and ∆t is the sampling time.
The relative distance between the WMR's center and the destination can be obtained as follows: The error of the heading angle is where In this study, a localization system is used to provide WMR coordinate information. The localization system has two major components; the StarGazer; and landmarks, as shown in Fig.  4. (20) Each landmark has its own ID. The StarGazer transmits infrared signals to the landmark and receives its ID. The coordinates of the WMR can be obtained in very high resolution. The localization system has good noise resistance and is not affected by fluorescent light, which is very suitable for indoor use. Figure 5 shows its operation.
The StarGazer is set on the WMR. The landmarks are fixed on the ceiling and are powerless. The StarGazer can obtain the coordinates and heading angle of the WMR very quickly: twenty data sets are collected per second. Maximal errors in coordinates and angles are 2 cm and 1 degree, respectively. Real time positioning messages are provided by the localization system to the control processor. The position of the WMR can be identified by the localization system. Data transmission between the localization system and the control processor of the WMR is via USB connection. Through a USB transmission module, signals can be transmitted between the control processor and the robot. Figure 6 shows the communication structure of the robot and the control processor.

Fuzzy Control
A fuzzy control scheme was proposed to control a WMR for the exploration of an unknown environment. The WMR was controlled to move parallel to walls and to stop after returning to the starting point. After the environmental exploration was completed, distance and angle information from the WMR were recorded; thus the position of the wall could be obtained. A safe distance between the wall and the robot was preset as 30 cm, which means the WMR kept a constant distance from the wall. Three ultrasonic sensors were installed on the WMR, as shown in Fig. 7; they were marked as SR_r, SR_fr, and SR_f. The dr, dfr, and df were the distances between the sensors and wall that SR_r, SR_fr, and SR_f measured, respectively.
The measured distances dfr and dr were inputs to the fuzzy controller for the WMR's velocity and angular control. These data were used to make the robot maintain a safe distance. The fuzzy values of dr and dfr were very short, short, medium, long, and very long. The output of the fuzzy controller was the turning angle of the robot, which is defined as AG. The fuzzy values of AG were given as TR3, TR2, TR1, TZ, TL1, TL2, TL3, which represented right-turn big, right-turn medium, right-turn small, zero-turn, left-turn small, left-turn medium, and left-turn big, respectively. The fuzzy speed was selected from the distance factor. Fuzzy rules of angular control were as follows: R1: if the distance of SR_r is very short and the distance of SR_fr is very short, then AG is TL3. R2: if the distance of SR_r is very short and the distance of SR_fr is short, then AG is TL1. R3: if the distance of SR_r is very short and the distance of SR_fr is medium, then AG is TZ. R4: if the distance of SR_r is very short and the distance of SR_fr is far, then AG is TZ. R5: if the distance of SR_r is very short and the distance of SR_fr is very far, then AG is TZ. R6: if the distance of SR_r is short and the distance of SR_fr is very short, then AG is TL2. R7: if the distance of SR_r is short and the distance of SR_fr is short, then AG is TR1. R8: if the distance of SR_r is short and the distance of SR_fr is medium, then AG is TZ. R9: if the distance of SR_r is short and the distance of SR_fr is long, then AG is TZ. R10: if the distance of SR_r is short and the distance of SR_fr is very long, then AG is TZ. R11: if the distance of SR_r is medium and the distance of SR_fr is very short, then AG is TL2. R12: if the distance of SR_r is medium and the distance of SR_fr is short, then AG is TL1. R13: if the distance of SR_r is medium and the distance of SR_fr is medium, then AG is TZ. R14: if the distance of SR_r is medium and the distance of SR_fr is long, then AG is TZ. R15: if the distance of SR_r is medium and the distance of SR_fr is very long, then AG is TZ. R16: if the distance of SR_r is long and the distance of SR_fr is very short, then AG is TL2. R17: if the distance of SR_r is long and the distance of SR_fr is short, then AG is TL1. R18: if the distance of SR_r is long and the distance of SR_fr is medium, then AG is TZ. R19: if the distance of SR_r is long and the distance of SR_fr is long, then AG is TR1. R20: if the distance of SR_r is long and the distance of SR_fr is very long, then AG is TR1. R21: if the distance of SR_r is very long and the distance of SR_fr is very short, then AG is TL2. R22: if the distance of SR_r is very long and the distance of SR_fr is short, then AG is TL1. R23: if the distance of SR_r is very long and the distance of SR_fr is medium, then AG is TZ. R24: if the distance of SR_r is very long and the distance of SR_fr is long, then AG is TR2. R25: if the distance of SR_r is very long and the distance of SR_fr is very long, then AG is TR3. Figure 8 shows the control sequence for following the wall on the right side.

Map Building
When the environmental exploration was completed, we collected the coordinate of the WMR. According to two consecutive coordinates, we could establish a heading angle, as shown in Eq. (6). where x is the X-axis coordinate and y is the Y-axis coordinate. An ultrasonic sensor was placed on the right side of wheeled mobile robot. The angle between the forward direction and the ultrasonic sensor was 90 degrees, and the distance detected by the ultrasonic sensor was d, as shown in Fig.  9. According to the current position of the WMR, we used the heading angle and the detected distance to mark a point at that location. Because the trajectory is formed by a series of locations, we could adjust the sampling time to approximate a continuous trajectory. Curves and straight lines were then obtained using a first or second order curve-fitting method. After the environmental exploration was finished, map building could be completed. Curve fitting was applied to establish a smooth curve that consisted of pre-collected points. In addition to smoothing, curve fitting can also be used to interpolate the exact fit required. In this study, different approaches were applied to map building, all of which have been successfully applied to map building in previous work. (4) Here we provide more comprehensive descriptions of these curve fitting methods and add the StarGazer to the control scheme to provide more accurate position information on the WMR for map building.

Least squares regression
The least squares method is one of the most used algorithms for data fitting or curve fitting computation. By minimizing deviation from the curve and the collected data, the least square error between the curve and the data can be achieved. The least-squares method was first published by Adrien-Marie Legendre in the eighteen century. (21) It is a standard approach in regression analysis. The sum of the square of the errors from solving each equation is minimized with the overall solution. The minimum of the sum of the squares can be obtained by setting the gradient to zero. A linear least squares approach is as follows: where x is the X-axis coordinate, y is the Y-axis coordinate, x is the average of x, ȳ is the average of y, and ŷ is a linear equation. The estimates can be a curve or straight line depending on the sum of the least squares, as shown in Fig. 10. The regression line will go through the collected data with the minimum sum of the squares of the error between the data and the line.

Linear interpolation method
A curve fitting method using linear polynomials called "linear interpolation" was used in this study to obtain the contour of the unknown environment. (22) Linear interpolation has been applied in many numerical analyses and computer graphics owing to its simple form of interpolation. It is the easiest way to increase data points. The method sets up a new sampling point before and after the original sampling point to two adjacent connections; the connection passes through the new location of the sampling time when the value is set to the value of the new sampling point. Given two points with the coordinates (x 0 , y 0 ) and (x 1 , y 1 ), the linear interpolation of a straight line can be obtained as shown in Eq. (10) which can be derived geometrically, as shown in Fig. 11.

Median filter
The median filter was proposed by J. W. Tukey. (23) It has been used heavily in noise-removing tasks. It is a common filter that can reduce noise in an image or in signal processing. Such noise reduction is a typical pre-processing procedure for later signal processing that can improve results. The main design uses a fixed-size mask. All data in the mask which surround a selected data point are sorted. Then a median value can be obtained from the sorted data. The pre-selected data are then replaced by the median. (23) The mathematical equations can be expressed as where m is the value of the middle data point of the surrounding neighborhood X, and W is the selected mask used to eliminate noise.

Weighted average filter
A filter that averages pixels which are the surrounding data in a pre-defined filter mask is called an averaging filter. (24) As a smoothing filter, it replaces the value of every pixel in an image by the average of the intensity levels in the neighborhood defined by the filter mask. (22) The idea behind the smoothing filter is straightforward. Figure 12 shows an average filter mask. The mathematical formulas can be expressed as shown in Eq. (13): where x is the average value of the intensity levels of the pixels in the neighborhood defined by the mask, and z is the original value of each pixel in the mask. The weights in the mask of the filter are all the same. For a weighted average filter, the weights in the mask are different. The pixels in the mask are multiplied by different coefficients. An example is shown in Fig. 13. The weight in the center of the mask has a higher value, which gives this pixel more weight than other surrounding pixels. Weighting values of other pixels depend on their distance from the center pixel. A pixel at a shorter  distance has a higher value. A pixel at a longer distance has a smaller value. The orthogonal neighbors are closer to the center pixel, thus have higher weighting values than the diagonal neighbors. Note that the average value of each pixel is divided by the total sum of the weighting values, which is 16 in this example. Figure 14 shows the operating interface for the StarGazer information and the WMR control model. We used this operating interface to receive the information from the WMR, to send control orders, and to process the feedback. This interface also showed the state of the WMR. There are two parts of the operating interface: the first part is the WMR control model and the ultrasonic sensor values; and the second part is the StarGazer measurements.

Experimental Results
The proposed control scheme is tested in two environments as shown in Figs. 15 and 16. In Fig. 15, the right bottom of the figure is the origin of the coordinate system, and the safe distance     is 30 cm. Figure 17 shows a test performed in a simple environment. The trajectory of the WMR is indicated by the blue dotted line. The trajectory measured by the StarGazer is the green dashed line. The estimated contour of the test field is the red line. The actual contour of the environment is indicated by the black line. In Fig. 18, the blue line is the new estimated map based on the least squares approach. Figures 19-21 show the results of using linear interpolation, a weighted average filter, and a median filter, respectively. Table 1 shows the errors using different approaches. The maximum total average errors in the X-and Y-coordinates are 3.1 and 2.1 cm, respectively. In Ref. 4, the indoor positioning system (StarGazer) is not integrated in the control scheme, and the maximum average errors in the X-and Y-coordinates are 6.5 and 6.2 cm, respectively. In Ref. 1, we used the iterative closest point algorithm (ICP) to estimate the map. The WMR utilized a laser measurement      sensor to scan surrounding environments. By calculating rotation and translation matrices among different sets of measured points, position information for the WMR could be recorded. No curve fitting operation was used in Ref. 1, and the maximum average error in the X-and Y-coordinates is 3.8 cm. Although the error is small and is similar to that in this study, the price of the laser sensor is much higher than the sensors used here. The proposed control scheme had the best performance in map building. Another complex environment test is shown in Figs. 22-26. The comparison of the different approaches is shown in Table 2.

Conclusions
This study proposed a control scheme for a WMR to explore unknown environments and build maps for those environments. Ultrasonic sensors were applied to detect the WMR's surroundings.
A localization system which could detect the reference position of the WMR in the test field was used in the WMR. A fuzzy controller was integrated into the control scheme. The proposed control scheme could drive the WMR to move along walls and explore an unknown environment without using expensive visual sensors or laser sensors. Trajectories of the WMR and information about obstructions in the test field could be integrated to obtain contours of the unknown environment. Different curve fitting methods were applied to calibrate the contours and produce the final maps. Different environments were tested in this study. Experimental results show that the proposed scheme performs well.