Robot Indoor Positioning and Navigation Based on Improved WiFi Location Fingerprint Positioning Algorithm

In response to the traditional WiFi location ﬁ ngerprint positioning algorithm still having a low positioning accuracy, which is di ﬃ cult to meet the robot indoor positioning and navigation needs, a series of improvements are made to the traditional WiFi location ﬁ ngerprint positioning algorithm, so that the positioning accuracy of the algorithm can be e ﬀ ectively improved. At the stage of building the location ﬁ ngerprint library o ﬄ ine, WiFi signals are collected at each reference point by reducing the reference point spacing of the traditional location ﬁ ngerprinting algorithm and then using di ﬀ erent time period collection methods. The WiFi signal strength values are standardized using the standardization processing method to improve the speci ﬁ city of traditional location ﬁ ngerprinting. In the real-time localization stage, the WiFi signals collected from the unknown location points are averaged, and then, the ﬁ ngerprint similarity calculation is performed using a matching method based on the magnitude of the Marxian distance as a similarity reference. In order to eliminate the location ﬁ ngerprints that degrade the localization accuracy, an improved adaptive K -value WKNN algorithm is integrated at the end of the localization algorithm. The improved localization algorithm and the proposed raster-based navigation algorithm are validated in a ﬁ xed experimental environment. The experimental results show that the probability of the improved algorithm ’ s positioning error within 0.4 m is 49%, which is a 35% improvement over the conventional algorithm. Combining the improved positioning algorithm with our proposed grid-based navigation algorithm, the ﬁ nal navigation error probability within 0.8m is 62%.


Introduction
In recent years, due to the development of sensors, chips, and artificial intelligence, robots have become more and more intelligent and flexible [1]. Therefore, robots are used in more and more fields. Hata et al. developed a robot system with flexible manipulators, stereo cameras, and 3D vision for cloth handling [2]. A company based in Pittsburgh, Philadelphia, Aethon, has developed a medical mobile robot that can help patients in the ward transport needed food and cleaning supplies, and it can also accurately and timely provide prescription drugs and medical supplies to nursing stations [3]. Now, many robots are also used in hotels. These robots can clean, move items, provide information, accept customer orders, process payments, etc. [4]. Literature [5] proposes multisource information fusion, which combines ultrawideband positioning technology, an odometer, low-cost gyroscope, and accelerometer to develop a trackless food delivery robot with navigation function. The application scenarios of the factory handling robots, hospital medical robots, hotel service robots, and restaurant delivery robots introduced above are shown in Figure 1. For these robots to successfully complete these specific tasks, the robot's positioning and navigation functions are indispensable. The robot with the positioning and navigation function can perceive its current position and can navigate to the specified position in the above application scenarios.
The popular GPS (global positioning system) [6] can obtain high positioning accuracy outdoors. The civilian use can reach a positioning accuracy of 3 meters, and the military use can even achieve a positioning accuracy of 0.3 meters. GPS is widely used in the positioning and navigation of moving objects such as automobiles, ships, airplanes, and handheld mobile terminals. However, most of the robots in the above application scenarios are in complex indoor environments, and it is almost impossible to apply GPS to indoor positioning. The biggest problem is that the GPS signal will be greatly weakened when it encounters buildings and various indoor objects, so the positioning error will increase sharply when GPS is used for indoor positioning [7]. Therefore, it is necessary to find a positioning technology that is suitable for indoor positioning and has high positioning accuracy and low cost. It is of important research significance to apply this positioning technology to the robot's indoor positioning so as to realize the robot's indoor positioning and navigation.
With the development of wireless local area networks, WiFi devices have become network devices that can be seen everywhere indoors. Using indoor WiFi signals to locate robots has the advantages of low cost, high accuracy, large positioning coverage, high indoor penetration, and high communication capabilities. However, the current traditional WiFi location fingerprint positioning algorithm is generally not high in positioning accuracy, and it is difficult to meet the requirements of robots for indoor positioning accuracy. For this reason, this article makes corresponding improvements on the basis of the traditional WiFi location fingerprint positioning algorithm, so that the positioning accuracy of the improved positioning algorithm can meet the requirements of the robot for indoor positioning accuracy. In order to enable the robot to navigate to the designated position smoothly, the author proposes a grid-based navigation algorithm based on the characteristics of the improved positioning algorithm. Compared with most navigation algorithms, this navigation algorithm has the advantages of simple implementation, less calculation, and higher accuracy.
The rest of the paper is organized as follows. The second part is a literature review of the robot's indoor positioning and navigation. The third part introduces the system design, including the design of the robot, the design of the positioning model, and the design of the navigation model. The fourth part discusses the improved WiFi location fingerprint positioning algorithm and the grid navigation algorithm based on the positioning algorithm. The fifth part presents our experimental design and results. The sixth part is the conclusion of the full text.

Related Work
Robot indoor positioning technology first appeared in the middle and late 20th century. At that time, researchers from Japan proposed a reliable, safe, and cheap positioning system for indoor mobile robots [8]. It uses an active ultrasonic beacon installed on the ceiling to send an ID code to the robot via a wireless link to control the transmission of ultrasonic pulses. The two receivers on the robot measure the flight time of ultrasonic pulses from two beacons at known positions. After getting the flight time, the two-dimensional position and direction of the robot can be determined. The developed system enables the robot to obtain good positioning accuracy in a small area. However, the ultrasonic waves used in the system are easily affected by indoor complex factors, which may lead to increased positioning errors, and the ultrasonic transmission distance is short. Therefore, it can only work within a certain range. This limits the development of ultrasonic positioning technology.
In order to solve this problem, researchers try to use lidar to obtain information about the indoor environment, thereby realizing the positioning of the robot. In the literature [9], a robot uses the raw data provided by two laser rangefinders to estimate the distance and angle to another robot, thereby realizing multirobot positioning. However, using lidar alone for robot positioning, the positioning accuracy is not particularly ideal. In order to further improve the positioning accuracy of the robot, people try to integrate the lidar with other sensors for positioning.
Researchers from the Beijing Institute of Technology proposed a positioning and navigation system based on the fusion of lidar and camera [10]. They proposed a threedimensional (3D) semantic map with large-scale and accurate integration of lidar and camera information to realize real-time road scenes. Moreover, a convolutional neural network-(CNN-) based semantic segmentation of images is employed to develop the semantic map of the environment. On the basis of time and space synchronization, the sensor fusion of lidar and camera is used to generate semantic mark frames of the point cloud and then generate a semantic map based on attitude. Literature [11] presents a mobile robot simultaneous localization and mapping method that combines lidar and inertial measurement unit to set up a  2 Wireless Communications and Mobile Computing multisensor integrated system and uses a rank Kalman filtering to estimate the robot motion trajectory through inertial measurement unit and lidar observations. Literature [12] utilizes data gathered with an autonomous delivery robot to compare different sensor fusion techniques and evaluate which algorithms provide the highest accuracy depending on the environment. They show how lidar scan matching combined with other sensor data can be used to increase the accuracy of the robot localization and, in consequence, its navigation. Although the fusion positioning by lidar and other sensors can obtain a higher positioning accuracy, due to the high price of lidar, it is difficult for this positioning technology to be popularized and developed.
In recent years, with the development of artificial intelligence and machine vision, more and more researchers choose to use visual SLAM-(simultaneous localization and mapping-) based [13] robot indoor positioning and navigation technology. For example, in literature [14], robots are applied to hospitals, and a SLAM technology based on RGB and depth images is proposed to improve hospital operation efficiency. Since most of the current visual SLAM researches assume that the environment is static, it will be a challenge when dealing with real and dynamic scenes. Based on this problem, literature [14] also proposed a method that effectively deals with SLAM problems for scenarios with dynamic objects, e.g., people and movable objects, based on the semantic descriptor extracted from images with help of a knowledge graph. Literature [15] studied real-time robot detection and map construction. The autonomous robot uses a single stereo vision camera to navigate, self-position, define the environment, and avoid any possible obstacles to follow the best route to the greatest extent to draw the map area. Recently, the research of visual SLAM positioning and navigation in the field of robotics remains high due to its own advantages. However, its shortcomings are also more prominent, such as the following: visual SLAM is more sensitive to light, and it is easy to fail to match when the light is not good; the image processing of visual SLAM is complicated; the amount of calculation is large; and the processing speed is slow. For this reason, this article combines the improved WiFi location fingerprint positioning algorithm and the proposed grid-based navigation algorithm for positioning navigation, which may be a new mode to solve the above difficulties, because the improved positioning algorithm in this paper has achieved good results in positioning accuracy. In addition, the proposed grid navigation algorithm is simple to implement, small in calculation, fast in processing speed, and not affected by the above-mentioned factors.

System Design
The designed positioning algorithm is running on the OpenWrt [16] system on board the Raspberry Pi [17]. However, it is the STM32 [18] that controls the robot's motion. Therefore, the Raspberry Pi transmits the current positioning result and destination point information to the STM32 by means of serial communication, as shown in Figure 2. When the STM32 gets the data from the serial port, it will start the raster navigation algorithm for navigation. During the navigation process, the robot's walking speed needs to be controlled and maintained at a constant speed value in order to reach the actual destination more accurately. Therefore, the pulses generated by the motor rotation are detected using an encoder. Then, a PWM [19] control is finally applied to the motor through the calculation of a PID algorithm [20]. This is the closed-loop control of the PID algorithm. The navigation process due to the positioning error at the starting point may cause the robot to walk away from the intended route and thus encounter obstacles, which requires the obstacle avoidance algorithm for obstacle avoidance. The obstacle avoidance algorithm designed in this paper uses an infrared obstacle avoidance module for obstacle detection. Figure 3 shows the model diagram of the improved WiFi location fingerprinting algorithm. The algorithm is divided into an offline phase to build the location fingerprint database and a real-time localization phase. In the phase of building the location fingerprint database offline, the indoor is first divided into equally spaced raster points (see 4.1.1), and the spacing of each raster point is smaller than the raster point spacing of the traditional algorithm. The robot performs WiFi signal acquisition at each grid point (reference point) in the room, and unlike the traditional algorithm, the improved algorithm uses WiFi signal acquisition methods for different time periods (see 4.1.2). The traditional algorithm is prone to matching errors due to the low specificity of the location fingerprint. Therefore, the collected data are normalized [21] (see 4.1.4) to improve the location fingerprint specificity and thus the matching accuracy. In the real-time localization phase, the robot acquires a real-time WiFi signal at an unknown point in the room. The collected WiFi signals are then averaged. The formula of the Mahalanobis distance [22] is used in the matching algorithm to calculate the Mahalanobis distance between Traditional location fingerprinting algorithms usually perform equidistant raster division of the indoor environment before collecting WiFi signal data offline, but the reference point interval divided is usually 1 meter and above. Experimentally, we found that the localization accuracy of the same algorithm is improved as the reference point spacing gradually decreases. Considering the algorithm localization accuracy and data collection workload, we decided to use a 0.3 m equidistant raster in the improved WiFi location fingerprinting algorithm. Figure 4 shows the top view of the room with a reference point spacing of 0.3 m. All subsequent experiments will be conducted in this environment.

WiFi Signal Collection
Method. WiFi signals are affected by indoor obstructions, signal multipath propagation, environmental factors, and other conditions. Therefore, WiFi signal strength values fluctuate from time to time, and the degree of fluctuation varies at each time of the day. The traditional location fingerprinting algorithm collects WiFi signals at one time of the day and does not take into account the fluctuation of WiFi signal strength values at different times of the day, which will have a significant impact on the positioning accuracy if these data are used to build the fingerprint database. To address this problem, the improved algorithm collects 100 WiFi signals at each reference point in the indoor environment to build a location fingerprint database. However, these 100 collections were made at different times of the day, and the number of collections for each time period is shown in Table 1. Such a collection method will effectively solve the problem of large fluctuations of WiFi signals on the localization accuracy compared with the collections method of traditional algorithms.     Wireless Communications and Mobile Computing WiFi device numbers. Figure 5 shows the average localization error of the improved localization algorithm with different numbers of WiFi devices. It can be seen from the figure that the average positioning error of the algorithm does not decrease significantly when the number of WiFi devices is increased from 4 to 5 or even 6. Based on this conclusion, 4 WiFi devices are used in the subsequent experiments to ensure a high positioning accuracy with a minimum number of WiFi devices.

Standardized
Processing of WiFi Signals. The location fingerprint data constructed in the offline phase of the traditional location fingerprint positioning algorithm is expressed as ðx t , y t Þ, rssi 1 , rssi 2 , rssi 3 , and rssi 4 , which contains the coordinates of the reference point t and the average value of the collected 4 WiFi signal strengths. However, the specificity of the location fingerprint constructed by the traditional location fingerprinting algorithm is not high, so it is easy to generate matching errors during localization, which reduces the algorithm localization accuracy. In order to improve the specificity of the location fingerprint and thus the accuracy of the algorithm, a standardized processing method is used to standardize the collected WiFi signals and thus build a standardized location fingerprint database. ððx t , y t Þ, m ðtÞ , ∑ t Þ is the location fingerprint of the reference point t after the normalization process, and t represents the current reference point (t = 1, 2, ⋯, N). For such fingerprint data, there are N in the location fingerprint database (N represents the total number of reference points). Among them, ðx t , y t Þ represents the coordinates of the reference point t room. m ðtÞ is the expected vector of 4 WiFi signal strengths collected at the reference point t. m ðtÞ can be estimated from the following: The first item in the vector represents the average value of the signal strength of the access point AP 1 collected at the reference point t, X represents the signal strength value, k represents the kth acquisition, and n is the total number of acquisitions. The second, third, and fourth items, respectively, represent the average signal strength of AP 2 , AP 3 , and AP 4 . ∑ t is a covariance matrix, which can be expressed as Among them,

Wireless Communications and Mobile Computing
The estimated value of ∑ t at the reference point t is λ t i,j = cov ðX t i , X t j Þ, i, j = 1, 4, and the estimated value of λ t i,j can be expressed as follows:

Matching Method.
After obtaining the signal strength vector x = ðrssi AP1 , rssi AP2 , rssi AP3 , rssi AP4 Þ of the unknown location point, the Mahalanobis distance is used as the standard to measure the similarity between x and the location fingerprint data in the matching method. The smaller the Mahalanobis distance, the greater the similarity between the corresponding location fingerprint and x. On the contrary, the larger the Mahalanobis distance, the smaller the similarity between the corresponding location fingerprint and x. The Mahalanobis distance formula can be expressed as follows: where x is the real-time WiFi signal strength vector collected by the robot at an unknown location, m ðtÞ is the expected WiFi signal strength vector of the location fingerprint of the reference point t, and ∑ t is the covariance matrix of the location fingerprint of the reference point t.

Improved Adaptive K-Value WKNN Algorithm.
The position fingerprint of the minimum Marxian distance can be calculated by Equation (5). However, using the coordinates corresponding to the minimum Marxian distance The standard deviation S of the Mahalanobis distance difference is calculated by the following: If d 1t > S, then the corresponding location fingerprint will be excluded. Otherwise, keep it, and the number of location fingerprints at the remaining is K.
In order to further eliminate outlier location fingerprints and retain location fingerprints that are effective for improv-ing positioning accuracy, these K location fingerprints are eliminated for the second time. First, we calculate the Euclidean distance between the coordinates ðx 1 , y 1 Þ corresponding to the fingerprint of the smallest Mahalanobis distance and the fingerprint coordinates of the other K − 1 locations. They are marked as dist 12 , dist 13 ,…, dist 1k , where dist 1k can be expressed as When dist 1k > d min , the location fingerprint will be removed from the K location fingerprints. The value of d min can be adjusted according to different environments. After testing, better results can be obtained in the experimental environment of this article when d min = 1.
Finally, the coordinates corresponding to the remaining k (k < K) position fingerprints are weighted: where ðx, yÞ is the final positioning result obtained by the robot, ðx t , y t Þ is the coordinate of the reference point t, d t is the Mahalanobis distance corresponding to the fingerprint at the reference point t, and ε is a small positive integer, and its function is to prevent the denominator from being zero.

Navigation Method.
In the stage of constructing the location fingerprint database of the positioning algorithm, Figure 6: Navigation page. 7 Wireless Communications and Mobile Computing the indoor environment is divided into equidistant grids. The vertices of each grid are used as reference points when building the location fingerprint database, and each reference point has a unique coordinate. The vertex at the upper left corner of the indoor plan is used as the origin of the coordinate axis. The right direction of the origin is the positive direction of the x-axis, and the bottom of the origin is the positive direction of the y-axis. In this design, the reference point spacing is set to 0.3 meters.
In the navigation process, a grid navigation algorithm is used. First, the program has been waiting for the user's navigation request. When the user passes through the navigation page of the robot control platform as shown in Figure 6, the navigation destination is entered into the web page. After the user clicks to start navigation, the Raspberry Pi OpenWrt system can receive the user's navigation request at this time. Then, the robot starts the positioning program to obtain the coordinates of the current position, and the coordinates of the destination point and the coordinates of the current position are made different. The displacement duration of the robot in the x direction and y direction is calculated according to the difference result and the walking speed of the robot, as shown in Equations (10) and (11).
where X e is the abscissa of the destination point, X s is the abscissa of the current location point, v is the robot walking speed, T x is the displacement control time in the x direction, Y e is the ordinate of the destination point, Y s is the ordinate of the current location point, and T y is the displacement in the y direction control time. Then, according to the displacement time in each direction, the robot is controlled to move from the starting point to the target point. During the movement, the robot always turns on the function of detecting obstacles. When obstacles are encountered during navigation, the obstacle avoidance algorithm is activated. After solving the obstacle problem, the positioning program will be restarted to obtain the current position coordinates, and then, the process just now continues to loop. If there are no obstacles during navigation, the robot can reach the end point smoothly and end the program. Figure 7 is a program flow chart of the grid navigation method.

Experimental Design and Results
In order to verify the effectiveness of the improved WiFi location fingerprint location algorithm, we conducted a series of experiments in Laboratory 508, Comprehensive Building of Hechi University. Figure 8 shows the real experimental environment of Figure 4. The laboratory is 10.5 meters long and 7.3 meters wide. In this indoor environment, 4 WiFi devices are arranged in different locations.  Figure 9 shows the comparison of the cumulative error distribution functions of the four cases. It can be seen from the figure that as the distance between the reference points gradually decreases, the positioning performance of the improved WiFi location fingerprint positioning algorithm is getting better and better. Compared with the four reference point spacing situations, when the reference point spacing is 0.3 meters, the algorithm in this paper can achieve a better positioning effect. Theoretically speaking, reducing the distance between the reference points again may result in a better positioning effect. However, considering that the

Wireless Communications and Mobile Computing
In order to verify the positioning effect of data collected at different time periods and data collected at fixed time periods, we adopted different time period collection methods and fixed time period collection methods in the improved WiFi location fingerprint positioning algorithm. The final cumulative error distribution function of the two collection methods is shown in Figure 11. It can be clearly seen from the figure that the positioning effect of the different time period collection method is better than the fixed time period collection method.

Comparison of Improved WiFi Location Fingerprint
Positioning Algorithm and Traditional WiFi Location Fingerprint Positioning Algorithm. The improved WiFi location fingerprint positioning algorithm in this paper has made a series of improvements on the basis of the traditional WiFi location fingerprint positioning algorithm. In order to verify the positioning effect of the improved algorithm, we carried out the experiment of the improved WiFi location fingerprint location algorithm and the experiment of the traditional WiFi location fingerprint location algorithm under the same experimental environment. The cumulative error distribution functions of the two algorithms are shown in Figure 12. It can be seen from the figure that the probability of the traditional WiFi location fingerprint positioning algorithm positioning error below 0.4 meters is 14%, and the improved WiFi location fingerprint positioning algorithm positioning error probability is 49% below 0.4 meters. The probability of positioning error within 0.4 meters is increased by 35% on the basis of traditional algorithms. In addition, the probability of the traditional WiFi location fingerprint positioning algorithm with a positioning error within 0.2 meters is 0, and the improved WiFi location fingerprint positioning algorithm with a positioning error within 0.2 meters has a probability of 39%. The probability of positioning error within 0.2 meters has increased by 39%.

Robot Navigation Experiment.
In order to verify the feasibility of the improved WiFi location fingerprinting algorithm for indoor positioning and navigation of the robot, we conducted several experiments in the absence of obstacles and with obstacles. It was found that the actual arrival position of the robot has a certain deviation from the given end position, which is caused by a certain error in positioning and the accumulation of errors during the robot navigation. The cumulative error distribution function of this deviation is shown in Figure 13. As can be seen from the figure, the performance of the cumulative error distribution for navigation is a little worse than that of the improved WiFi location fingerprint positioning algorithm. However, the probability that the error of navigation is within 0.8 m can reach 62%. Therefore, the improved WiFi location fingerprint localization algorithm is feasible to be applied to the navigation of the robot.

Conclusion
In this study, our main work is to make corresponding improvements to the traditional WiFi location fingerprint positioning algorithm, so that its positioning accuracy can meet the accuracy requirements of the robot's indoor positioning and navigation. In order to improve and optimize the traditional WiFi fingerprint positioning algorithm, we research and analyze which factors will affect the positioning accuracy of the traditional WiFi fingerprint positioning algorithm, and we have verified the influence of these factors on the positioning accuracy of the traditional WiFi fingerprint positioning algorithm through experiments. Based on these influencing factors, the traditional WiFi location fingerprint positioning algorithm has been improved as follows: the reference point spacing of the traditional algorithm is reduced, the WiFi signal is collected by the different time period collection method, the standardized processing method is used to construct the standardized location fingerprint database, the matching method using the Mahalanobis distance as the similarity reference is adopted, and the improved adaptive K-value WKNN algorithm is integrated. In addition, based on the improved WiFi location fingerprint positioning algorithm, we propose a grid navigation algorithm to achieve robot indoor navigation. The final experimental results show that the probability of positioning error within 0.4 m and 0.2 m of the improved positioning algorithm is 49% and 39%, respectively, which is 35% and 39% higher than that of the unmodified positioning algorithm. In addition, the probability of indoor navigation error within 0.8 meters can reach 62%. These experimental results are sufficient to show that the robot indoor positioning and navigation based on the improved WiFi location fingerprint positioning algorithm is feasible.

Data Availability
The data used to support the findings of this study are included within the article.

Conflicts of Interest
The authors declare that they have no conflicts of interest to report regarding the present study.