## 2 Proposed Position Tracking System Based on Composite Sensors
### UWB Positioning Algorithm  
The two-way ranging (TWR) method [12; 13; 14] was developed to calculate the distance between two nodes by measuring the turnaround time of a pulse transmitted between the two nodes in which an Anchor node (Node 1) sends the pulse to a Tag node (Node 2) that transmits the pulse back to Node 1, and then by subtracting the processing time at Node 2, as shown in Figure 2.  
In general, the moving distance of light is calculated by multiplying the speed of light \(c=3\times 10^{8}\) m/s and the measured time; thus, the distance between an anchor and a tag is expressed as \(d\) and  
\[d=c\times TOF \tag{8}\]  
where \(TOF\) (Time of Flight) is  
\[TOF=\frac{t_{\text{total}}-t_{\text{r}}}{2}=\frac{(t_{2}-t_{1})-t_{\text{r}}} {2}. \tag{9}\]  
as shown in Figure 3. Here, \(TOF\) represents the time required for a signal to be transmitted between an anchor. It is calculated by \(TOF\) and is calculated by time stamps \(t_{1}\) of Tx and \(t_{2}\) of Rx and the response time \(t_{\text{r}}\). In addition, \(t_{\text{r}}\) refers to the time required for a tag (Node 2) that has received the pulse signal to transmit the signal back. The TWR method has the advantage of simplifying the system through accurate positioning without synchronizing the nodes. Such wireless communication-based distance measurement is difficult to accurately recognize positions when the distance errors occur due to obstacles or changes in the indoor environment. Typical trilateration localization methods to reduce the distance measurement error can be used by topology [15], probability [16], confidence [17], and geographical similarity [18]. We used the confidence-based distance compensation trilateration localization method [17] to calculate the distance between 3 anchors and a target tag. Firstly, we selected the fixed positions of 3 anchors: \(\{(x_{i},y_{i})|i\in[1,\,3]\}\). The distances \(\{d_{i}|i\in[1,\,3]\}\) between 3 anchors and a tag can be computed by TOFs in Equation (1) and they satisfy the condition; \((x_{i}-x_{t})^{2}+(y_{i}-y_{t})^{2}=d_{i}^{2}\) for all \(i\in[1,\,3]\). Here, the intersection points \(\left(x_{ij}^{+},y_{ij}^{+}\right)\), \(\left(x_{ij}^{-},y_{ij}^{-}\right)\) for the \(i\)th anchor and \(j\)th anchor can be derived from the simultaneous equation. \[\left\{ \begin{array}{l}(x_{i}-x_{t})^{2}+(y_{i}-y_{t})^{2}=d_{i}^{2}\\ (x_{j}-x_{t})^{2}+\left(y_{j}-y_{t}\right)^{2}=d_{j}^{2}\end{array} \right. \tag{10}\]  
and  
\[\left\{ \begin{array}{l}x_{ij}^{+}=\frac{ab+\varepsilon_{i}}{1+a^{2}},\,x_{ij}^{ -}=\frac{ab-\varepsilon_{i}}{1+a^{2}}\\ y_{ij}^{+}=\frac{b+a\varepsilon_{i}}{1+a^{2}},\,y_{ij}^{-}=\frac{b-a \varepsilon_{i}}{1+a^{2}}\end{array} \right. \tag{11}\]  
where \(\varepsilon_{i}=\sqrt{a^{2}b^{2}-(1+a^{2})\big{(}b^{2}-d_{i}^{2}\big{)}}\). \(a\) and \(b\) are defined by  
\[a=\frac{x_{j}-x_{i}}{y_{j}-y_{i}} \tag{12}\]  
\[b=\frac{\big{(}x_{j}-x_{i}\big{)}^{2}+\big{(}y_{j}-y_{i}\big{)}^{2}-\Big{(}d_{ j}^{2}+d_{i}^{2}\Big{)}}{2\big{(}y_{j}-y_{i}\big{)}}. \tag{13}\]  
The distance \(d\) of an anchor and a tag is updated to the new distance \(d^{*}\) by the Cramer-Rao lower bound (CRLB) \(J\) of TOF estimate and the confidence interval \(\triangle d\). \[d^{*}=d+\triangle d \tag{14}\]  
where  
\[\triangle d=1.96J/\sqrt{N},\,\,(N=3) \tag{15}\]  
Given the positions of 3 anchors \(\{(x_{i},y_{i}),\,(x_{j},y_{j}),(x_{k},y_{k})\}\), radii \(\{r_{i},r_{j},r_{k}\}\) of circles of them, and intersection points \((x_{ij}^{+},y_{ij}^{+}),\,(x_{ij}^{-},y_{ij}^{-})\) of \(i,j\) anchors in Equation (4), the optimal intersection point \((x_{ij}^{*},y_{ij}^{*})\) can be selected by the following inequality equation. \[\left\{ \begin{array}{l}(x_{ij}^{+},y_{ij}^{+})=(x_{ij}^{*},y_{ij}^{*}),\, \,\text{if}(d_{k}-\sqrt{\big{(}x_{ij}^{+}-x_{k}\big{)}^{2}+\big{(}y_{ij}^{+}- y_{k}\big{)}^{2}})^{2}<(d_{k}-\sqrt{\big{(}x_{ij}^{-}-x_{k}\big{)}^{2}+ \big{(}y_{ij}^{-}-y_{k}\big{)}^{2}})^{2}\\ (x_{ij}^{-},y_{ij}^{-})=(x_{ij}^{*},y_{ij}^{*}),\,\text{otherwise}\end{array} \right.