{'fraction_non_alphanumeric': 0.0422200313170562, 'fraction_numerical': 0.012236849736124805, 'mean_word_length': 4.605765062852189, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 15, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Batch Nonlinear Continuous-Time Trajectory Estimation as Exactly Sparse Gaussian Process Regression

In this paper, we revisit batch state estimation through the lens of Gaussian process (GP) regression. We consider continuous-discrete estimation problems wherein a trajectory is viewed as a one-dimensional GP, with time as the independent variable. Our continuous-time prior can be defined by any nonlinear, time-varying stochastic differential equation driven by white noise; this allows the possibility of smoothing our trajectory estimates using a variety of vehicle dynamics models (e.g., `constant-velocity'). We show that this class of prior results in an inverse kernel matrix (i.e., covariance matrix between all pairs of measurement times) that is exactly sparse (block-tridiagonal) and that this can be exploited to carry out GP regression (and interpolation) very efficiently. When the prior is based on a linear, time-varying stochastic differential equation and the measurement model is also linear, this GP approach is equivalent to classical, discrete-time smoothing (at the measurement times); when a nonlinearity is present, we iterate over the whole trajectory to maximize accuracy. We test the approach experimentally on a simultaneous trajectory estimation and mapping problem using a mobile robot dataset.


Introduction
Probabilistic state estimation has been a core topic in mobile robotics since the 1980s (Durrant-Whyte, 1988;Smith and Cheeseman, 1986;Smith et al., 1990), often as part of the simultaneous localization and mapping (SLAM) problem Durrant-Whyte and Bailey, 2006). Early work in estimation theory focused on recursive (as opposed to batch) formulations (Kalman, 1960), and this was mirrored in the formulation of SLAM as a filtering problem (Smith et al., 1990). However, despite the fact that continuous-time estimation techniques have been available since the 1960s (Jazwinski, 1970;Kalman and Bucy, 1961), trajectory estimation for mobile robots has been formulated almost exclusively in discrete time. Lu and Milios (1997) showed how to formulate SLAM as a batch estimation problem incorporating both odometry measurements (to smooth solutions) as well as landmark measurements. This can be viewed as a generalization of bundle adjustment (Brown, 1958;Sibley et al., 2010), which did not incorporate odometry. Today, batch approaches in mobile robotics are commonplace (e.g., GraphSLAM by Thrun and Montemerlo (2006)). Kaess et al. (2008) show how batch solutions can be efficiently updated as new measurements are gathered and Strasdat et al. (2010) show that batch methods are able to achieve higher accuracy than their filtering counterparts, for the same computational cost. Most of these results are formulated in discrete time.
Discrete-time representations of robot trajectories are sufficient in many situations, but they do not work well when estimating motion from certain types of sensors (e.g., rolling-shutter cameras and scanning laser-rangefinders) and sensor combinations (e.g., high datarate, asynchronous). In these cases, a smooth, continuous-time representation of the trajectory is more suitable. For example, in the case of estimating motion from a scanning-while-moving sensor, a discrete-time approach (with no motion prior) can fail to find a unique solution; something is needed to tie together the observations acquired at many unique timestamps. Additional sensors (e.g., odometry or inertial measurements) could be introduced to serve in this role, but this may not always be possible. In these cases, a motion prior can be used instead (or as well), which is most naturally expressed in continuous time.
One approach to continuous-time trajectory representation is to use interpolation (e.g., linear, spline) directly between nearby discrete poses (Bibby and Reid, 2010;Bosse and Zlot, 2009;Dong and Barfoot, 2012;Furgale et al., 2012;Hedborg et al., 2012;Lovegrove et al., 2013). Instead, we choose to represent the trajectory nonparametrically as a one-dimensional Gaussian process (GP) (Rasmussen and Williams, 2006), with time as the independent variable (see Figure 1). Tong et al. (2012Tong et al. ( , 2013 show that querying the state of the robot at a time of interest can be viewed as a nonlinear, GP regression problem. While their approach is very general, allowing a variety of GP priors over robot trajectories, it is also quite expensive due to the need to invert a large, dense kernel matrix.
While GPs have been used in robotic state estimation to accomplish dimensionality reduction (Ferris et al., 2006(Ferris et al., , 2007Lawrence, 2003) and to represent the measurement and motion models (Deisenroth et al., 2012;Fox, 2009, 2011), these uses are quite different than representing the latent robot trajectory as a GP (Tong et al., 2012(Tong et al., , 2013. In this paper, we consider a particular class of GPs, generated by nonlinear, time-varying (NTV) stochastic differential equations (SDE) driven by white noise. We first show that GPs based on linear, time-varying (LTV) SDEs have an inverse kernel matrix that is exactly sparse (blocktridiagonal) and can be derived in closed form; an approximation for GPs based on a NTV SDE is then shown that results in the same sparsity properties as the linear case. Concentrating on this class of covariance functions results in only a minor loss of generality, because many commonly used covariance functions such the Matérn class and the squared exponential covariance function can be exactly or approximately represented as linear SDEs (Hartikainen and Särkkä, 2010;Solin and Särkkä, 2014). We provide an example of this relationship at the end of this paper. The resulting sparsity allows the approach of Tong et al. (2012Tong et al. ( , 2013 to be implemented very efficiently. The intuition behind why this is possible is that the state we are estimating is Markovian for this class of GPs, which implies that the corresponding precision matrices are sparse (Lindgren et al., 2011).
This sparsity property has been exploited in estimation theory to allow recursive methods (both filtering and smoothing) since the 1960s (Kalman, 1960;Kalman and Bucy, 1961). Jumarie (1990) offers an interesting discussion on nonlinear, continuous-time filtering (using both a nonlinear dynamical plant and nonlinear observations). The tracking literature, in particular, has made heavy use of motion priors (in both continuous and discrete time) and has exploited the Markov property for efficient solutions (Maybeck, 1979). For the nonlinear, discrete-time case, Bell (1994) shows that Kalman filtering and smoothing with iterated relinearization is equivalent to Gauss-Newton on the full-state trajectory. It is of no surprise that in vision and robotics, discrete-time batch methods commonly exploit this sparsity property as well (Triggs et al., 2000). In this paper, we make the (retrospectively obvious) observation that this sparsity can also be exploited in a batch, continuous-time context. The result is that we derive a principled method to construct trajectory-smoothing terms for batch optimization (or factors in a factor-graph representation) based on a class of useful motion models; this paves the way to incorporate vehicle dynamics models, including exogenous inputs, to help with trajectory estimation. Therefore, our main contribution is to emphasize the strong connection between classical estimation theory and machine learning via GP regression. We use the fact that the inverse kernel matrix is sparse for a class of useful GP priors (Lindgren et al., 2011; in a new way to efficiently implement nonlinear, GP regression for batch, continuous-time trajectory estimation. We also show that this naturally leads to a subtle generalization of SLAM that we call simultaneous trajectory estimation and mapping (STEAM), with the difference being that chains of discrete poses are replaced with Markovian trajectories in order to incorporate continuous-time motion priors in an efficient way. Finally, by using this GP paradigm, we are able to exploit the classic GP interpolation approach to query the trajectory at any time of interest in an efficient manner. This ability to query the trajectory at any time of interest in a principled way could be useful in a variety of situations. For example, Newman et al. (2009) mapped a large urban area using a combination of stereo vision and laser rangefinders; the motion was estimated using the camera and the laser data were subsequently placed into a three-dimensional map based on this estimated motion. Our method could provide a seamless means to (i) estimate the camera trajectory and then (ii) query this trajectory at every laser acquisition time.
This paper is a significant extension of our recent conference paper (Barfoot et al., 2014). We build upon the exactly-sparse GP-regression approach that used linear, time-varying SDEs, and show how to use GPs based on nonlinear, time-varying SDEs, while maintaining the same level of sparsity as the linear case. The algorithmic differences are discussed in detail and results are provided using comparable linear and nonlinear priors. Furthermore, this paper shows how the block-tridiagonal sparsity of the kernel matrix can be exploited to improve the computational performance of hyperparameter training. Finally, discussion is provided on using the GP interpolation equation for further state reduction at the cost of accuracy.
The paper is organized as follows. Section 2 summarizes the general approach to batch state estimation via GP regression. Section 3 describes the particular class of GPs we use and elaborates on our main result concerning sparsity. Section 4 demonstrates this main result on a mobile robot example using a 'constant-velocity' prior and compares the computational cost to methods that do not exploit the sparsity. Section 5 provides some discussion and Section 6 concludes the paper.

Gaussian Process Regression
We take a Gaussian-process-regression approach to state estimation. This allows us to (i) represent trajectories in continuous time (and therefore query the solution at any time of interest), and (ii) optimize our solution by iterating over the entire trajectory (recursive methods typically iterate at a single timestep).
We will consider systems with a continuous-time, GP process model and a discrete-time, nonlinear measurement model: where x(t) is the state,x(t) is the mean function,P(t, t ) is the covariance function, y n are measurements, n n ∼ N (0, R n ) is Gaussian measurement noise, g(·) is a nonlinear measurement model, and t 1 < . . . < t N is a sequence of measurement times. For the moment, we do not consider the STEAM problem (i.e., the state does not include landmarks), but we will return to this case in our example later. We follow the approach of Tong et al. (2013) to set up our batch, GP state estimation problem. We will first assume that we want to query the state at the measurement times, and will return to querying at other times later on. We start with an initial guess, x op , for the trajectory that will be improved iteratively. At each iteration, we solve for the optimal perturbation, δx , to our guess using GP regression, with our measurement model linearized about the current best guess.
The joint likelihood between the state and the measurements (both at the measurement times) is Note, the measurement model is linearized about our best guess so far. We then have that the Gaussian posterior is Letting δx =x − x op , and rearranging the posterior mean expression using the Sherman-Morrison-Woodbury identity, we have which is a linear system for δx and can be viewed as the solution to the associated maximum a posteriori (MAP) problem. We know that the G T R −1 G term in (5) is blockdiagonal (assuming each measurement depends on the state at a single time), but in generalP −1 could be dense, depending on the choice of GP prior. At each iteration, we solve for δx and then update the guess according to x op ← x op +δx ; upon convergence we setx = x op . This is effectively Gauss-Newton optimization over the whole trajectory.
We may want to also query the state at some other time(s) of interest (in addition to the measurement times). Though we could jointly estimate the trajectory at the measurement and query times, a better idea is to use GP interpolation after the solution at the measurement times converges (Rasmussen and Williams, 2006;Tong et al., 2013) (see Section 3.1.3 for more details). GP interpolation automatically picks the correct interpolation scheme for a given prior; it arrives at the same answer as the joint approach (in the linear case), but at lower computational cost.
In general, this GP approach has complexity O(N 3 + N 2 J), where N is the number of measurement times and J is the number of query times (the initial solve is O(N 3 ) and the queries are O(N 2 J)). This is quite expensive, and therefore we will seek to improve the cost by exploiting the structure of the matrices involved under a particular class of GP priors.

Linear, Time-Varying Stochastic Differential Equations
We now show that the inverse kernel matrix is exactly sparse for a particular class of useful GP priors. We consider GPs generated by linear, time-varying (LTV) stochastic differential equations (SDE) of the forṁ where x(t) is the state, v(t) is a (known) exogenous input, w(t) is white process noise, and F(t), L(t) are time-varying system matrices. The process noise is given by a (stationary) zero-mean Gaussian process (GP) with (symmetric, positive-definite) power-spectral density matrix, Q C , and δ(·) is the Dirac delta function.
The general solution to this LTV SDE (Maybeck, 1979;Stengel, 1994) is where Φ(t, s) is known as the transition matrix. From this model, we seek the mean and covariance functions for x(t).

Mean Function
For the mean function, we take the expected value of (8): wherex 0 =x(t 0 ) is the initial value of the mean. If we now have a sequence of measurement times, t 0 < t 1 < t 2 < · · · < t N , then we can write the mean at these times in lifted form aš . . .
Note that F, the lifted transition matrix, is lower-triangular. We arrive at this form by simply splitting up (9) into a sum of integrals between each pair of measurement times.

Covariance Function
For the covariance function, we take the second moment of (8) to arrive ať whereP 0 is the initial covariance at t 0 and we have assumed E[x(t 0 )w(t) T ] = 0. Using a sequence of measurement times, t 0 < t 1 < t 2 < · · · < t N , we can write the covariance between two times aš for n = 1 . . . N and Q 0 =P 0 (to keep the notation simple). Given this preparation, we are now ready to state the main sparsity result that we will exploit in the rest of the paper.
Then, we can factorP according to a lower-diagonal-upper decomposition, where F is the lower-triangular matrix given in (3.1.1) and Q = diag P 0 , Q 1 , . . . , Q N with Q n given in (14).
Proof Straightforward to verify by substitution.
Theorem 1 The inverse of the kernel matrix constructed in Lemma 1,P −1 , is exactly sparse (block-tridiagonal).
Proof The decomposition ofP in Lemma 1 provideš where the inverse of the lifted transition matrix is and Q −1 is block-diagonal. The block-tridiagonal property ofP −1 follows by substitution and multiplication.
While the block-tridiagonal property stated in Theorem 1 has been exploited in vision and robotics for a long time (Lu and Milios, 1997;Triggs et al., 2000;Thrun and Montemerlo, 2006), the usual route to this point is to begin by converting the continuous-time motion model to discrete time and then to directly formulate a maximum a posteriori optimization problem; this bypasses writing out the full expression forP and jumps to an expression forP −1 . However, we require expressions for bothP andP −1 to carry out our GP reinterpretation and facilitate querying the trajectory at an arbitrary time (through interpolation). That said, it is also worth noting we have not needed to convert the motion model to discrete time and have made no approximations thus far.
Given the above results, the prior over the state (at the measurement times) can be written as Fig. 2 Although we began with a continuous-time prior to smooth our trajectory, the class of exactly sparse GPs results in only N +1 smoothing terms, J i , in the associated optimization problem, the solution of which is (19). We can depict these graphically as factors (black dots) in a factor-graph representation of the prior (Dellaert and Kaess, 2006). The triangles are trajectory states, the nature of which depends on the choice of prior.
More importantly, using the result of Theorem 1 in (5) gives block-tridiagonal which can be solved in O(N ) time (at each iteration), using a sparse solver (e.g., sparse Cholesky decomposition then forward-backward passes). In fact, in the case of a linear measurement model, one such solver is the classical, forward-backward smoother (i.e., Kalman or Rauch-Tung-Striebel smoother) (Bell, 1994). Put another way, the forward-backward smoother is possible because of the sparse structure of (19). For nonlinear measurement models, our scheme iterates over the whole trajectory; it is therefore related to, but not the same as, the 'extended' version of the forward-backward smoother (Särkkä, 2013;Särkkä and Sarmavuori, 2013;. Perhaps the most interesting outcome of Theorem 1 is that, although we are using a continuous-time prior to smooth our trajectory, at implementation we require only N + 1 smoothing terms in the associated MAP optimization problem: N between consecutive pairs of measurement times plus 1 at the initial time (unless we are also estimating a map). As mentioned before, this is the same form that we would have arrived at had we started by converting our motion model to discrete time at the beginning (Lu and Milios, 1997;Triggs et al., 2000;Thrun and Montemerlo, 2006). This equivalence has been noticed before for recursive solutions to estimation problems with a continuous-time state and discrete-time measurements (Särkkä, 2006), but not in the batch scenario. Figure 2 depicts the N + 1 smoothing terms in a factor-graph representation of the prior (Dellaert and Kaess, 2006;Kaess et al., 2012).
However, while the form of the smoothing terms/factors is similar to the original discrete-time form introduced by Lu and Milios (1997), our approach provides a principled method for their construction, starting from the continuoustime motion model. Critically, we stress that the state being estimated must be Markovian in order to obtain the desirable sparse structure. In the experiment section, we will investigate a common GP prior, namely the 'constant-velocity' or white-noise-on-acceleration model:p(t) = w(t), where p(t) represents position. For this choice of model, p(t) is not Markovian, but is. This implies that, if we want to use the 'constant-velocity' prior and enjoy the sparse structure without approximation, we must estimate a stacked state with both position and velocity. Marginalizing out the velocity variables fills in the inverse kernel matrix, thereby destroying the sparsity.
If all we cared about was estimating the value of the state at the measurement times, our GP paradigm arguably offers little beyond a reinterpretation of the usual discrete-time approach to batch estimation. However, by taking the time to set up the problem in this manner, we can now query the trajectory at any time of interest using the classic interpolation scheme that is inherent to GP regression (Tong et al., 2013).

Querying the Trajectory
As discussed in Section 2, after we solve for the trajectory at the measurement times, we may want to query it at other times of interest. This operation also benefits greatly from the sparse structure. To keep things simple, we consider a single query time, t n ≤ τ < t n+1 (see Figure 1). The standard linear GP interpolation formulas (Rasmussen and Williams, 2006;Tong et al., 2013) arê . Note, we write (21b) in a less common, but equivalent, form, as we intend to exploit the sparsity of the productP(τ )P −1 . For the mean function at the query time, we simply havě which can be evaluated in O(1) time. For the covariance function at the query time, we havě which is also O(1) to evaluate. The computational savings come from the sparsity of the productP(τ )P −1 , which represents the burden of the cost in the interpolation formula. After some effort, it turns out we can writeP(τ ) aš where F was defined before, and Returning to the desired product, we havě Since Q −1 is block-diagonal, and F −1 has only the main diagonal and the one below it non-zero, we can evaluate the product very efficiently. Note, there are exactly two non-zero block-columns: Inserting this into (21), we havê which is a linear combination of just the terms from t n and

Interpolating Measurement Times
Thus far, we have shown that by storing the Markovian, x(t n ), state at every measurement time, t n , n = 1 . . . N , we are able to perform Gaussian-process regression in O(N ) time and then query for other times of interest x(τ ), all without approximation. Given the ability to interpolate, storing the state at every measurement time may be excessive, especially in a scenario where the measurement rate is high in comparison to the smoothness of the robot kinematics (e.g. a 1000 Hz IMU or individually timestamped lidar measurements, mounted on a slow indoor platform). Tong et al. (2013) discuss a scheme to remove some of the measurement times from the initial solve, which further reduces computational cost with some loss of accuracy. By estimating x at only some keytimes, t k , k = 0 . . . K, which may or may not align with some subset of the measurement times, the interpolation equation can be used to modify our measurement model as follows, where t k ≤ t n < t k+1 . The matrices Λ(t n ) and Ψ(t n ) are constructed according to (28), where the measurement time, t n , is now the query time and the bounding times (previously t n and t n+1 ) become the keytimes t k and t k+1 . The effect on G is that each block row now has two adjacent non-zero block columns, rather than one. This causes the structure of G T R −1 G to change from being block-diagonal to block-tridiagonal; the structure of G T R −1 G is of particular importance because it directly affects the complexity of solving (19). Fortunately, the complexity is unaffected because our prior term is also block-tridiagonal. An important intuition is that the interpolated state at some measurement time, t n , depends only on the state estimates, x op,k and x op,k+1 , and the prior terms,x(t) anď P(t, t ). Therefore, the effect of estimating x at some reduced number of times is that we obtain a smoothed solution; any details provided by high frequency measurements between two times of interest, t k and t k+1 , are lost. Although this detail information is smoothed over, there are obvious computational savings in having a smaller state and a subtle benefit regarding the prevention of overfitting measurements. With respect to fitting, the glaring issue with this scheme is that there is not a principled method to determine an appropriate spacing for the keytimes, t k , such that we could guarantee a bound on the loss of accuracy. Learning from the parametric continuous-time estimation schemes, which suffer from a similar issue, it is reasonable to start with some uniform spacing and add additional keytimes based on the results of a normalized-innovation-squared test between each pair of keytimes (Oth et al., 2013). Some experimentation is necessary to better understand which approach to state discretization is best in which situation.

Nonlinear, Time-Varying Stochastic Differential Equations
In reality, most systems are inherently nonlinear and cannot be accurately described by a LTV SDE in the form of (6). Moving forward, we show how our results concerning sparsity can be applied to nonlinear, time-varying (NTV) stochastic differential equations (SDE) of the forṁ where f(·) is a nonlinear function, x(t) is the state, u(t) is a (known) exogenous input, and w(t) is white process noise.
To perform GP regression with a nonlinear process model, we begin by linearizing the SDE about a continuous-time operating point x op (t), where Setting lets us rewrite (33) in the familiar LTV SDE form, where F(t), v(t), and L(t) are known functions of time, since x op (t) is known. Setting the operating point, x op (t), to our best guess of the underlying trajectory at each iteration of GP regression, we note a similarity in nature to the discrete-time, recursive method of Bell (1994); in essence, our approach offers a continuous-discrete version of the Gauss-Newton estimator, using the Gaussian-processregressor type of approximate bridging between the measurement times.

Mean and Covariance Function
Although the equations for calculating the mean,x, and covariance,P, remain the same as in (9) and (12), there are a few algorithmic differences and issues that arise due to the new dependence on the continuous-time operating point, x op (t). An obvious difference in contrast to the GP regression using a LTV SDE is that we now must recalculatex andP at each iteration of the optimization (since the linearization point is updated). The main algorithmic issue that presents itself is that the calculation ofx andP require integrations involving F(t), v(t), and L(t), which in turn require the evaluation of x op (t) over the time period t ∈ [t 0 , t N ].
Since an estimate of the posterior mean, x op , is only stored at times of interest, we must make use of the efficient (for our particular choice of process model) GP interpolation equation derived in Section 3.1.3, The problem is that the above interpolation depends again onx andP, which are the prior variables for which we want to solve. To rectify this circular dependence, we take advantage of the iterative nature of GP regression and choose to evaluate (37) using the values ofx(τ ),x, andP(τ )P −1 from the previous iteration.
Another issue with nonlinear process models is that identifying an analytical expression for the state transition matrix, Φ(t, s) (which is dependent on the form of F(t)), can be very challenging. Fortunately, the transition matrix can also be calculated numerically via the integration of the normalized fundamental matrix, Υ(t), wherė Storing Υ(t) at times of interest, the transition matrix can then be computed using In contrast to the LTV SDE system, using a nonlinear process model causes additional computational costs (primarily due to numerical integrations), but complexity remains linear in the length of the trajectory (at each iteration), and therefore continues to be computationally tractable.

Querying the Trajectory
In this section, we discuss the algorithmic details of the GP interpolation procedure as it pertains to a NTV SDE process model. Recall the standard linear GP interpolation formulas presented in (21), for a single query time, t n ≤ τ < t n+1 : The final iteration of GP regression (wherex = x op ), provides values forx,P,x, andP; however, obtaining values foř x(τ ),P(τ )P −1 (recall sparse structure in (28)), andP(τ, τ ) is not trivial. The suggestion made in Section 3.2.1 was to use values from the previous (or in this case, final) iteration. Thus far, the method of storing these continuous-time functions has been left ambiguous.
The naive way to storex(τ ),P(τ )P −1 , andP(τ, τ ) is to keep the values at all numerical integration timesteps; the memory requirement of this is proportional to the length of the trajectory. During the optimization procedure this naive method may in fact be preferable as it reduces computation time in lieu of additional storage (which is fairly cheap using current technology). For long-term storage, a method that uses a smaller memory footprint (at the cost of additional computation) may be desirable. The remainder of this section will focus on identifying the minimal storage requirements, such that queries remain O(1) complexity.
We begin by examining the mean function; substituting (22) and (35), into the GP interpolation formula above: It is straightforward to see howx(τ ) can be simultaneously numerically integrated with the normalized fundamental matrix from (38), as long as we can evaluate the termP(τ )P −1 . Although we chose to examine the mean function, a similar conclusion can be drawn by examining the covariance function in (23). Recalling the sparse structure ofP(τ )P −1 (see (28)) for an LTV SDE process model, where we are able to draw two conclusions. First, in the case that an analytical expression for Φ(t, s) is unavailable, we must store Υ(t n ) at the times of interest t n , n = 1 . . . N , since any numerical integration will involve 'future' values of Υ(t) (via the evaluation of Φ(t n+1 , t n ), Φ(t n+1 , τ ), and Q −1 n+1 ). Second, in the case that L(t) is a time-varying matrix, we must store Q −1 n , n = 1 . . . N , since the evaluation of Q −1 n , requires L(s) (evaluated atx(s)) over the time period [t n−1 , t n ]. The memory requirements of this alternative are still proportional to the length of the trajectory, but are greatly reduced in contrast to the naive method; the added cost is that any new query requires numerical integration from the nearest time t n to the query time τ (which is of order O(1)).

Training the Hyperparameters
As with any GP regression, we have hyperparameters associated with our covariance function, namely Q C , which affect the smoothness and length scale of the class of functions we are considering as motion priors. The covariances of the measurement noises can also be unknown or uncertain. The standard approach to selecting these parameters is to use a training dataset (with ground-truth), and perform optimization using the log marginal likelihood (log-evidence) or its approximation as the objective function (Rasmussen and Williams, 2006). We begin with the marginal likelihood equation, where y is a stacked vector of state observations (groundtruth measurements) with additive noise N (0, σ 2 w 1),x is a stacked vector of the mean equation evaluated at the observation times, t w , w = 1 . . . W , andP is the covariance matrix associated withx and generated using the hyperparameters Q C . Taking partial derivatives of the marginal likelihood with respect to the hyperparameters, we get where we have used that The typical complexity of hyperparameter training is bottlenecked at O(W 3 ) due to the inversion of P w (which is typically dense). Given P −1 w , the complexity is then typically bottlenecked at O(W 2 ) due to the calculation of ∂Pw Fortunately, in the present case, the computation of the log marginal likelihood can also be done efficiently due to the sparseness of the inverse kernel matrix,P −1 . Despite the addition of observation noise, σ 2 w 1, causing P −1 w to be a dense matrix, we are still able to take advantage of our sparsity using the Sherman-Morrison-Woodbury identity: where we define Although computing P −1 w explicitly is of order O(W 2 ), we note that the product with a vector, P −1 w v, can be computed in O(W ) time; this is easily observable given that Q −1 is block-diagonal, F −1 is lower block-bidiagonal, and the product (P −1 + 1 σ 2 w 1) −1 v can be computed in O(W ) time using Cholesky decomposition, because (P −1 + 1 σ 2 w 1) is block-tridiagonal. While the two terms in (44) can be combined into a single trace function, it is simpler to study their computational complexity separately. Starting with the first term, we have where and 1 i,j denotes a projection matrix with a 1 at the i th row and j th column. Taking advantage of the sparse matrices and previously mentioned fast matrix-vector products, it is clear that (47) Taking a look at the second term, we have that which can only be computed in O(W 2 ), due to the form of Q −1 w . In general, the total complexity of training for this sparse class of prior is then bottlenecked at O(W 2 ). A complexity of O(W ) can only be achieved by ignoring the additive measurement noise, σ 2 w 1; revisiting the second term of (44), and setting P w =P, we find that which can be computed in time O(W ). The effect of ignoring the measurement noise, σ 2 w 1, is that the trained hyperparameters will result in an underconfident prior; the degree of this underconfidence depends on the magnitude of the noise we are choosing to ignore. If accurate ground-truth measurements are available and the size of the training dataset is very large, this approximation may be beneficial.

Complexity
We conclude this section with a brief discussion of the time complexity of the overall algorithm when exploiting the sparse structure. If we have N measurement times and want to query the trajectory at J additional times of interest, the complexity of the resulting algorithm using GP regression with any linear (or nonlinear), time-varying process model driven by white noise will be O(N + J). This is broken into the two major steps as follows. The initial solution to find x op (at the measurement times) can be done in O(N ) time (per iteration) owing to the block-tridiagonal structure discussed earlier. Then, the cost of the queries at J other times of interest is O(J) since each individual query is O(1). Clearly, O(N +J) is a big improvement over the O(N 3 +N 2 J) cost when we did not exploit the sparse structure of the problem.

Linear Constant-Velocity GP Prior
We will demonstrate the advantages of the sparse structure through an example employing the 'constant-velocity' prior,p(t) = w(t). This can be expressed as a linear, timeinvariant SDE of the form in (6) with where p(t) = x(t) y(t) θ(t) T is the pose andṗ(t) is the pose rate. In this case, the transition function is which can be used to construct F (or F −1 directly). As we will be doing a STEAM example, we will constrain the first trajectory state to be x(t 0 ) = 0 and so will have no need foř x 0 andP 0 . For n = 1 . . . N , we have v n = 0 and with ∆t n = t n − t n−1 . The inverse blocks are so we can build Q −1 directly. We now have everything we need to represent the prior: F −1 , Q −1 , and v = 0, which can be used to constructP −1 .
We will also augment the trajectory with a set of L landmarks, , into a combined state, z, in order to consider the STEAM problem: While others have folded velocity estimation into discretetime, filter-based SLAM (Davison et al., 2007) and even discrete-time, batch SLAM (Grau and Pansiot, 2012), we are actually proposing something more general than this: the choice of prior tells us what to use for the trajectory states. And, although we solve for the state at a discrete number of measurement times, our setup is based on an underlying continuous-time prior, meaning that we can query it at any time of interest in a principled way.

Nonlinear Constant-Velocity GP Prior
Since the main source of acceleration in this example is robot-oriented (the actuated wheels), we investigate the use of an alternate 'constant-velocity' prior, with the white noise affecting acceleration in the robot body frame,ν(t) = w(t). This nonlinear prior can be written as, where is a rotation matrix between the inertial and robot body frame, and the Markovian state is is the robot-oriented velocity (with longitudinal, latitudinal, and rotational components, respectively). Linearizing about an arbitrary operating point, x op (t), the components F(t), v(t) and L(t) from (36) are straightforward to derive. Similarly, to the linear prior example described above, we will define the exogenous input u(t) = 0; however, we note that v(t) = 0 (see (35)). Since expressions for Φ(t, s) and Q n are not obvious, we will rely on numerical integration for their evaluation.

Measurement Models
We will use two types of measurements: range/bearing to landmarks (using a laser rangefinder) and wheel odometry Fig. 3 Factor-graph representation of our STEAM problem. There are factors (black dots) for (i) the prior (binary), (ii) the landmark measurements (binary), and (iii) the wheel odometry measurements (unary). Triangles are trajectory states (position and velocity, for this prior); the first trajectory state is locked. Hollow circles are landmarks.
(in the form of robot-oriented velocity). The range/bearing measurement model takes the form The wheel odometry measurement model gives the longitudinal and rotational speeds of the robot, taking the form for the LTI SDE prior, and y n = g wo (x(t n )) + n n = 1 0 0 0 0 1 ν(t n ) + n n , for the NTV SDE prior. Note that in both cases the velocity information is extracted easily from the state since we are estimating it directly. The Jacobians with respect to the state, x(t), are straightforward to derive. Figure 3 shows an illustration of the STEAM problem we are considering. In terms of linear algebra, at each iteration we need to solve a linear system of the form

Exploiting Sparsity
which retains exploitable structure despite introducing landmarks to the state (Brown, 1958). In particular, W xx is block-tridiagonal (due to our GP prior) and W is blockdiagonal; the sparsity of the off-diagonal block, W x , depends on the specific landmark observations. We reiterate the fact that if we marginalize out theṗ(t n ) (or ν(t n )) variables and keep only the p(t n ) variables to represent the trajectory, the W xx block becomes dense (for these priors); this is precisely the approach of Tong et al. (2013).
To solve (62) efficiently, we can begin by either exploiting the sparsity of W xx or of W . Since each trajectory variable represents a unique measurement time (range/bearing or odometry), there are potentially a lot more trajectory variables than landmark variables, L M , so we will exploit W xx .
We use a sparse (lower-upper) Cholesky decomposition: We first decompose V xx V T xx = W xx , which can be done in O(N ) time owing to the block-tridiagonal sparsity. The resulting V xx will have only the main block-diagonal and the one below it non-zero. We can then solve V We then perform the standard forward-backward passes, ensuring to exploit the sparsity: first solve Vd = b for d, then V T δz = d for δz , both in O(L 2 + LN ) time. Note, this approach does not marginalize out any variables during the solve, as this can ruin the sparsity (i.e., we avoid inverting W xx ). The whole solve is O(L 3 + L 2 N ).
At each iteration, we update the state,z ←z + δz , and iterate to convergence. Finally, we query the trajectory at J other times of interest using the GP interpolation discussed earlier. The whole procedure is then O(L 3 + L 2 N + J), including the extra queries.
Due to the addition of landmarks, the cost of a STEAM problem must be either be of order O(L 3 + L 2 N + J) or O(N 3 + N 2 L + J), depending on the way we choose to exploit W xx or W . The state reduction scheme presented in Section 3.1.4 becomes very attractive when both the number of measurements and landmarks are very high; estimating the state at K keytimes, K < N , and exploiting W , the procedure becomes order O(K 3 + K 2 L + N + J), which is the same complexity as a traditional discrete-time SLAM problem (with the addition of the J query times).

Experiment
For experimental validation, we employed the same mobile robot dataset as used by Tong et al. (2013). This dataset consists of a mobile robot equipped with a laser rangefinder driving in an indoor, planar environment amongst a forest of 17 plastic-tube landmarks. The odometry and landmark measurements are provided at a rate of 1Hz, and additional (a) GP-Traj-Sparse-LTI trajectory sample.
(b) GP-Traj-Sparse-NTV trajectory sample. trajectory queries are computed at a rate of 10Hz after estimator convergence. Ground-truth for the robot trajectory and landmark positions is provided by a Vicon motion capture system. We implemented three estimators for comparison. The first was the algorithm described by Tong et al. (2013), GP-Pose-Dense, the second was a naive version of our estimator, GP-Traj-Dense, based on the LTI SDE prior described in Section 4.1, but did not exploit sparsity, and the third was a full implementations of our estimator, GP-Traj-Sparse, that exploited the sparsity structure as described in this paper. The final estimator has two variants, GP-Traj-Sparse-LTI and GP-Traj-Sparse-NTV, based on the LTI SDE and NTV SDE priors described in Sections 4.1 and 4.2, respectively; as the first two estimators, GP-Pose-Dense and GP-Traj-Dense, are only of interest with regard to computational performance, they each implement only the LTI 'constantvelocity' prior.
For this experiment, we obtained Q C for both the LTI and NTV priors by modelling it as a diagonal matrix and taking the data-driven training approach using log marginal likelihood (with ground-truth measurements) described in Section 3.3.
Though the focus of the exactly sparse Gaussian process priors is to demonstrate the significant reductions in computational cost, we provide Figure 4 to illustrate the smooth trajectory estimates we obtained from the continuous-time formulation. While the algorithms differed in their number of degrees of freedom and types of their estimated states, their overall accuracies were similar for this dataset. The GP-Traj-Sparse-NTV algorithm differed slightly from the others; qualitatively, we found that the trajectory estimated by the GP-Traj-Sparse-NTV algorithm more accurately matched the local shape of the ground-truth on many occasions, such as the ones highlighted by the insets in Fig-ure 4. Also, it is clear from the plotted 3σ covariance envelope that the estimate from the GP-Traj-Sparse-NTV algorithm tends to be more uncertain.

Computational Cost
To evaluate the computational savings of exploiting an exactly sparse GP prior, we implemented all algorithms in Matlab with a 2.4GHz i7 processor and 8GB of 1333MHz DDR3 RAM and timed the computation for segments of the dataset of varying lengths. These results are shown in Figure 5, where we provide the computation time for the individual operations that benefit most from the sparse structure, as well as the overall processing time.
We see that the GP-Traj-Dense algorithm is much slower than the original GP-Pose-Dense algorithm of Tong et al. (2013). This is because we have reintroduced the velocity part of the state, thereby doubling the number of variables associated with the trajectory. However, once we start exploiting the sparsity with the GP-Traj-Sparse methods, the increase in number of variables pays off.
For the GP-Traj-Sparse methods, we see in Figure 5(a) that the kernel matrix construction was linear in the number of estimated states. This can be attributed to the fact that we constructed the sparseP −1 directly. As predicted, the optimization time per iteration was also linear in Figure 5(b), and the interpolation time per additional query was constant regardless of state size in Figure 5(c). Finally, Figure 5(d) shows that the total compute time was also linear.
The additional cost of the GP-Traj-Sparse-NTV algorithm over the GP-Traj-Sparse-LTI algorithm in kernel construction time is due to the linearization and numerical integration of the prior mean and covariance. The optimization time of the GP-Traj-Sparse-NTV algorithm is also affected because the kernel matrix must be reconstructed from a new  linearization of the prior during every optimization iteration.
The GP-Traj-Sparse-NTV algorithm also incurs some numerical integration cost in interpolation time, but it is constant and very small. We also note that the number of iterations for optimization convergence varied for each algorithm. In particular, we found that the GP-Traj-Sparse implementations converged in fewer iterations than the other implementations due to the fact that we constructed the inverse kernel matrix directly, which resulted in greater numerical stability. The GP-Traj-Sparse approaches clearly outperform the other algorithms in terms of computational cost.

Increasing Nonlinearity
In a problem with fairly accurate and high-rate measurements, both the GP-Traj-Sparse-LTI and GP-Traj-Sparse-NTV estimators provide similar accuracy. In order to expose the benefit of a nonlinear prior based on the expected motion of the vehicle, we increase the nonlinearity of the problem by reducing measurement frequency.
The result of varying range measurement frequency, with and without the use of odometry measurements, is shown in Figure 6. In general, it is clear that as the interval between range measurements is increased, the GP-Traj-Sparse-NTV estimator is able to produce a more accurate estimate of the continuous-time pose (translation and rotation) than the GP-Traj-Sparse-LTI estimator.
In the case that the 1 Hz odometry measurements are available, as seen in Figure 6(a), the difference in the rotation estimates is small, because the GP-Traj-Sparse-LTI estimator has a good amount of information about its heading; however, in the case that the odometry measurements are unavailable, as seen in Figure 6(b), the advantage of the nonlinear prior implemented by the GP-Traj-Sparse-NTV estimator is prominent with respect to the rotational estimate.
In order to gain some qualitative intuition about how the continuous-time pose estimates are affected by the reduction of measurements, Figure 7 shows the trajectories for the same small subsection as presented in Figure 4; the estimates used an interval between range measurements of 7 seconds and are shown with and without the use of odometry measurements. In both plots, it is clear that the GP-Traj-Sparse-NTV estimator matches the ground-truth more closely, as previously indicated by the error plots in Figure 6.

Discussion and Future Work
It is worth elaborating on a few issues. The main reason that the W xx block is sparse in our approach, as compared to Tong et al. (2013), is that we reintroduced velocity variables that had effectively been marginalized out. This idea of reintroducing variables to regain exact sparsity has been used before by Eustice et al. (2006) in the delayed state filter and by Walter et al. (2007) in the extended information filter. This is a good lesson to heed: the underlying structure of a problem may be exactly sparse, but by marginalizing out variables it appears dense. For us this means we need to use a Markovian trajectory state that is appropriate to our prior.
In much of mobile robotics, odometry measurements are treated more like inputs to the mean of the prior than pure measurements. We believe this is a confusing thing to do as it conflates two sources of uncertainty: the prior over trajectories and the odometry measurement noise. In our frame-Increasing Nonlinearity (a) RMS errors using odometry measurements.
Increasing Nonlinearity (b) RMS errors without using odometry measurements.

Fig. 6
Plots comparing use of the GP-Traj-Sparse-LTI and -NTV algorithms for an increasingly nonlinear problem; the dataset was made more nonlinear by varying the interval between available range measurements. The results in (a) used the odometry measurements available at 1 Hz, while (b) was made to be even more nonlinear by excluding the use of odometry measurements. The plots show that for a small interval between range measurements, both estimators perform similarly; as the interval was increased, the estimate provided by the nonlinear prior is consistently better in both translation and angular error. Notably, when odometry is available, both estimators are able to achieve a similar orientation performance; the negative effect of removing odometry measurements is more prominent on the linear prior estimator.
(b) Without odometry measurements. Fig. 7 Plots showing the GP-Traj-Sparse-LTI and -NTV estimates for the same small trajectory subsection as Figure 4, with an interval between range measurements of 7 seconds. Results in (a) used odometry measurements, while (b) did not.
work, we have deliberately separated these two functions and believe this is easier to work with and understand. We can see these two functions directly in Figure 3, where the prior is made up of binary factors joining consecutive trajectory states, and odometry measurements are unary factors attached to some of the trajectory states (we could have used binary odometry factors but chose to set things up this way due to the fact that we were explicitly estimating velocity).
While our analysis appears to be restricted to a small class of covariance functions, we have only framed our discussions in the context of robotics. Recent developments from machine learning (Hartikainen and Särkkä, 2010) and signal processing  have shown that it is possible to generate other well-known covariance functions using a LTV SDE (some exactly and some approximately). This means they can be used with our framework. One example is the Matérn covariance family (Rasmussen and Williams, 2006), where σ, ν, > 0 are magnitude, smoothness, and lengthscale parameters, Γ(·) is the gamma function, and K ν (·) is the modified Bessel function. For example, if we let with ν = p + 1 2 with p = 1 and use the following SDE: where λ = √ 2ν/ and w(t) ∼ GP (0, Q C δ(t − t )) (our usual white noise) with power spectral density matrix, then we have that p(t) is distributed according to the Matérn covariance family: p(t) ∼ GP(0,P m (t, t )) with p = 1. Another way to look at this is that passing white noise through LTV SDEs produces particular coloured-noise priors (i.e., not flat across all frequencies).
In terms of future work, we plan to incorporate the dynamics (i.e., kinematics plus Newtonian mechanics) of a robot platform into the GP priors; real sensors do not move arbitrarily through the world as they are usually attached to massive robots and this serves to constrain the motion. Another idea is to incorporate latent force models into our GP priors (e.g., see Alvarez et al. (2009) or Hartikainen et al. (2012)). We also plan to look further at the sparsity of STEAM and integrate our work with modern solvers to tackle large-scale problems; this should allow us to exploit more than just the primary sparsity of the problem and do so in an online manner.

Conclusion
We have considered continuous-discrete estimation problems where a trajectory is viewed as a one-dimensional Gaussian process (GP), with time as the independent variable and measurements acquired at discrete times. Querying the trajectory can be viewed as nonlinear, GP regression. Our main contribution in this paper is to show that this querying can be accomplished very efficiently. To do this, we exploited the Markov property of our GP priors (generated by nonlinear, time-varying stochastic differential equations driven by white noise) to construct an inverse kernel matrix that is sparse. This makes it fast to solve for the state at the measurement times (as is commonly done in vision and robotics) but also at any other time(s) of interest through GP interpolation. Other implications of this sparsity were discussed with respect to hyperparameter training, and including measurements at query times. We also considered a slight generalization of the SLAM problem, simultaneous trajectory estimation and mapping (STEAM), which makes use of a continuous-time trajectory prior and allows us to query the state at any time of interest in an efficient manner. We hope this paper serves to deepen the connection between classical state estimation theory and recent machine learning methods by viewing batch estimation through the lens of Gaussian process regression.