# Extended Kalman Filter Design for Tracking Time-of-Flight and Clock Offsets in a Two-Way Ranging System

^{*}

## Abstract

**:**

## 1. Introduction

#### 1.1. System Overview

#### 1.2. Contributions

- We derive a family of optimal extended Kalman filter (EKF) tracking algorithms that jointly estimate time-of-flight and clock offsets in a two-way ranging network.
- We implement the proposed EKF solutions and the corresponding optimal one-shot estimators in a simple MATLAB simulation environment.
- We demonstrate that the proposed solution achieves comparable estimation performance to the existing one-shot solutions and, in the case of the second-order solution, reduces the computation time by an order of magnitude.

#### 1.3. Organization

## 2. Background

#### 2.1. Clock Synchronization

#### 2.2. Statistical Clock Models

## 3. Problem Formulation

#### 3.1. Problem Setup

#### 3.2. Timing Exchange Protocol

## 4. Optimal One-Shot Estimators

#### 4.1. First-Order Models

#### 4.2. Second-Order Models

## 5. Extended Kalman Filter Tracking

#### 5.1. Tracking Preliminaries

Algorithm 1: Extended Kalman Filter Tracking Algorithm |

- 1:
**while**flight duration**do**- 2:
- ${\scriptstyle {\widehat{\mathbf{x}}}_{(-)}^{(n-1)}\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}\mathbf{F}\left({L}_{A}^{(n-1)}\right)\phantom{\rule{0.222222em}{0ex}}{\widehat{\mathbf{x}}}^{(n-3)}}$
- 3:
- ${\scriptstyle {\widehat{\mathbf{P}}}_{(-)}^{(n-1)}\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}{\mathbf{F}}^{(n-1)}{\widehat{\mathbf{P}}}^{(n-3)}{{\mathbf{F}}^{(n-1)}}^{T}+{\mathbf{Q}}^{(n-1)}}$
- 4:
- ${\scriptstyle {\widehat{\mathbf{z}}}_{(-)}^{(n-1)}\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}{\mathbf{u}}^{(n-1)}+\mathbf{h}\left({\widehat{\mathbf{x}}}_{(-)}^{(n-1)}\right)}$
- 5:
- ${\scriptstyle {\mathbf{H}}^{(n-1)}\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}{\left.\frac{\partial \mathbf{h}\left(\widehat{\mathbf{x}}\right)}{\partial \widehat{\mathbf{x}}}\right|}_{{\widehat{\mathbf{x}}}_{(-)}^{(n-1)}}}$
- 6:
- ${\scriptstyle {\mathbf{S}}^{(n-1)}\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}{\mathbf{H}}^{(n-1)}{\widehat{\mathbf{P}}}_{(-)}^{(n-1)}{{\mathbf{H}}^{(n-1)}}^{T}+{\mathbf{R}}^{(n-1)}}$
- 7:
- ${\scriptstyle {\widehat{\mathbf{z}}}_{(-)}^{(n-1)}\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}{\mathbf{u}}^{(n-1)}+\mathbf{h}\left({\widehat{\mathbf{x}}}_{(-)}^{(n-1)}\right)}$
- 8:
- ${\scriptstyle {\mathbf{K}}^{(n-1)}\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}{\widehat{\mathbf{P}}}_{(-)}^{(n-1)}{{\mathbf{H}}^{(n-1)}}^{T}{{\mathbf{S}}^{(n-1)}}^{-1}}$
- 9:
- ${\scriptstyle {\widehat{\mathbf{x}}}^{(n-1)}\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}{\widehat{\mathbf{x}}}_{(-)}^{(n-1)}+{\mathbf{K}}^{(n-1)}({\mathbf{z}}^{(n-1)}-{\widehat{\mathbf{z}}}_{(-)}^{(n-1)})}$
- 10:
- ${\scriptstyle {\widehat{\mathbf{P}}}^{(n-1)}\phantom{\rule{0.166667em}{0ex}}=\phantom{\rule{0.166667em}{0ex}}({\mathbf{I}}_{|\mathbf{x}|}-{\mathbf{K}}^{(n-1)}{\mathbf{H}}^{(n-1)}){\widehat{\mathbf{P}}}_{(-)}^{(n-1)}}$
end |

#### 5.2. First-Order Extended Kalman Filter

#### 5.3. Second Order Models

## 6. Simulation Results

#### 6.1. Simulated Computation Time

#### 6.2. Simulated Time Delay Estimation Performance

**Figure 4.**(

**a**) True time of flight and radial velocity, (

**b**,

**c**) existing first- and second-order one-shot estimators [9], labeled STP1 and STP2, respectively, and (

**d**,

**e**) our proposed first- and second-order extended Kalman filter estimators labeled EKF1 and EKF2, respectively.

#### 6.3. Simulated Time Offset Estimation Performance

**Figure 5.**(

**a**) True time offset and drift, (

**b**,

**c**) existing first- and second-order one-shot estimators [9] labeled STP1 and STP2, respectively, and (

**d**,

**e**) our proposed first- and second-order extended Kalman filter estimators labeled EKF1 and EKF2, respectively.

## 7. Conclusions

## Author Contributions

## Funding

## Data Availability Statement

## Conflicts of Interest

## Abbreviations

AoA | angle of arrival |

EKF | extended Kalman filter |

FANET | flying ad hoc network |

GPS | Global Positioning System |

IoT | Internet of Things |

ITS | intelligent transport system |

LoS | line of sight |

NTP | Network Timing Protocol |

RMSE | root mean square error |

RSS | received signal strength |

TDoA | time difference of arrival |

ToA | time of arrival |

ToF | time of flight |

TWR | two-way ranging |

UAV | unmanned aerial vehicle |

WSN | wireless sensor network |

## References

- Paul, B.; Chiriyath, A.R.; Bliss, D.W. Survey of RF communications and sensing convergence research. IEEE Access
**2017**, 5, 252–270. [Google Scholar] [CrossRef] - Chiriyath, A.R.; Paul, B.; Jacyna, G.M.; Bliss, D.W. Inner bounds on performance of radar and communications co-existence. IEEE Trans. Signal Process.
**2015**, 64, 464–474. [Google Scholar] [CrossRef] - Chiriyath, A.R.; Paul, B.; Bliss, D.W. Radar-Communications Convergence: Coexistence, Cooperation, and Co-Design. IEEE Trans. Cogn. Commun. Netw.
**2017**, 3, 1–12. [Google Scholar] [CrossRef] - Herschfelt, A.; Yu, H.; Wu, S.; Lee, H.; Bliss, D.W. Joint Positioning-Communications System Design: Leveraging Phase-Accurate Time-of-Flight Estimation and Distributed Coherence. In Proceedings of the 2018 52nd Asilomar Conference on Signals, Systems, and Computers, Pacific Grove, CA, USA, 28–31 October 2018; pp. 433–437. [Google Scholar]
- Herschfelt, A.; Yu, H.; Wu, S.; Srinivas, S.; Li, Y.; Sciammetta, N.; Smith, L.; Rueger, K.; Lee, H.; Chakrabarti, C.; et al. Joint positioning-communications system design and experimental demonstration. In Proceedings of the 2019 IEEE/AIAA 38th Digital Avionics Systems Conference (DASC), San Diego, CA, USA, 8–12 September 2019; pp. 1–6. [Google Scholar]
- Shepard, D.P.; Bhatti, J.A.; Humphreys, T.E.; Fansler, A.A. Evaluation of smart grid and civilian UAV vulnerability to GPS spoofing attacks. In Proceedings of the 25th International Technical Meeting of the Satellite Division of The Institute of Navigation, Nashville, TN, USA, 17–21 September 2012. [Google Scholar]
- Humphreys, T. Statement on the Vulnerability of Civil Unmanned Aerial Vehicles and Other Systems to Civil GPS Spoofing; University of Texas at Austin: Austin, TX, USA, 2012; pp. 1–16. [Google Scholar]
- Kerns, A.J.; Shepard, D.P.; Bhatti, J.A.; Humphreys, T.E. Unmanned aircraft capture and control via GPS spoofing. J. Field Robot.
**2014**, 31, 617–636. [Google Scholar] [CrossRef] - Srinivas, S.; Herschfelt, A.; Bliss, D.W. Joint positioning-communications system: Optimal distributed coherence and positioning estimators. In Proceedings of the 2019 53rd Asilomar Conference on Signals, Systems, and Computers, Pacific Grove, CA, USA, 3–6 November 2019; pp. 317–321. [Google Scholar]
- Sayed, A.H.; Tarighat, A.; Khajehnouri, N. Network-based wireless location: Challenges faced in developing techniques for accurate wireless location information. IEEE Signal Process. Mag.
**2005**, 22, 24–40. [Google Scholar] [CrossRef] - Gustafsson, F.; Gunnarsson, F. Mobile positioning using wireless networks: Possibilities and fundamental limitations based on available wireless network measurements. IEEE Signal Process. Mag.
**2005**, 22, 41–53. [Google Scholar] [CrossRef] - Gezici, S. A survey on wireless position estimation. Wirel. Pers. Commun.
**2008**, 44, 263–282. [Google Scholar] [CrossRef] - Liu, H.; Darabi, H.; Banerjee, P.; Liu, J. Survey of wireless indoor positioning techniques and systems. IEEE Trans. Syst. Man, Cybern. Part C (Appl. Rev.)
**2007**, 37, 1067–1080. [Google Scholar] [CrossRef] - Patwari, N.; Ash, J.N.; Kyperountas, S.; Hero, A.O.; Moses, R.L.; Correal, N.S. Locating the nodes: Cooperative localization in wireless sensor networks. IEEE Signal Process. Mag.
**2005**, 22, 54–69. [Google Scholar] [CrossRef] - Mesmoudi, A.; Feham, M.; Labraoui, N. Wireless sensor networks localization algorithms: A comprehensive survey. arXiv
**2013**, arXiv:1312.4082. [Google Scholar] [CrossRef] - Guvenc, I.; Chong, C.C. A survey on TOA based wireless localization and NLOS mitigation techniques. IEEE Commun. Surv. Tutorials
**2009**, 11, 107–124. [Google Scholar] [CrossRef] - Lanzisera, S.; Zats, D.; Pister, K.S. Radio frequency time-of-flight distance measurement for low-cost wireless sensor localization. IEEE Sensors J.
**2011**, 11, 837–845. [Google Scholar] [CrossRef] - Weiss, A.; Weinstein, E. Fundamental limitations in passive time delay estimation–Part I: Narrow-band systems. IEEE Trans. Acoust. Speech Signal Process.
**1983**, 31, 472–486. [Google Scholar] [CrossRef] - Bidigare, P.; Madhow, U.; Mudumbai, R.; Scherber, D. Attaining fundamental bounds on timing synchronization. In Proceedings of the 2012 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Kyoto, Japan, 25–30 March 2012; pp. 5229–5232. [Google Scholar]
- Lewandowski, W.; Thomas, C. GPS time transfer. Proc. IEEE
**1991**, 79, 991–1000. [Google Scholar] [CrossRef] - Lewandowski, W.; Azoubib, J.; Klepczynski, W.J. GPS: Primary tool for time transfer. Proc. IEEE
**1999**, 87, 163–172. [Google Scholar] [CrossRef] - Sivrikaya, F.; Yener, B. Time synchronization in sensor networks: A survey. IEEE Netw.
**2004**, 18, 45–50. [Google Scholar] [CrossRef] - Ganeriwal, S.; Kumar, R.; Srivastava, M.B. Timing-sync protocol for sensor networks. In Proceedings of the 1st International Conference on Embedded Networked Sensor Systems, Los Angeles, CA, USA, 5–7 November 2003; pp. 138–149. [Google Scholar]
- Li, Q.; Rus, D. Global clock synchronization in sensor networks. IEEE Trans. Comput.
**2006**, 55, 214–226. [Google Scholar] - Schenato, L.; Gamba, G. A distributed consensus protocol for clock synchronization in wireless sensor network. In Proceedings of the 2007 46th IEEE Conference on Decision and Control, New Orleans, LA, USA, 12–14 December 2007; pp. 2289–2294. [Google Scholar]
- Maggs, M.K.; O’keefe, S.G.; Thiel, D.V. Consensus clock synchronization for wireless sensor networks. IEEE Sensors J.
**2012**, 12, 2269–2277. [Google Scholar] [CrossRef] - Mills, D.L. Internet time synchronization: The network time protocol. IEEE Trans. Commun.
**1991**, 39, 1482–1493. [Google Scholar] [CrossRef] [Green Version] - Mills, D. Network Time Protocol (version 3) Specification, Implementation and Analysis. Technical Report, Internet Society. 1992. Available online: https://www.rfc-editor.org/rfc/rfc1305 (accessed on 15 May 2023).
- Eidson, J.; Lee, K. IEEE 1588 standard for a precision clock synchronization protocol for networked measurement and control systems. In Proceedings of the Sensors for Industry Conference, 2002. 2nd ISA/IEEE, Reston, VA, USA, 3–5 December 2002; Volume 10. [Google Scholar]
- Sichitiu, M.L.; Veerarittiphan, C. Simple, accurate time synchronization for wireless sensor networks. In Proceedings of the 2003 IEEE Wireless Communications and Networking, 2003. WCNC 2003, New Orleans, LA, USA, 16–20 March 2003; Volume 2, pp. 1266–1273. [Google Scholar]
- Van Greunen, J.; Rabaey, J. Lightweight time synchronization for sensor networks. In Proceedings of the 2nd ACM international conference on Wireless sensor networks and applications, San Diego, CA, USA, 19 September 2003; pp. 11–19. [Google Scholar]
- Brown III, D.R.; Klein, A.G.; Wang, R. Non-Hierarchical Clock Synchronization for Wireless Sensor Networks. arXiv
**2012**, arXiv:1212.1216. [Google Scholar] - Preuss, R.D.; Brown, D.R. Retrodirective distributed transmit beamforming with two-way source synchronization. In Proceedings of the 2010 44th Annual Conference on Information Sciences and Systems (CISS), Princeton, NJ, USA, 17–19 March 2010; pp. 1–6. [Google Scholar]
- Brown, D.R.; Klein, A.G. Precise timestamp-free network synchronization. In Proceedings of the 2013 47th Annual Conference on Information Sciences and Systems (CISS), Baltimore, MD, USA, 20–22 March 2013; pp. 1–6. [Google Scholar]
- Bidigare, P.; Pruessing, S.; Raeman, D.; Scherber, D.; Madhow, U.; Mudumbai, R. Initial over-the-air performance assessment of ranging and clock synchronization using radio frequency signal exchange. In Proceedings of the Statistical Signal Processing Workshop (SSP), Ann Arbor, MI, USA, 5–8 August 2012; pp. 273–276. [Google Scholar]
- Denis, B.; Pierrot, J.B.; Abou-Rjeily, C. Joint distributed synchronization and positioning in UWB ad hoc networks using TOA. IEEE Trans. Microw. Theory Tech.
**2006**, 54, 1896–1911. [Google Scholar] [CrossRef] - Gelb, A. Applied Optimal Estimation; MIT Press: Cambridge, MA, USA, 1974. [Google Scholar]
- Anderson, B.D.; Moore, J.B. Optimal Filtering; Courier Corporation: Chelmsford, MA, USA, 2012. [Google Scholar]
- Kalman, R.E. A new approach to linear filtering and prediction problems. J. Fluids Eng.
**1960**, 82, 35–45. [Google Scholar] [CrossRef] [Green Version] - Galleani, L.; Tavella, P. The characterization of clock behavior with the dynamic Allan variance. In Proceedings of the IEEE International Frequency Control Symposium and PDA Exhibition Jointly with the 17th European Frequency and Time Forum, Tampa, FL, USA, 4–8 May 2003; pp. 239–244. [Google Scholar]
- Zucca, C.; Tavella, P. The clock model and its relationship with the Allan and related variances. IEEE Trans. Ultrason. Ferroelectr. Freq. Control
**2005**, 52, 289–296. [Google Scholar] [CrossRef] [PubMed] - Greenhall, C.A. Forming stable timescales from the Jones–Tryon Kalman filter. Metrologia
**2003**, 40, S335. [Google Scholar] [CrossRef] - Giorgi, G.; Narduzzi, C. Performance analysis of Kalman-filter-based clock synchronization in IEEE 1588 networks. IEEE Trans. Instrum. Meas.
**2011**, 60, 2902–2909. [Google Scholar] [CrossRef] - Li, X.R.; Jilkov, V.P. Survey of maneuvering target tracking. Part I. Dynamic models. IEEE Trans. Aerosp. Electron. Syst.
**2003**, 39, 1333–1364. [Google Scholar] - Galleani, L. A tutorial on the two-state model of the atomic clock noise. Metrologia
**2008**, 45, S175. [Google Scholar] [CrossRef] - Davis, J.A.; Greenhall, C.; Stacey, P. A Kalman filter clock algorithm for use in the presence of flicker frequency modulation noise. Metrologia
**2005**, 42, 1. [Google Scholar] [CrossRef] [Green Version] - Rutman, J. Characterization of phase and frequency instabilities in precision frequency sources: Fifteen years of progress. Proc. IEEE
**1978**, 66, 1048–1075. [Google Scholar] [CrossRef] - Percival, D.B. Stochastic models and statistical analysis for clock noise. Metrologia
**2003**, 40, S289. [Google Scholar] [CrossRef] [Green Version] - Chan, Y.T.; Tsui, W.Y.; So, H.C.; Ching, P.C. Time-of-arrival based localization under NLOS conditions. IEEE Trans. Veh. Technol.
**2006**, 55, 17–24. [Google Scholar] [CrossRef] - Seco, F.; Jiménez, A.R.; Prieto, C.; Roa, J.; Koutsou, K. A survey of mathematical methods for indoor localization. In Proceedings of the 2009 IEEE International Symposium on Intelligent Signal Processing, Budapest, Hungary, 26–28 August 2009; pp. 9–14. [Google Scholar]
- Herschfelt, A. Simultaneous Positioning and Communications: Hybrid Radio Architecture, Estimation Techniques, and Experimental Validation. Ph.D. Thesis, Arizona State University, Tempe, AZ, USA, 2019. [Google Scholar]

**Figure 1.**Example system configuration of the previously developed two-way ranging (TWR) system that efficiently enables localization, synchronization, and communications in a distributed radio network. We propose a Kalman filter extension to this system that tracks the time offset T, time delay $\tau $, and the first and second derivatives thereof between the distributed users. These extensions make the system more robust to cycle slips and reduce the computational complexity by an order of magnitude.

**Figure 2.**Interactions between two users A and B. Successive transmissions are separated by ${l}_{A}$, and successive cycles are separated by ${L}_{A}$. These users exchange timing information each frame to drive the localization algorithm.

${\mathit{t}}_{\mathit{A},\mathit{T}\mathit{x}}$ | Transmit event timestamps at node A |

${t}_{A,Rx}$ | Receive event timestamps at node A |

${t}_{B,Tx}$ | Transmit event timestamps at node B |

${t}_{B,Rx}$ | Receive event timestamps at node B |

${\tilde{t}}_{A,Tx}$ | Transmit event time-stamp ${t}_{B,Tx}^{\phantom{\rule{0.166667em}{0ex}}(.)}$ at node A |

${l}_{A}$ | Frame length at node A |

${L}_{A}$ | Cycle length at node A |

$\tau $ | Relative ToF |

$\dot{\tau}$ | Relative velocity |

$\ddot{\tau}$ | Relative acceleration |

T | Relative time offset |

$\dot{T}$ | Relative frequency offset |

$\ddot{T}$ | Relative frequency drift |

${\widehat{\mathit{x}}}_{(-)}$, $\widehat{\mathit{x}}$ | Predicted and estimated state parameters |

$\left|\mathbf{x}\right|$ | Cardinality of state space |

$\mathbf{F}$ | State transition matrix |

${\widehat{\mathbf{z}}}_{(-)}$, $\widehat{\mathbf{z}}$ | Predicted and observed measurements |

$\mathbf{u}$ | Control parameters |

$\mathbf{h}$, $\mathbf{H}$ | Measurement transition and Jacobian |

$\mathbf{w}$, $\mathbf{v}$ | State and measurement noise |

$\mathbf{Q}$, $\mathbf{R}$ | State and measurement noise covariance matrix |

${\widehat{\mathbf{P}}}_{(-)}$, $\widehat{\mathbf{P}}$ | Predicted and estimated state covariance matrix |

$\mathbf{S}$ | Measurement covariance matrix |

$\mathbf{K}$ | Kalman gain |

Optimal One-Shot Estimator—First-Order | 0.93 ms |

Optimal One-Shot Estimator—Second-Order | 49.0 ms |

Extended Kalman Filter Tracking—First-Order | 1.30 ms |

Extended Kalman Filter Tracking—Second-Order | 2.60 ms |

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Srinivas, S.; Herschfelt, A.; Bliss, D.W.
Extended Kalman Filter Design for Tracking Time-of-Flight and Clock Offsets in a Two-Way Ranging System. *Signals* **2023**, *4*, 439-456.
https://doi.org/10.3390/signals4020023

**AMA Style**

Srinivas S, Herschfelt A, Bliss DW.
Extended Kalman Filter Design for Tracking Time-of-Flight and Clock Offsets in a Two-Way Ranging System. *Signals*. 2023; 4(2):439-456.
https://doi.org/10.3390/signals4020023

**Chicago/Turabian Style**

Srinivas, Sharanya, Andrew Herschfelt, and Daniel W. Bliss.
2023. "Extended Kalman Filter Design for Tracking Time-of-Flight and Clock Offsets in a Two-Way Ranging System" *Signals* 4, no. 2: 439-456.
https://doi.org/10.3390/signals4020023