The graph optimization method for a general least square cost function is described in the previous subsection. Here we focus on forming the cost function for BLE beacon implementation using the constraints from PDR, beacon-based range constraints and fingerprint-based constraints.
3.2.2. Error Terms for PDR-Based Constraints
As mentioned before, the pose variable
here has three components
, which are the coordinate positions and the heading. From the PDR algorithm, the pose changes can be “observed” and can be written as
where
and
are the “observed” stride length and heading change, respectively. As mentioned before, the error term for PDR-based constraints is dependent on adjacent pose variables
,
and the “observed” stride length
and heading change
(components of
). We write it as
where the
,
and
are the components taken from the pose variable
. Then the sum of the square error terms derived from PDR constraints can be written as
where the error term
is from Equation (
15). The matrix
can be considered as a weighting matrix for the square error term. Normally, if the “observation” from the PDR results is accurate, the weighing matrix should be larger and thus making the square error term more significant in the overall cost function. In graph optimization, the weighting matrix is the inverse matrix of the noise variance. This also holds true for other types of error terms. The weighting matrix
is a
matrix and here it is:
here we consider the noise variance of the step length is 0.5 m
and the noise variance of heading is 0.1 rad
for each step in PDR.
To start the optimization, the initial values of the pose variable is considered the estimated poses from the PDR algorithm. If only one type of constraints (PDR-based constraints) exist in the cost function, the optimal poses should be the initial poses. In such a situation, the cost function is zero.
3.2.3. Error Terms for Beacon Position Constraints
As mentioned before, the RSSI readings from BLE beacons have fast fading nature. Therefore, in our implementation, a pre-processing procedure is added to smooth the RSSI. Here the median value of the RSSI from a beacon within a time window (with duration 1 s) is taken as the current RSSI.
To estimate the distance from a beacon, a path-loss model is needed. Here we adopt the path-loss model in [
23],
where parameter
A is the absolute RSSI value represented by dBm at 1 m away from the beacon;
n is a parameter related to the signal propagation environment and
d is the distance from the beacon. In our implementation, we use the method proposed in [
9] to estimate the parameters.
The path-loss model with pre-defined parameter in our implementation is
An issue worth noting is that the model will be inaccurate when readings are higher than 0 dBm. However, we have checked our measurements and we have found out that none of RSSI readings are higher than 0 dBm. In our implementation, the BLE beacons adopted have the largest emitting power of 4 dBm and it is set to 4 dBm here. The reason maybe that, in the experiments, the beacons are installed on the walls and the person does not go too near to the walls.
Here we only use the RSSI if it is larger than −100 dBm. A simple experiment is performed to explain the reasons. In an indoor corridor, the user holding the receiver starts from a place far away from the beacon, walks near the beacon, and then leaves. The RSSI readings are shown in
Figure 5. We can see that the RSSI readings at lowest are a bit lower than −100 dBm (in this case, it is −105 dBm). This corresponds to the situation that the user is far away from the beacon, and the signal is buried in noise. In our implementation, we consider −100 dBm as the sensitivity of the receiver and RSSI readings smaller than −100 dBm (though seldomly seen) are discarded.
Assuming a RSSI reading for the
beacon is available at the
step. From the path-loss model, a distance
can be derived from Equation (
19). Then the error term derived from range-based constraint should be dependent on the pose variable
, the beacon position variable
and the derived distance
. It can be written as
where
and
are taken from the components in the pose variable
;
and
are taken from the beacon position variable
. Then the sum of square error terms derived from path-loss model and RSSI readings can be written as
where the sum is over all available ranges derived from RSSI readings. Again,
is the weight of the range-based square errors.
is a scaler 1/5 and we consider the noise variance in range estimation is 5 m
.
Another importance thing worth noting is that the initial values for the beacon position variables is needed to start the optimization. Here we consider no heuristic information about the beacons are available including the number of beacons and their positions. To start the optimization with initial guess of the beacon positions, we assume the initial beacon positions are at the poses from the PDR results when the beacons’ RSSI are available for the first time.
3.2.4. Error Terms for Fingerprint Matching Constraints
For fingerprinting-based positioning using BLE beacon, an RFM should be established in the offline phase. The RFM consists of many fingerprints collected at different known positions. In our implementation, the user walks in the area collecting fingerprints. The optimal poses can provide the position estimations in the RFM.
In fingerprinting-based BLE positioning method, the distances between fingerprints can indicate the correlations for the positions. If two fingerprints are similar (with small distance), then the positions where the fingerprints are collected should be also with small distance (high correlation). We also use the mentioned feature for generating constraints through fingerprint matching. For such purposes, the distance metric is defined firstly according to [
24],
where the subscripts denote two different RSSI readings;
is the
component in the vector
;
N is the number of the beacons. Two RSSI vectors may have readings from different beacons. In this case, we add default readings to the RSSI vector such that both vectors have readings from the same beacon set. Here the beacon set denotes the union set of the two original beacon sets. An example is shown in
Figure 6, where the original
and
have three and two components, respectively. After completion, they both become a 4-component vector with readings from the same beacons. The added default RSSI reading is set to −120 dBm in our implementation.
Assuming the two RSSI readings
and
correspond to the pose variables
and
respectively. The distance
between the RSSI readings can be calculated according to Equation (
22). If the RSSI distance is less than a threshold
indicating high correlation on the corresponding positions, the error term of fingerprint matching-based constraint exists. The error term is
where
is the position distance calculated from the pose variables and .
and are the two position distance thresholds. If the position distance is less than , then the error should be 0, because we allow some position differences for high correlation poses. If the position distance is larger than , the error is considered to reach an upper bound .
If the position distance is between the two position thresholds, the error grows linearly with the position distance .
The thresholds for fingerprint-based constraints in our implementation are in
Table 1. Noting that the choice of these thresholds is similar to the implementation in [
25], where the RSSI are from Wi-Fi APs. This set of parameters also works fine in our implementation. We will perform an exhaustive search for the optimal parameters in the future.
Then the sum of square error terms derived from fingerprint matching can be written as
where the sum is over any two pose indexes whose fingerprint matches. Again,
is the weight to control the error significance.
is again a scaler 1/10 and we consider the noise in fingerprinting matching is 10 m
.
Then the overall cost function is the sum of the three types of constraints.