1 #ifndef G2O_CONTINUOUS_TO_DISCRETE_H_ 2 #define G2O_CONTINUOUS_TO_DISCRETE_H_ 4 #include <unsupported/Eigen/MatrixFunctions> 8 template<
typename MatrixType>
10 const MatrixType& Fc,
const MatrixType& Qc,
double dt)
14 NX = MatrixType::ColsAtCompileTime,
15 NY = MatrixType::RowsAtCompileTime,
16 NX2 = 2 * MatrixType::RowsAtCompileTime
19 typedef Eigen::Matrix<typename MatrixType::Scalar,NX2,NX2> DoubleSizedMatrixType;
20 DoubleSizedMatrixType bigA(NX2,NX2), bigB(NX2,NX2);
23 bigA.template topLeftCorner<NX,NX>()=-Fc*dt;
24 bigA.template topRightCorner<NX,NX>()= Qc * dt;
25 bigA.template bottomLeftCorner<NX,NX>().setZero();
26 bigA.template bottomRightCorner<NX,NX>()=Fc.transpose() * dt;
34 Fd = bigB.template bottomRightCorner<NX,NX>().transpose();
35 Qd = Fd * bigB.template topRightCorner<NX,NX>();
38 #endif // __CONTINUOUS_TO_DISCRETE_H__ void continuousToDiscrete(MatrixType &Fd, MatrixType &Qd, const MatrixType &Fc, const MatrixType &Qc, double dt)