1#ifndef ROBOTOC_UNCONSTR_KKT_MATRIX_INVERTER_HXX_
2#define ROBOTOC_UNCONSTR_KKT_MATRIX_INVERTER_HXX_
12 : llt_H_(3*robot.dimv()),
13 llt_S_(2*robot.dimv()),
14 FHinv_(Eigen::MatrixXd::
Zero(2*robot.dimv(), 3*robot.dimv())),
15 S_(Eigen::MatrixXd::
Zero(2*robot.dimv(), 2*robot.dimv())),
17 dimx_(2*robot.dimv()),
18 dimH_(3*robot.dimv()),
19 dimkkt_(5*robot.dimv()) {
39template <
typename MatrixType1,
typename MatrixType2>
41 const double dt,
const Eigen::MatrixBase<MatrixType1>& H,
42 const Eigen::MatrixBase<MatrixType2>& KKT_mat_inv) {
44 assert(KKT_mat_inv.rows() == dimkkt_);
45 assert(KKT_mat_inv.cols() == dimkkt_);
47 assert(llt_H_.info() == Eigen::Success);
48 const_cast<Eigen::MatrixBase<MatrixType2>&
> (KKT_mat_inv).bottomRightCorner(dimH_, dimH_).noalias()
49 = llt_H_.solve(Eigen::MatrixXd::Identity(dimH_, dimH_));
51 = - KKT_mat_inv.block(3*dimv_, 2*dimv_, dimv_, 3*dimv_)
52 + dt * KKT_mat_inv.block(4*dimv_, 2*dimv_, dimv_, 3*dimv_);
53 FHinv_.bottomRows(dimv_)
54 = dt * KKT_mat_inv.block(2*dimv_, 2*dimv_, dimv_, 3*dimv_)
55 - KKT_mat_inv.block(4*dimv_, 2*dimv_, dimv_, 3*dimv_);
56 S_.topLeftCorner(dimv_, dimv_)
57 = - FHinv_.block(0, dimv_, dimv_, dimv_)
58 + dt * FHinv_.block(0, 2*dimv_, dimv_, dimv_);
59 S_.topRightCorner(dimv_, dimv_)
60 = dt * FHinv_.block(0, 0, dimv_, dimv_)
61 - FHinv_.block(0, 2*dimv_, dimv_, dimv_);
62 S_.bottomLeftCorner(dimv_, dimv_)
63 = - FHinv_.block(dimv_, dimv_, dimv_, dimv_)
64 + dt * FHinv_.block(dimv_, 2*dimv_, dimv_, dimv_);
65 S_.bottomRightCorner(dimv_, dimv_)
66 = dt * FHinv_.block(dimv_, 0, dimv_, dimv_)
67 - FHinv_.block(dimv_, 2*dimv_, dimv_, dimv_);
69 assert(llt_S_.info() == Eigen::Success);
70 const_cast<Eigen::MatrixBase<MatrixType2>&
> (KKT_mat_inv).topLeftCorner(dimx_, dimx_).noalias()
71 = - llt_S_.solve(Eigen::MatrixXd::Identity(dimx_, dimx_));
72 const_cast<Eigen::MatrixBase<MatrixType2>&
> (KKT_mat_inv).topRightCorner(dimx_, dimH_).noalias()
73 = - KKT_mat_inv.topLeftCorner(dimx_, dimx_) * FHinv_;
74 const_cast<Eigen::MatrixBase<MatrixType2>&
> (KKT_mat_inv).bottomLeftCorner(dimH_, dimx_)
75 = KKT_mat_inv.topRightCorner(dimx_, dimH_).transpose();
76 const_cast<Eigen::MatrixBase<MatrixType2>&
> (KKT_mat_inv).bottomRightCorner(dimH_, dimH_).noalias()
77 -= KKT_mat_inv.topRightCorner(dimx_, dimH_).transpose()
78 * S_ * KKT_mat_inv.topRightCorner(dimx_, dimH_);
Dynamics and kinematics model of robots. Wraps pinocchio::Model and pinocchio::Data....
Definition: robot.hpp:32
UnconstrKKTMatrixInverter()
Default constructor.
Definition: unconstr_kkt_matrix_inverter.hxx:23
~UnconstrKKTMatrixInverter()
Destructor.
Definition: unconstr_kkt_matrix_inverter.hxx:35
void invert(const double dt, const Eigen::MatrixBase< MatrixType1 > &H, const Eigen::MatrixBase< MatrixType2 > &KKT_mat_inv)
Computes the inverse of the split KKT matrix of the time stage.
Definition: unconstr_kkt_matrix_inverter.hxx:40
Definition: constraint_component_base.hpp:17