g2o
Toggle main menu visibility
Loading...
Searching...
No Matches
g2o
examples
target
continuous_to_discrete.h
Go to the documentation of this file.
1
#ifndef G2O_CONTINUOUS_TO_DISCRETE_H_
2
#define G2O_CONTINUOUS_TO_DISCRETE_H_
3
4
#include <iostream>
5
#include <unsupported/Eigen/MatrixFunctions>
6
7
// Form for fixed-size matrices
8
template
<
typename
MatrixType>
9
void
continuousToDiscrete
(MatrixType& Fd, MatrixType& Qd,
const
MatrixType& Fc,
10
const
MatrixType& Qc,
double
dt) {
11
enum
{
12
NX = MatrixType::ColsAtCompileTime,
13
NY = MatrixType::RowsAtCompileTime,
14
NX2 = 2 * MatrixType::RowsAtCompileTime
15
};
16
17
typedef
Eigen::Matrix<typename MatrixType::Scalar, NX2, NX2>
18
DoubleSizedMatrixType;
19
DoubleSizedMatrixType bigA(NX2, NX2), bigB(NX2, NX2);
20
21
// Construct the "big A matrix"
22
bigA.template topLeftCorner<NX, NX>() = -Fc * dt;
23
bigA.template topRightCorner<NX, NX>() = Qc * dt;
24
bigA.template bottomLeftCorner<NX, NX>().setZero();
25
bigA.template bottomRightCorner<NX, NX>() = Fc.transpose() * dt;
26
27
// bigB = expm(bigA)
28
// Eigen::MatrixExponential<DoubleSizedMatrixType> me(bigA);
29
// me.compute(bigB);
30
bigB = bigA.exp();
31
32
// Extract the discrete time components
33
Fd = bigB.template bottomRightCorner<NX, NX>().transpose();
34
Qd = Fd * bigB.template topRightCorner<NX, NX>();
35
}
36
37
#endif
// __CONTINUOUS_TO_DISCRETE_H__
continuousToDiscrete
void continuousToDiscrete(MatrixType &Fd, MatrixType &Qd, const MatrixType &Fc, const MatrixType &Qc, double dt)
Definition
continuous_to_discrete.h:9
Generated on
for g2o by
1.17.0