navlie.types.ProcessModel¶
- class navlie.types.ProcessModel¶
Bases:
ABC
Abstract process model base class for process models of the form
\[\mathcal{X}_k = f(\mathcal{X}_{k-1}, \mathbf{u}_{k-1}, \Delta t) \oplus \mathbf{w}_{k}\]where \(\mathbf{u}_{k-1}\) is the input, \(\Delta t\) is the time period between the two states, and \(\mathbf{w}_{k} \sim \mathcal{N}(\mathbf{0}, \mathbf{Q}_k)\) is additive Gaussian noise.
To define a process model, you must inherit from this class and implement the
evaluate
method. You must also specify covariance information in one of either two ways.1. Specifying the covariance matrix directly:
The first way is to specify the \(\mathbf{Q}_k\) covariance matrix directly by overriding the
covariance
method. This covariance matrix represents the distribution of process model errors directly.2. Specifing the covariance of additive noise on the input: The second way is to specify the covariance of noise that is additive to the input. That is, if the process model is of the form
\[\mathcal{X}_k = f(\mathcal{X}_{k-1}, \mathbf{u}_{k-1} + \mathbf{w}^u_{k-1}, \Delta t)\]where \(\mathbf{w}^u_{k-1} \sim \mathcal{N}(\mathbf{0}, \mathbf{Q}^u_{k-1})\). In this case, you should override the
input_covariance
method, at which point the covariance of the process model error is approximated using a linearization procedure,\[\mathbf{Q}_k = \mathbf{L} \mathbf{Q}^u_{k-1} \mathbf{L}^T\]where \(\mathbf{L} = D \mathbf{f}(\mathcal{X}_{k-1}, \mathbf{u}_{k-1}, dt) / D \mathbf{u}_{k-1}\) is the input jacobian. This is calculated using finite difference by default, but can be overridden by implementing the
input_jacobian
method.- abstract evaluate(x: State, u: Input, dt: float) → State¶
Implementation of \({f}(\mathcal{X}_{k-1}, \mathbf{u}, \Delta t)\).
- covariance(x: State, u: Input, dt: float) → ndarray¶
Covariance matrix \(\mathbf{Q}_k\) of the additive Gaussian noise \(\mathbf{w}_{k} \sim \mathcal{N}(\mathbf{0}, \mathbf{Q}_k)\). If this method is not overridden, the covariance of the process model error is approximated from the input covariance using a linearization procedure, with the input Jacobian evaluated using finite difference.
- jacobian(x: State, u: Input, dt: float) → ndarray¶
Implementation of the process model Jacobian with respect to the state.
\[\mathbf{F} = \frac{D {f}(\mathcal{X}_{k-1}, \mathbf{u}, \Delta t)}{D \mathcal{X}_{k-1}}\]
- evaluate_with_jacobian(x: ~navlie.types.State, u: ~navlie.types.Input, dt: float) -> (<class 'navlie.types.State'>, <class 'numpy.ndarray'>)¶
Evaluates the process model and simultaneously returns the Jacobian as its second output argument. This is useful to override for performance reasons when the model evaluation and Jacobian have a lot of common calculations, and it is more efficient to calculate them in the same function call.
- jacobian_fd(x: State, u: Input, dt: float, step_size=1e-06, *args, **kwargs) → ndarray¶
Calculates the model jacobian with finite difference.
- input_jacobian_fd(x: State, u: Input, dt: float, step_size=1e-06, *args, **kwargs) → ndarray¶
Calculates the input jacobian with finite difference.