Improving Indoor Positioning With Adaptive Noise Modeling

Indoor positioning is important for applications within Internet of Things, such as equipment tracking and indoor maps. Inexpensive Bluetooth-beacons have become common for such applications, where the distance is estimated using the Received Signal Strength. Large installations require substantial efforts, either in determining the exact location of all beacons to facilitate lateration, or collecting signal strength data from a grid over all locations to facilitate fingerprinting. To reduce this initial setup cost, one may infer the positions using Simultaneous Location and Mapping. In this paper, we use a mobile phone equipped with an Inertial Measurement Unit, a Bluetooth receiver, and an Unscented Kalman Filter to infer beacon positions. Further, we apply adaptive noise modeling in the filter based on the estimated distance of the beacons, in contrast to using a fixed noise estimate which is the common approach. This gives us more granular control of how much impact each signal strength reading has on the position estimates. The adaptive model decreases the beacon positioning errors by 27% and the user positioning errors by 21%. The positioning accuracy is 0.3 m better compared to using known beacon positions with fixed noise, while the effort to setup and maintain the position of each beacon is also substantially reduced. Therefore, adaptive noise modeling of Received Signal Strength is a significant improvement over static noise modeling for indoor positioning.


I. INTRODUCTION
Within context awareness, knowing the position of a device is a crucial task. Outdoor positioning is usually handled adequately by GPS, but positioning a device indoors is challenging due to the inability of the Global Navigation Satellite Systems (GNSS) to penetrate buildings. When using wireless technologies in indoor environments, the signals get attenuated, scattered, or reflected; by walls, floors, and objects. The environment also changes when doors are open or closed, people move around, or furniture is rearranged. This makes radio-based indoor localization challenging.
There are several approaches to solve the indoor localization problem, where fingerprinting [1] is one approach. Fingerprinting records the signal strength associated with different Wi-Fi or Bluetooth transmitters at various locations and associates a measurement with the position of the closest The associate editor coordinating the review of this manuscript and approving it for publication was Liang Hu . match of the recorded data. Other methods include Multilateration, where several distance measurements to known reference positions are used for inferring the location, and triangulation, where the Angle-of-Arrival (AoA) between a transmitting device and two or more receivers gives the position. As AoA recently got support in the Bluetooth 5.1 standard [2], there are few commercially available devices based on this technology. Ultra WideBand (UWB) [3] is a promising new technology with high accuracy using Time of Arrival (ToA), but has not yet seen widespread use due to high cost. Yet another positioning method is Magnetic Local Positioning Systems (MLPS), such as [4], [5], where a calibrated sensor network of magnetic fields sensors are used for achieving positioning with high accuracy.
Multilateration can be achieved by measuring Time of Arrival (ToA) or inferring the distance by converting Received Signal Strength (RSS) to distance by applying an appropriate radio propagation model. Both multilateration and triangulation have in common that they require the VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ transmitters' positions to be known. In contrast, the fingerprinting approach requires good coverage of collected data for each position. Fingerprinting has shown good positioning accuracy in [6], [7], where they report an error of 90% respectively 70%, for the Cumulative Density Function (CDF) within 2 meters. Fingerprinting does not require knowledge of the position of the transmitting beacons as it is based on matching the current measurement to the closest match in a prerecorded database of RSS values. However, as the positioning accuracy is determined by the granularity of the database, creating such a database for all possible locations in a large building can be time-consuming and requires recalibration if the signal propagation conditions change.
Multilateration, as described in [8], has a CDF < 2 m of 57%. As this method does not consider the local radio propagation parameters, such as multi-path and fading in the environment, it is, on its own, not as accurate as fingerprinting. Cannizzaro [9] showed a median error or 3.3 m for multilateration, where fingerprinting had a median error of 1.33 m. To improve positioning accuracy, some authors combine the results from the fingerprinting or multilateration with Kalman filters [10], Particle filters [11], Graphs [12] or Neural Networks [13].
When deploying an indoor positioning system, one needs to consider parameters such as the total cost of the system, the longevity and complexity of an installation, and the amount of maintenance and robustness to changes in the configuration. A fingerprinting based system is accurate, but it requires sampling RSS measurements from different locations while tagging each position with the ground truth. The sampling needs to be repeated if there are significant changes to the environment, such as replacement of BLE-beacons or Wi-Fi access points, rearrangement of large office equipment, or rearrangement of interior walls. Multilateration based methods require knowledge of the beacon locations and knowledge about the radio propagation loss. However, the total amount of data collection needed is significantly less than for the fingerprinting approach.
For these reasons, we focus on improving the accuracy of multilateration-based systems. We show how to infer the beacon positions automatically using Simultaneous Location and Mapping (SLAM). Further, we introduce a novel method of modeling the measurement variance in an Unscented Kalman Filter (UKF), based on the signal strength measurements. We demonstrate how it improves the accuracy of the estimated beacon positions with 27%. Finally, by utilizing the variance estimates of the UKF, we visualize the spatial positional accuracy of the system, which can be used for quickly assessing the accuracy of a system during installation.

II. MATERIALS AND METHODS
Our approach uses the accelerometer of a mobile phone to estimate the distance walked by detecting steps. Gyroscope and Magnetometer sensor values from the phone are used to estimate the walking direction. The RSS of the Bluetooth beacons is used to infer both the path walked and the beacon positions using an Unscented Kalman Filter, where we apply an adaptive noise model to increase the accuracy.
In Section II-A we describe how the IMU measurements were made, in II-B we give a brief overview of a few Kalman Filter variants. Section II-C describes the path loss model used and Section II-D explains the experimental setup. We give an overview of the complete system in II-E, the Kalman filter setup in II-F, and finally, our adaptive noise model in II-G.

A. IMU PREPROCESSING
Our test device is a mobile phone containing an Inertial Measurement Unit (IMU), LSM6DSL/UCSP35L1; and Bluetooth Low Energy (BLE) receiver. The IMU has several sensors, but in our work, we focused on utilizing the accelerometer, compass and gyroscope. The phone was running Android OS v9. The sensor sample rate was set to 50 Hz. All sensor data is passed through individual 6 th -order Butterworth low-pass filters with a cut-off frequency of 3 Hz. Steps are detected by finding peaks in the l 2 -norm of the accelerometer data. The Android OS scan results of BLE beacons are reported in batches approximately every 1.1 s.
The traveled distance is approximated by linear interpolation of the counted steps at each point in time when new beacon data arrives. This information, together with the sensor values, are fed into the Kalman based tracking model.

B. KALMAN FILTERS
Kalman filters were first described in [14], and can be formulated as a way to estimate the state of a linear stochastic difference equation, by following the notation in [15] where we estimate the state x k ∈ R n by applying a state transition model A k on the previous state x k−1 , apply a controlinput model B k to a control vector u k , and then finally add process noise w k . Measurements z k ∈ R m are defined as H which is an m × n matrix, relates a state x k to the measurement, whereas v k represents the measurement noise. Both w k and v k are assumed to be independent and multivariate Gaussian distributed, with w k ∼ N (0, Q) and v k ∼ N (0, R).
To estimate the underlying state x k , we use an iterative Predict-Correct cycle, which is a five-step process given in Table 1.

1) EXTENDED KALMAN FILTERS
One limitation with the Kalman filter is that it assumes that the underlying process is linear. To remedy this, the Extended Kalman Filter (EKF) replaces the matrices A and B in the linear process (1) with a transition function f as and The functions are first order Taylor series expansions of the nonlinear process, and requires computation of the Jacobian of f .

2) THE UNSCENTED KALMAN FILTER
Calculating the Jacobian of a complex process can be problematic or even impossible if the function is not differentiable.
In 1995, Uhlmann [16] described a method for replacing the Jacobian with sigma points instead. Sigma points are carefully chosen and projected through the non-linear function, making it possible to estimate the Gaussian distribution of the state, as the mean and covariance of the sigma points follow the distribution of the function. An extension of this method, called the Unscented Kalman Filter (UKF), was published by Julier and Uhlmann in [17], [18]. In the UKF, f () and h() can be replaced with arbitrary functions without any requirements on being differentiable. The UKF can capture the mean and covariance of the posterior distribution up to the 3rd order Taylor series expansion, whereas the standard version of the EKF captures the first order [19]. This allows the UKF to better approximate a non-linear distribution compared to the EKF. The ability of the UKF to capture higher-order moments than the EKF, with the added benefit of allowing non-differentiable functions, makes it the preferred choice.
Choosing the sigma points of the UKF has no unique solution, but in the dissertation of van der Merwe [20], one way of choosing the sigma points is to first define where L is the dimension of the state and α, κ are constants. Then calculating the sigma points X becomes where α and β controls the spreading of the sigma points.
A good heuristic for the sigma points are κ = 3 − L and β = 2, as given in [18]. α is sometimes recommended to be set to 10 −3 , but often requires tuning to give a filter that is efficient for a specific task. Using these sigma points, we arrive at the full UKF predict-correct algorithm in Table 2.
As before, Q and R represents the process and measurement covariance matrices, f predicts the next state based on the current state and control, and h maps the state to observations.

C. PATH LOSS MODEL
As the BLE signals propagate, the signal strength is reduced, caused by both energy loss and reflections leading to self cancelling. As path loss model, we use the common Log distance Path loss model [21] that was empirically validated in [22]P whereP RX (d) is the received power in dB at distance d, PL 0 is the path loss at the reference distance (1 m), η is constant depending on the environment and is Gaussian distributed variable with zero mean. Solving for d, and assuming d 0 = 1.0m However, due to shadowing, captured by the term, the distance estimate is not deterministic. A stochastic model of the distance isd rnd = d 0 10 . σ is the measured noise in dB. From this we can see that the mean error is negative [23], resulting in a positive bias in the estimate ofd rnd that is distancedependent. We also see that the variance is increasing over distance, an important fact that we will use in our adaptive filter.

D. EXPERIMENTAL SETUP
The experiments were conducted in an indoor office environment. In Figure 1 we see the beacon positions. The 21 independent BLE-beacons placed in the ceiling are broadcasting their unique ID every 2 seconds. As each beacon is broadcasting their ID, we avoid data association problems, which is common in SLAM setting [24]. The experiments begin with the test subject standing immediately below beacon id:2.
A mobile phone is used as a data collection device, which the subject holds in front of themselves while walking. The screen is kept perpendicular to the floor during the experiment to remove the need for phone orientation compensation of the gyroscope and magnetometer. Then the subjects walk  a predefined path three times while continuously sampling data. There are no annotations in the data collection exactly when the user passes the point of origin; neither will the algorithm attempt any loop closing to merge the different laps. Although repeated laps are not needed for the actual positioning of the user or the beacons, this allows for evaluation of accuracy over time. The predefined path has a diverse radio environment, with a mix of areas that are open to both the lower and upper floors; office environment with furniture, and narrow paths with thick walls. The data is gathered on the handheld device and then analyzed off-line once the path is completed.

E. ANALYTICAL PIPELINE
As shown in the data flow (Figure 2), the gathered accelerometer data is used to estimate the distance walked. A rough estimate of 0.8 m as stride length is used, based on the height of the test subject. The accelerometer data is low-pass filtered with a 6 th order Butterworth filter with a 3 Hz stop frequency, as human walking step frequency is below that [25]. The gyroscope and magnetometer data are low-pass filtered with a similar 6 th order Butterworth with stop frequency of 0.4 Hz, as the walking direction is expected to change with low frequency. Every time new RSS data are collected by the system, which is ≈ 1.1 s between, it is fed through the Unscented Kalman filter together with magnetometer and gyroscope data.

F. KALMAN FILTER CONFIGURATION
As initialization parameters for the filter, we used x = [longitude, latitude, θ] T = [0, 0, 0] T . As we create our coordinate system, we know that we are starting at position (x, y) = (0, 0). The azimuth is set to 0 • before we have any magnetometer readings, but it is not important to set this correctly as it will be updated by the filter. Each observation is z = [d,θ] T , where d is the estimated distance to a BLE beacon in meters, based on the measured RSS value.θ is the estimated heading based on the magnetometer readings. The covariance matrix at the start was set to P 0 = diag(0.1, 0.1, 0.1) which states that we are confident in our starting position. The observation noise covariance has fairly high values, where we assume that the errors of the distance measurements are Gaussian distributed with N (d, 14 2 ), and the angular measurement errors are Gaussian distributed with N (0, ( π 6 ) 2 ). The measurement covariance matrix R is set to R = The low values of the process noise Q, can be interpreted as high confidence in our process model to capture the movement of the user. The measurement noise R can be directly calculated from sensor inputs, in our case, beacon distances and magnetometer readings. In section II-G we will further improve R. Our control input u is a vector with where vel is the current velocity which is inferred from the step frequency and β is the angular change measured by the gyroscope. The State transition function is defined as where t is the time since the last iteration. The Observation function is defined as where l 1 . . . l N ∈ L which is the set of observed beacons with longitude and latitude, x pos is the latitude and longitude for the device and θ is the heading measurement by the magnetometer.

G. ADAPTIVE NOISE MODEL
RSS measurements are affected by both path loss of the signal, sensitivity in the receiver, and differences in the radio transmitters. Various phone models may differ up to 6 dBm [26]. To illustrate the RSS measurement noise, we set up a separate experiment where we sampled RSS values from 12 tags of the same model that was mounted in the ceiling at different locations. The measuring phone was stationary. As shown in Figure 3, the beacons have high variance in the measurements, with some beacons varying with a σ close to 5 dBm. There are also outliers with RSS values more than 10 dBm away from the median. To illustrate the effect of the path loss exponent η and the RSS measurement variance σ 2 , we assume that is a zero-mean Gaussian, giving d =

10
PL 0 −P RX − 10η . The Figure 4 shows the theoretical distance estimates derived from this model. The conclusion is that even in this favorable case, where we sample more than 30 values for each beacon and keep both the beacons and the measuring device stationary, it is still challenging to infer the distance from the RSS values. To model the uncertainty of the RSS measurements, we want to apply our path loss model from Equation 8.
Lower RSS values result in higher uncertainty of the distance d. Hence, given the significant level of distance and shadowing dependent noise, we suggest using an adaptive covariance in the Unscented Kalman Filter. We apply our improved covariance estimate by replacing our previous R with the Equation 9 we also compensate the RSS-to-distance estimates as in [23] III.

RESULTS
When solving a SLAM problem, it is common to evaluate the result based on the estimated path traveled versus ground VOLUME 8, 2020  truth, with less emphasis on the landmark (beacon) accuracy. However, in our case, we are more interested in two other metrics: (1) the ability of a deployed system to correctly identify the landmark positions, and (2) the ability to express the amount of uncertainty the system has regarding beacon positions in an installation. We measure (1) using the L 2 -norm as ||l i −l i || 2 , where l i is the real position of the i landmark detected andl i is the estimated position. We achieve (2) by simulating the expected RSS measurements at different positions using the covariance matrix for the estimated landmark positionl i .

A. BEACON POSITIONING ACCURACY
In Figure 4, we see that the distance estimate in the Log Distance Path Model is dependent on an environment parameter η. This parameter is usually in the range 1.8 ≤ η ≤ 3.0 [21], [27], depending on how much obstruction the signals have. We use Tree Parzen Estimators (TPE) [28] to estimate the parameters. At first, we only optimized the RMSE of the beacon positions, but this gave unsatisfactory results of the UKF filtered path. Part of this is caused by beacons that are far away or only had a few measurements affecting the optimization. To remedy this, we gave equal balance to the Root Mean Squared Error (RMSE) of the filtered path vs. ground truth, and the RMSE of the beacon locations. Using the combined weights, the result was a σ ≈ 3.2 and η ≈ 2.4. The contour plot in Figure 5 shows the RMSE for different σ and η. The estimated errors in beacon position estimates can be seen in Figure 6a. In Figure 6b we see that ≈ 50% of the beacons are within 5 m using adaptive noise, whereas the corresponding fixed noise model is 9 m.

B. USER POSITIONING ACCURACY
Although identifying the actual beacon positions is the main objective, the increased accuracy of the beacon estimates also improves the filtered path in Figure 7. The RMSE of the user path improved from 2.8 m to 2.2 m when using the adaptive filter, as can be seen in Table 3. In fact, the RMSE of the adaptive filter with unknown beacon locations is close to the one with known beacon locations, with a difference of only 0.4m.

C. RADIO COVERAGE PREDICTION
By having variance estimates of the beacon locations, we can estimate how the uncertainty of beacon location estimates affects the positional accuracy when running multilateration. We sample 300 random positions over the map. For each sampled user position, we generate beacon positions drawn from the mean and variance of the previously computed matrices x and P. Then we calculate what the distance estimates would be between the sampled position and the generated beacon positions. These distances are then used to estimate the position using multilateration. The RMSE between the actual and inferred positions are contour plot in Figure 8. The contour plot shows that we have higher positional accuracy in the area close to the path we walked during the data collection.
In cases where beacons are placed in a narrow corridor, these will have much higher RSS values along the corridor, due to reflections, than one placed in free space. These beacons will have a high variance in the P matrix in the UKF filter.
High RMSE values indicate that either the beacon location estimates have high variance, or that the beacons are too far away from the specific location in the map. This can be  addressed by collecting more data from high RMSE locations. In locations where more data does not lower the RMSE in the area, more beacons should be installed.

IV. DISCUSSION
In this article, we have used a mobile phone with an IMU and BLE capabilities to successfully locate BLE beacons while walking around in an indoor environment. By adaptive modeling of the noise in the RSS measurements, 50% of the beacons had positional errors ≤ 5 m, whereas the fixed noise model error was ≤ 9 m for the same amount of beacons. As can be seen in Figure 7, the adaptive noise model also results in a more stable and accurate estimate of the user trajectory while at the same time locating the beacons. The adaptive noise model is also converging faster, and the second and third loops are very close.
Being able to locate beacons in a previously unseen environment allows us to improve position estimates of the device through passive sensing means. No data needs to be uploaded from the device to a 3rd party to enable indoor location, which is a good thing from a privacy perspective. If a user chooses to enable uploading of some data, such as beacon location and variance estimates, an area can be covered by merging location estimates from the participating devices.
To be able to infer beacon locations, we must adjust parameters that are both dependent on the user and the environment. User dependent parameters are step length and radio receiver characteristics. Instead of inferring the step length from the height of a person, an improvement would be to use a model that estimates the step length from the walking dynamics, as in [29], [30]. To further improve the step and distance estimates, a possibility is to use a foot-mounted sensor, as in [31], where they achieved a distance estimation error of less than 1%. The radio receiver characteristics should also be accounted for, e.g., by adjusting the relative sensitivity of the receiver or creating device-specific models for BLE ranging estimates as in [26].
Environment dependent parameters are η and σ , which models the path loss and variance. These will differ depending on location in the building, which is one reason why RSS fingerprinting has higher accuracy than multilateration, at the cost of doing many measurements. The UKF allows for some degrees of adaptivity, as the covariance matrix of the filter includes horizontal and vertical variance estimates for each beacon. The result is that beacons mounted in open space, with a clear line of sight, will have lower variance and thus higher weight in the filter. Beacons that are often obstructed, such as when mounted in corridors or near corners, will have higher variance and thereby lower weight in the filter. Our adaptive noise modeling enables the UKF to increase the weight on measurements from nearby beacons. The results show that adaptive noise modeling of the RSS is a significant improvement over static noise modeling when deploying an indoor positioning system based on BLE beacons. In addition, if we choose to use the adaptive noise model together with beacon location estimation, we can estimate the radio coverage of the model, as in Figure 8. This visualization is very useful for optimizing an installation as it is obvious where we either need to collect more data or install more beacons. This paper focused on adaptive filtering based on a radio propagation model where we made the measurement noise variance, R, adaptive. There are other approaches for more general adaptivity of both process and measurement noise. A method for online adaption of Kalman filter parameters Q and R was described by Mehra [32] already 1970. More recently, Zheng et al. [33] with their Robust Adaptive UKF (RAUKF), adjust the process noise, Q, and the measurement noise, R when a fault detection mechanism passes a certain threshold. A possible approach in future work would be to combine a general adaptive model, such as the RAUKF, with a radio propagation model to mitigate differences in receiver sensitivity between devices.
Moving from a single experimental setup to full adaptivity in new environments is a challenge. Some methods have been mentioned above, such as adaptive step lengths and device modeling of receiver sensitivity. Other areas that could be explored are map-matching and combining estimates from many users. Given that fingerprinting often has higher accuracy than multilateration, an interesting concept would be using the UKF for online learning of location radio fingerprints from users without requiring a slow and resourcedemanding installation procedure.