0.2.0
Loading...
Searching...
No Matches
VanLoan.hpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
13
14#pragma once
15
16#include <utility>
17#include <Eigen/Core>
18#include <unsupported/Eigen/MatrixFunctions>
19
20namespace NAV
21{
22
60template<typename DerivedF, typename DerivedG, typename DerivedW>
61[[nodiscard]] std::pair<typename DerivedF::PlainObject, typename DerivedF::PlainObject>
62 calcPhiAndQWithVanLoanMethod(const Eigen::MatrixBase<DerivedF>& F,
63 const Eigen::MatrixBase<DerivedG>& G,
64 const Eigen::MatrixBase<DerivedW>& W,
65 typename DerivedF::Scalar dt)
66{
67 // ┌ ┐
68 // │ -F ┊ GWG^T│
69 // A = │------------│ * dT
70 // │ 0 ┊ F^T │
71 // └ ┘
72 // W = Power Spectral Density of u (See Brown & Hwang (2012) chapter 3.9, p. 126 - footnote)
73 // W = Identity, as noise scale factor is included within G matrix
74 Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, Eigen::Dynamic>
75 A = Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, Eigen::Dynamic>::Zero(2 * F.rows(), 2 * F.cols());
76 A.topLeftCorner(F.rows(), F.cols()) = -F;
77 A.topRightCorner(F.rows(), F.cols()) = G * W * G.transpose();
78 A.bottomRightCorner(F.rows(), F.cols()) = F.transpose();
79 A *= dt;
80
81 // Exponential Matrix of A (https://eigen.tuxfamily.org/dox/unsupported/group__MatrixFunctions__Module.html#matrixbase_exp)
82 Eigen::Matrix<typename DerivedF::Scalar, Eigen::Dynamic, Eigen::Dynamic> B = A.exp();
83
84 // ┌ ┐
85 // │ ... ┊ Phi^-1 Q │
86 // B = expm(A) = │----------------│
87 // │ 0 ┊ Phi^T │
88 // └ ┘
89 typename DerivedF::PlainObject Phi = B.bottomRightCorner(F.rows(), F.cols()).transpose();
90 typename DerivedF::PlainObject Q = Phi * B.topRightCorner(F.rows(), F.cols());
91
92 return { Phi, Q };
93}
94
95} // namespace NAV
std::pair< typename DerivedF::PlainObject, typename DerivedF::PlainObject > calcPhiAndQWithVanLoanMethod(const Eigen::MatrixBase< DerivedF > &F, const Eigen::MatrixBase< DerivedG > &G, const Eigen::MatrixBase< DerivedW > &W, typename DerivedF::Scalar dt)
Numerical Method to calculate the State transition matrix 𝚽 and System/Process noise covariance matri...
Definition VanLoan.hpp:62