2
3
4
5
6
7
8
9
10
11
12
13
14
15
17#ifndef GNC_NAVIGATION_EKF_EKF_TIME_UPDATE_HPP
18#define GNC_NAVIGATION_EKF_EKF_TIME_UPDATE_HPP
20#include "core/Matrix.hpp"
21#include "core/CartesianVector.hpp"
22#include "core/matrixmath.hpp"
23#include "core/vectormath.hpp"
24#include "utils/Rates.hpp"
25#include "utils/Integrator.hpp"
30
31
32 template <
typename T,
unsigned int N>
43 int runUpdate(T time_prev,
const std::array<T, N> &state_prev,
const Matrix<T, N, N> &cov_prev,
44 T time_up, std::array<T, N> *state_up,
Matrix<T, N, N> *cov_up);
55 std::array<T, N + N*N> _full_state_initial;
56 std::array<T, N + N*N> _full_state_post;
57 Matrix<T, N, N> _phi_transpose;
60 template<
typename T,
unsigned int N>
62 T time_up, std::array<T, N> *state_up,
Matrix<T, N, N> *cov_up) {
69 unsigned int one_idx = N;
70 for(
unsigned int i = 0; i < N + N*N; i++) {
72 _full_state_initial[i] = state_prev[i];
73 }
else if(i == one_idx) {
74 _full_state_initial[i] = 1.0;
75 one_idx = one_idx + N + 1;
77 _full_state_initial[i] = 0.0;
82 integrator_ptr->step(time_prev, time_up, _full_state_initial, _full_state_post);
85 phi.setFromArray(&_full_state_post[N]);
86 phi.transpose(_phi_transpose);
89 for(
unsigned int i = 0; i < N; i++) {
90 (*state_up)[i] = _full_state_post[i];
92 *cov_up =
phi*cov_prev*_phi_transpose;
Class to perform EKF time update step.
Definition EkfTimeUpdate.hpp:33
Matrix< T, N, N > phi
Optional return of the phi matrix calculated by EKF.
Definition EkfTimeUpdate.hpp:53
Integrator< T, N+N *N > * integrator_ptr
The integrator to be used internally by the EKF stepper. This integrator should be pre-configured to ...
Definition EkfTimeUpdate.hpp:50
int runUpdate(T time_prev, const std::array< T, N > &state_prev, const Matrix< T, N, N > &cov_prev, T time_up, std::array< T, N > *state_up, Matrix< T, N, N > *cov_up)
Function to run a single extended kalman filter time update step.
Definition EkfTimeUpdate.hpp:61
This class is a base implementation of the integrator. It defines the basic functions and components ...
Definition Integrator.hpp:37
Matrix math implementation.
Definition Matrix.hpp:54
#define NO_ERROR
Definition clockwerkerrors.h:31
#define ERROR_NULLPTR
Definition clockwerkerrors.h:57