-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathkalman.hpp
653 lines (581 loc) · 27.5 KB
/
kalman.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
/* __ _ __ __ _ _
| |/ / /\ | | | \/ | /\ | \ | |
| ' / / \ | | | \ / | / \ | \| |
| < / /\ \ | | | |\/| | / /\ \ | . ` |
| . \ / ____ \| |____| | | |/ ____ \| |\ |
|_|\_\/_/ \_\______|_| |_/_/ \_\_| \_|
Kalman Filter
Version 0.2.0
https://github.com/FrancoisCarouge/Kalman
SPDX-License-Identifier: Unlicense
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org> */
#ifndef FCAROUGE_KALMAN_HPP
#define FCAROUGE_KALMAN_HPP
//! @file
//! @brief The Kalman filter class and library top-level header.
//!
//! @details Provides the library public definitions of filters, algorithms,
//! utilities, and documentation. Only this header file is intended for
//! inclusion in third party software.
#include "algorithm.hpp"
#include "internal/format.hpp"
#include "internal/kalman.hpp"
#include "utility.hpp"
#include <concepts>
#include <cstddef>
#include <functional>
#include <type_traits>
#include <utility>
namespace fcarouge {
//! @brief A generic Kalman filter.
//!
//! @details The Kalman filter is a Bayesian filter that uses multivariate
//! Gaussians, a recursive state estimator, a linear quadratic estimator (LQE),
//! and an Infinite Impulse Response (IIR) filter. It is a control theory tool
//! applicable to signal estimation, sensor fusion, or data assimilation
//! problems. The filter is applicable for unimodal and uncorrelated
//! uncertainties. The filter assumes white noise, propagation and measurement
//! functions are differentiable, and that the uncertainty stays centered on the
//! state estimate. The filter is the optimal linear filter under assumptions.
//! The filter updates estimates by multiplying Gaussians and predicts estimates
//! by adding Gaussians. Designing a filter is as much art as science. Design
//! the state $X$, $P$, the process $F$, $Q$, the measurement $Z$, $R$, the
//! measurement function $H$, and if the system has control inputs $U$, $G$.
//!
//! This library supports various simple and extended filters. The
//! implementation is independent from linear algebra backends. Arbitrary
//! parameters can be added to the prediction and update stages to participate
//! in gain-scheduling or linear parameter varying (LPV) systems. The default
//! filter type is a generalized, customizable, and extended filter. The default
//! type parameters implement a one-state, one-output, and double-precision
//! floating-point type filter. The default update equation uses the Joseph
//! form. Examples illustrate various usages and implementation tradeoffs. A
//! standard formatter specialization is included for representation of the
//! filter states. Filters with `state x output x input` dimensions as 1x1x1 and
//! 1x1x0 (no input) are supported through vanilla C++. Higher dimension filters
//! require a linear algebra backend. Customization points and type injections
//! allow for implementation tradeoffs.
//!
//! @tparam State The type template parameter of the state column vector x.
//! State variables can be observed (measured), or hidden variables (inferred).
//! This is the the mean of the multivariate Gaussian. Defaults to `double`.
//! @tparam Output The type template parameter of the measurement column vector
//! z. Defaults to `double`.
//! @tparam Input The type template parameter of the control u. A `void` input
//! type can be used for systems with no input control to disable all of the
//! input control features, the control transition matrix G support, and the
//! other related computations from the filter. Defaults to `void`.
//! @tparam UpdateTypes The additional update function parameter types passed in
//! through a tuple-like parameter type, composing zero or more types.
//! Parameters such as delta times, variances, or linearized values. The
//! parameters are propagated to the function objects used to compute the state
//! observation H and the observation noise R matrices. The parameters are also
//! propagated to the state observation function object h. Defaults to no
//! parameter types, the empty pack.
//! @tparam PredictionTypes The additional prediction function parameter types
//! passed in through a tuple-like parameter type, composing zero or more types.
//! Parameters such as delta times, variances, or linearized values. The
//! parameters are propagated to the function objects used to compute the
//! process noise Q, the state transition F, and the control transition G
//! matrices. The parameters are also propagated to the state transition
//! function object f. Defaults to no parameter types, the empty pack.
//!
//! @note This class could be usable in constant expressions if `std::function`
//! could too. The polymorphic function wrapper was used in place of function
//! pointers to enable default initialization from this class, captured member
//! variables.
//!
//! @todo Is this filter restricted to Newton's equations of motion? That is
//! only a discretized continuous-time kinematic filter? How about non-Newtonian
//! systems?
//! @todo Would it be beneficial to support initialization list for
//! characteristics?
//! @todo Symmetrization support might be superfluous. How to confirm it is safe
//! to remove?
//! @todo Would we want to support smoothers?
//! @todo How to add or associate constraints on the types and operation to
//! support compilation and semantics?
//! @todo Which constructors to support? Consider constructors? CTAD? Guides?
//! @todo Prepare support for larger dataset recording for graphing, metrics of
//! large test data to facilitate tuning.
//! @todo Support filter generator? Integration? Reflection in C++...
//! @todo Compare performance of general filter with its equivalent generated?
//! @todo Support ranges operator filter?
//! @todo Support mux pipes https://github.com/joboccara/pipes operator filter?
//! @todo Reproduce Ardupilot's inertial navigation EKF and comparison
//! benchmarks in SITL (software in the loop simulation).
//! @todo Should we provide the operator[] for the vector characteristics
//! regardless of implementation? And for the matrix ones too? It could simplify
//! client code.
//! @todo Should we provide the operator[] for state directly on the filter? Is
//! the state X always what the user would want?
//! @todo Consider if a fluent interface would be preferable for
//! characteristics?
//! @todo Consider additional characteristics method overloads?
//! @todo A clear or reset member equivalent may be useful for real-time
//! re-initializations but to what default?
//! @todo Expand std::format support with standard arguments and Eigen3 types.
//! @todo Support, test complex number filters?
//! @todo Use automatic (Eigen::AutoDiffScalar?), symbolic, numerical solvers to
//! define the filter characteristics and simplify solving the dynamic system
//! for non-mathematicians.
//! @todo Support, use "Taking Static Type-Safety to the Next Level - Physical
//! Units for Matrices" by Daniel Withopf and record the lesson learned: both
//! usage and development is harder without compile time units verification.
//! @todo Should we add back the call operator? How to resolve the
//! update/predict ordering? And parameter ordering?
//! @todo Should we support the noise cross covariance `N = E[wvᵀ]` for
//! correlated noise sources, with default to null?
//! @todo Can we implement Temporal Parallelization of Bayesian Smoothers, Simo
//! Sarkka, Senior Member, IEEE, Angel F. Garc ıa-Fernandez,
//! https://arxiv.org/pdf/1905.13002.pdf ?
template <typename State = double, typename Output = double,
typename Input = void, typename UpdateTypes = empty_pack,
typename PredictionTypes = empty_pack>
class kalman final {
private:
//! @name Private Member Types
//! @{
//! @brief Implementation details of the filter.
//!
//! @brief The internal implementation unpacks the parameter packs from
//! tuple-like types which allows for multiple parameter pack deductions.
using implementation =
internal::kalman<State, Output, Input, internal::repack_t<UpdateTypes>,
internal::repack_t<PredictionTypes>>;
//! @}
//! @name Private Member Variables
//! @{
//! @brief Encapsulates the implementation details of the filter.
implementation filter;
//! @}
public:
//! @name Public Member Types
//! @{
//! @brief Type of the state estimate column vector X.
using state = typename implementation::state;
//! @brief Type of the observation column vector Z.
//!
//! @details Also known as Y or O.
using output = typename implementation::output;
//! @brief Type of the control column vector U.
//!
//! @todo Conditionally remove this member type when no input is present.
using input = typename implementation::input;
//! @brief Type of the estimated correlated variance matrix P.
//!
//! @details Also known as Σ.
using estimate_uncertainty = typename implementation::estimate_uncertainty;
//! @brief Type of the process noise correlated variance matrix Q.
using process_uncertainty = typename implementation::process_uncertainty;
//! @brief Type of the observation noise correlated variance matrix R.
using output_uncertainty = typename implementation::output_uncertainty;
//! @brief Type of the state transition matrix F.
//!
//! @details Also known as the fundamental matrix, propagation, Φ, or A.
using state_transition = typename implementation::state_transition;
//! @brief Type of the observation transition matrix H.
//!
//! @details Also known as the measurement transition matrix or C.
using output_model = typename implementation::output_model;
//! @brief Type of the control transition matrix G.
//!
//! @details Also known as B.
//!
//! @todo Conditionally remove this member type when no input is present.
using input_control = typename implementation::input_control;
//! @brief Type of the gain matrix K.
using gain = typename implementation::gain;
//! @brief Type of the innovation column vector Y.
using innovation = typename implementation::innovation;
//! @brief Type of the innovation uncertainty matrix S.
using innovation_uncertainty =
typename implementation::innovation_uncertainty;
//! @}
//! @name Public Member Functions
//! @{
//! @brief Constructs a Kalman filter without configuration.
//!
//! @complexity Constant.
inline constexpr kalman() = default;
//! @brief Copy constructs a filter.
//!
//! @details Constructs the filter with the copy of the contents of the
//! `other` filter.
//!
//! @param other Another filter to be used as source to initialize the
//! elements of the filter with.
//!
//! @complexity Constant.
//!
//! @todo Implement and test.
inline constexpr kalman(const kalman &other) = delete;
//! @brief Move constructs a filter.
//!
//! @details Move constructor. Constructs the filter with the contents of
//! the `other` filter using move semantics (i.e. the data in `other`
//! filter is moved from the other into this filter).
//!
//! @param other Another filter to be used as source to initialize the
//! elements of the filter with.
//!
//! @complexity Constant.
//!
//! @todo Implement and test.
inline constexpr kalman(kalman &&other) noexcept = delete;
//! @brief Copy assignment operator.
//!
//! @details Destroys or copy-assigns the contents with a copy of the contents
//! of the other filter.
//!
//! @param other Another filter to be used as source to initialize the
//! elements of the filter with.
//!
//! @return The reference value of this implicit object filter parameter,
//! i.e. `*this`.
//!
//! @complexity Constant.
//!
//! @todo Implement and test.
inline constexpr auto operator=(const kalman &other) -> kalman & = delete;
//! @brief Move assignment operator.
//!
//! @details Replaces the contents of the filter with those of the `other`
//! filter using move semantics (i.e. the data in `other` filter is moved from
//! the other into this filter). The other filter is in a valid but
//! unspecified state afterwards.
//!
//! @param other Another filter to be used as source to initialize the
//! elements of the filter with.
//!
//! @return The reference value of this implicit object filter parameter,
//! i.e. `*this`.
//!
//! @complexity Constant.
//!
//! @todo Implement and test.
inline constexpr auto operator=(kalman &&other) noexcept -> kalman & = delete;
//! @brief Destructs the Kalman filter.
//!
//! @complexity Constant.
inline constexpr ~kalman() = default;
//! @}
//! @name Public Characteristics Member Functions
//! @{
//! @brief Returns the state estimate column vector X.
//!
//! @return The state estimate column vector X.
//!
//! @complexity Constant.
//!
//! @note Overloading the operator dot would have been nice had it existed.
//!
//! @todo Collapse cv-ref qualifier-aware member functions per C++23 P0847 to
//! avoid duplication: `inline constexpr auto & x(this auto&& self)`.
inline constexpr auto x() const -> const state &;
inline constexpr auto x() -> state &;
//! @brief Sets the state estimate column vector X.
//!
//! @param value The first copied initializer used to set the state estimate
//! column vector X.
//! @param values The optional second and other copied initializers to set the
//! state estimate column vector X.
//!
//! @complexity Constant.
inline constexpr void x(const auto &value, const auto &...values);
//! @brief Returns the last observation column vector Z.
//!
//! @return The last observation column vector Z.
//!
//! @complexity Constant.
inline constexpr auto z() const -> const output &;
//! @brief Returns the last control column vector U.
//!
//! @details This member function is not present when the filter has no input.
//!
//! @return The last control column vector U.
//!
//! @complexity Constant.
inline constexpr auto u() const
-> const input &requires(not std::is_same_v<Input, void>);
//! @brief Returns the estimated covariance matrix P.
//!
//! @return The estimated correlated variance matrix P.
//!
//! @complexity Constant.
inline constexpr auto p() const -> const estimate_uncertainty &;
inline constexpr auto p() -> estimate_uncertainty &;
//! @brief Sets the estimated covariance matrix P.
//!
//! @param value The first copied initializer used to set the estimated
//! covariance matrix P.
//! @param values The optional second and other copied initializers to set the
//! estimated covariance matrix P.
//!
//! @complexity Constant.
inline constexpr void p(const auto &value, const auto &...values);
//! @brief Returns the process noise covariance matrix Q.
//!
//! @return The process noise correlated variance matrix Q.
//!
//! @complexity Constant.
inline constexpr auto q() const -> const process_uncertainty &;
inline constexpr auto q() -> process_uncertainty &;
//! @brief Sets the process noise covariance matrix Q.
//!
//! @param value The first copied initializer used to set the process noise
//! covariance matrix Q is of type `process_uncertainty` and the function is
//! of the form `process_uncertainty(const state &, const PredictionTypes
//! &...)`. The copied process noise covariance matrix Q or the copied target
//! Callable object (function object, pointer to function, reference to
//! function, pointer to member function, or pointer to data member) that will
//! be bound to the prediction arguments and called by the filter to compute
//! the process noise covariance matrix Q on prediction steps.
//! @param values The optional second and other copied initializers to set the
//! process noise covariance matrix Q.
//!
//! @complexity Constant.
inline constexpr void q(const auto &value, const auto &...values);
//! @brief Returns the observation noise covariance
//! matrix R.
//!
//! @details The variance there is in each measurement.
//!
//! @return The observation noise correlated variance matrix R.
//!
//! @complexity Constant.
inline constexpr auto r() const -> const output_uncertainty &;
inline constexpr auto r() -> output_uncertainty &;
//! @brief Sets the observation noise covariance matrix R.
//!
//! @param value The first copied initializer used to set the observation
//! noise covariance matrix R is of type `output_uncertainty` and the function
//! is of the form `output_uncertainty(const state &, const output &, const
//! UpdateTypes &...)`. The copied observation noise covariance matrix R or
//! the copied target Callable object (function object, pointer to function,
//! reference to function, pointer to member function, or pointer to data
//! member) that will be called by the filter to compute the observation noise
//! covariance matrix R on prediction steps.
//! @param values The optional second and other copied initializers to set the
//! observation noise covariance matrix R.
//!
//! @complexity Constant.
inline constexpr void r(const auto &value, const auto &...values);
//! @brief Returns the state transition matrix F.
//!
//! @return The state transition matrix F.
//!
//! @complexity Constant.
inline constexpr auto f() const -> const state_transition &;
inline constexpr auto f() -> state_transition &;
//! @brief Sets the state transition matrix F.
//!
//! @details The state transition matrix F is of type `state_transition` and
//! the function is of the form `state_transition(const state &, const input
//! &, const PredictionTypes &...)`. For non-linear system, or extended
//! filter, F is the Jacobian of the state transition function: `F = ∂f/∂X =
//! ∂fj/∂xi` that is each row i contains the derivatives of the state
//! transition function for every element j in the state column vector X.
//!
//! @param value The first copied initializer used to set the copied state
//! transition matrix F or the copied target Callable object (function object,
//! pointer to function, reference to function, pointer to member function, or
//! pointer to data member) that will be bound to the prediction arguments and
//! called by the filter to compute the state transition matrix F function on
//! prediction steps.
//! @param values The optional second and other copied initializers to set the
//! state transition matrix F.
//!
//! @complexity Constant.
inline constexpr void f(const auto &value, const auto &...values);
//! @brief Returns the observation transition matrix H.
//!
//! @return The observation, measurement transition matrix H.
//!
//! @complexity Constant.
inline constexpr auto h() const -> const output_model &;
inline constexpr auto h() -> output_model &;
//! @brief Sets the observation transition matrix H.
//!
//! @details The observation transition matrix H is of type `output_model` and
//! the function is of the form `output_model(const state &, const UpdateTypes
//! &...)`. For non-linear system, or extended filter, H is the Jacobian of
//! the state observation function: `H = ∂h/∂X = ∂hj/∂xi` that is each row i
//! contains the derivatives of the state observation function for every
//! element j in the state column vector X.
//!
//! @param value The first copied initializer used to set the copied
//! observation transition matrix H or the copied target Callable object
//! (function object, pointer to function, reference to function, pointer to
//! member function, or pointer to data member) that will be bound to the
//! prediction arguments and called by the filter to compute the observation,
//! measurement transition matrix H on update steps.
//! @param values The optional second and other copied initializers to set the
//! observation transition matrix H.
//!
//! @complexity Constant.
inline constexpr void h(const auto &value, const auto &...values);
//! @brief Returns the control transition matrix G.
//!
//! @details This member function is not present when the filter has no input.
//!
//! @return The control transition matrix G.
//!
//! @complexity Constant.
inline constexpr auto g() const
-> const input_control &requires(not std::is_same_v<Input, void>);
inline constexpr auto g()
-> input_control &requires(not std::is_same_v<Input, void>);
//! @brief Sets the control transition matrix G.
//!
//! @details The control transition matrix G is of type `input_control` and
//! the function is of the form `input_control(const PredictionTypes &...)`.
//! This member function is not present when the filter has no input.
//!
//! @param value The first copied initializer used to set the copied control
//! transition matrix G or the copied target Callable object (function object,
//! pointer to function, reference to function, pointer to member function, or
//! pointer to data member) that will be bound to the prediction arguments and
//! called by the filter to compute the control transition matrix G on
//! prediction steps.
//! @param values The optional second and other copied initializers to set the
//! control transition matrix G.
//!
//! @complexity Constant.
inline constexpr void g(const auto &value, const auto &...values)
requires(not std::is_same_v<Input, void>);
//! @brief Returns the gain matrix K.
//!
//! @return The gain matrix K.
//!
//! @complexity Constant.
inline constexpr auto k() const -> const gain &;
//! @brief Returns the innovation column vector Y.
//!
//! @return The innovation column vector Y.
//!
//! @complexity Constant.
//!
//! @todo Add measurement post-fit residual by default and example?
inline constexpr auto y() const -> const innovation &;
//! @brief Returns the innovation uncertainty matrix S.
//!
//! @return The innovation uncertainty matrix S.
//!
//! @complexity Constant.
inline constexpr auto s() const -> const innovation_uncertainty &;
//! @brief Sets the extended state transition function f(x).
//!
//! @param callable The copied target Callable object (function object,
//! pointer to function, reference to function, pointer to member function, or
//! pointer to data member) that will be called to compute the next state X on
//! prediction steps of expression `state(const state &, const input &, const
//! PredictionTypes &...)`. The default function `f(x) = F * X` is suitable
//! for linear systems. For non-linear system, or extended filter, implement a
//! linearization of the transition function f and the state transition F
//! matrix is the Jacobian of the state transition function.
//!
//! @complexity Constant.
inline constexpr void transition(const auto &callable);
//! @brief Sets the extended state observation function h(x).
//!
//! @param callable The copied target Callable object (function object,
//! pointer to function, reference to function, pointer to member function, or
//! pointer to data member) that will be called to compute the observation Z
//! on update steps of expression `output(const state &, const UpdateTypes
//! &...arguments)`. The default function `h(x) = H * X` is suitable for
//! linear systems. For non-linear system, or extended filter, the client
//! implements a linearization of the observation function hand the state
//! observation H matrix is the Jacobian of the state observation function.
//!
//! @complexity Constant.
inline constexpr void observation(const auto &callable);
//! @}
//! @name Public Filtering Member Functions
//! @{
//! @brief Produces estimates of the state variables and uncertainties.
//!
//! @details Also known as the propagation step. Implements the total
//! probability theorem. Estimate the next state by suming the known
//! probabilities.
//!
//! @param arguments The prediction and input parameters of
//! the filter, in that order. The arguments need to be compatible with the
//! filter types. The prediction parameters convertible to the
//! `PredictionTypes` template pack types are passed through for computations
//! of prediction matrices. The control parameter pack types convertible to
//! the `Input` template type. The prediction types are explicitly defined
//! with the class definition.
//!
//! @todo Consider if returning the state column vector X would be preferable?
//! Or fluent interface? Would be compatible with an ES-EKF implementation?
//! @todo Can the parameter pack of `PredictionTypes` be explicit in the
//! method declaration for user clarity?
inline constexpr void predict(const auto &...arguments);
//! @brief Returns the Nth prediction argument.
//!
//! @details Convenience access to the last used prediction arguments.
//!
//! @tparam The non-type template parameter index position of the prediction
//! argument types.
//!
//! @return The prediction argument corresponding to the Nth position of the
//! parameter pack of the tuple-like `PredictionTypes` class template type.
//!
//! @complexity Constant.
template <std::size_t Position> inline constexpr auto predict() const;
//! @brief Updates the estimates with the outcome of a measurement.
//!
//! @details Also known as the observation or correction step. Implements the
//! Bayes' theorem. Combine one measurement and the prior estimate by applying
//! the multiplicative law.
//!
//! @param arguments The update and output parameters of
//! the filter, in that order. The arguments need to be compatible with the
//! filter types. The update parameters convertible to the
//! `UpdateTypes` template pack types are passed through for computations of
//! update matrices. The observation parameter pack types convertible to
//! the `Output` template type. The update types are explicitly
//! defined with the class definition.
//!
//! @todo Consider if returning the state column vector X would be preferable?
//! Or fluent interface? Would be compatible with an ES-EKF implementation?
//! @todo Can the parameter pack of `UpdateTypes` be explicit in the method
//! declaration for user clarity?
inline constexpr void update(const auto &...arguments);
//! @brief Returns the Nth update argument.
//!
//! @details Convenience access to the last used update arguments.
//!
//! @tparam The non-type template parameter index position of the update
//! argument types.
//!
//! @return The update argument corresponding to the Nth position of the
//! parameter pack of the tuple-like `UpdateTypes` class template type.
//!
//! @complexity Constant.
template <std::size_t Position> inline constexpr auto update() const;
//! @}
};
} // namespace fcarouge
#include "internal/kalman.tpp"
#endif // FCAROUGE_KALMAN_HPP