Spline Error Weighting¶
This module implements Spline Error Weighting (SEW), introduced by [Ovren2018a].
SEW is a method to automatically set knot spacing, and estimate the spline fit error (approximation error), using gyroscope and accelerometer data.
To estimate the knot spacings for a SplitTrajectory
you would do the following:
so3_dt, so3_var = knot_spacing_and_variance(gyro_data, gyro_timestamps, q_gyro)
r3_dt, r3_var = knot_spacing_and_variance(acc_data, acc_timestamps, q_acc)
trajectory = SplitTrajectory(r3_dt, so3_dt)
References
[Ovren2018a] | Ovrén, H. and Forssén, P-E. Spline Error Weighting for Robust Visual-Inertial Fusion In Proceedings of the IEEE on Computer Vision and Pattern Recognition (CVPR) June 2018 |
[Mihajlovic1999] | Mihajlovic, Z.; Goluban, A.; and Zagar, M. Frequency Domain Analysis of B-Spline Interpolation In Proceedings of the IEEE International Symposium on Industrial Electronics July 1999 |
-
kontiki.sew.
knot_spacing_and_variance
(signal, times, quality, *, min_dt=None, max_dt=None, verbose=False)¶ Find knot spacing and variance from signal
Given a quality value, this function first determines the maximum knot spacing that achieves this quality, given the data in signal. It then computes the estimated variance of the spline fit error, using this knot spacing.
Parameters: - signal (ndarray) – Signal to fit to (e.g. accelerometer or gyroscope)
- times (ndarray) – Timestamps of signal
- quality (float) – Requested quality, in the range 0-1. A good value is usually around 0.99.
- min_dt (float) – Lowest acceptable value of knot spacing
- max_dt (float) – Highest acceptable value of knot spacing
- verbose (bool) – Print search steps
Returns: - dt (float) – The found knot spacing
- var (float) – The spline fit error for this signal and knot spacing
-
kontiki.sew.
spline_interpolation_response
(freqs, dt)¶ Cubic B-spline interpolation frequency function
Implements the frequency response function of a cubic B-spline according to [Mihajlovic1999]
Parameters: - freqs (ndarray) – Frequencies in Hz
- dt (float) – Spline knot spacing
Returns: H – Frequency response function for frequencies freqs
Return type: ndarray