1#ifndef ROBOTOC_UNCONSTR_DYNAMICS_HPP_
2#define ROBOTOC_UNCONSTR_DYNAMICS_HPP_
105 return ID_.template lpNorm<p>();
115 return ID_.squaredNorm();
118 template <
typename MatrixType1,
typename MatrixType2>
120 const Eigen::MatrixBase<MatrixType2>& Ku)
const {
121 assert(Ka.rows() == dimv_);
122 assert(Ka.cols() == 2*dimv_);
123 assert(Ku.rows() == dimv_);
124 assert(Ku.cols() == 2*dimv_);
126 Ka.leftCols(dimv_), Ka.rightCols(dimv_),
127 const_cast<Eigen::MatrixBase<MatrixType2>&
>(Ku).leftCols(dimv_),
128 const_cast<Eigen::MatrixBase<MatrixType2>&
>(Ku).rightCols(dimv_));
131 template <
typename MatrixType1,
typename MatrixType2,
typename MatrixType3,
132 typename MatrixType4>
134 const Eigen::MatrixBase<MatrixType2>& Kav,
135 const Eigen::MatrixBase<MatrixType3>& Kuq,
136 const Eigen::MatrixBase<MatrixType4>& Kuv)
const {
137 assert(Kaq.rows() == dimv_);
138 assert(Kaq.cols() == dimv_);
139 assert(Kav.rows() == dimv_);
140 assert(Kav.cols() == dimv_);
141 assert(Kuq.rows() == dimv_);
142 assert(Kuq.cols() == dimv_);
143 assert(Kuv.rows() == dimv_);
144 assert(Kuv.cols() == dimv_);
145 const_cast<Eigen::MatrixBase<MatrixType3>&
>(Kuq) = dID_dq_;
146 const_cast<Eigen::MatrixBase<MatrixType3>&
>(Kuq).noalias() += dID_da_ * Kaq;
147 const_cast<Eigen::MatrixBase<MatrixType4>&
>(Kuv) = dID_dv_;
148 const_cast<Eigen::MatrixBase<MatrixType4>&
>(Kuv).noalias() += dID_da_ * Kav;
152 Eigen::VectorXd ID_, lu_condensed_;
153 Eigen::MatrixXd dID_dq_, dID_dv_, dID_da_, Quu_, Quu_dID_dq_, Quu_dID_dv_,
Dynamics and kinematics model of robots. Wraps pinocchio::Model and pinocchio::Data....
Definition: robot.hpp:32
Newton direction of the solution to the optimal control problem split into a time stage.
Definition: split_direction.hpp:20
The KKT matrix split into a time stage.
Definition: split_kkt_matrix.hpp:18
KKT residual split into each time stage.
Definition: split_kkt_residual.hpp:18
Solution to the optimal control problem split into a time stage.
Definition: split_solution.hpp:20
Inverse dynamics constraint without constraints (floating base or contacts).
Definition: unconstr_dynamics.hpp:20
UnconstrDynamics(const UnconstrDynamics &)=default
Default copy constructor.
double KKTError() const
Returns squared norm of the KKT residual, that is, the residual in the unconstrained dynamics constra...
Definition: unconstr_dynamics.hpp:114
void linearizeUnconstrDynamics(Robot &robot, const double dt, const SplitSolution &s, SplitKKTResidual &kkt_residual)
Linearizes the unconstrained dynamics constraint.
~UnconstrDynamics()=default
Default destructor.
void getStateFeedbackGain(const Eigen::MatrixBase< MatrixType1 > &Ka, const Eigen::MatrixBase< MatrixType2 > &Ku) const
Definition: unconstr_dynamics.hpp:119
UnconstrDynamics()
Default constructor.
UnconstrDynamics(UnconstrDynamics &&) noexcept=default
Default move constructor.
static void expandDual(const double dt, const SplitKKTMatrix &kkt_matrix, const SplitKKTResidual &kkt_residual, SplitDirection &d)
Expands the dual variables, i.e., computes the Newton direction of the condensed dual variable (Lagra...
void condenseUnconstrDynamics(SplitKKTMatrix &kkt_matrix, SplitKKTResidual &kkt_residual)
Condenses the unconstrained dynamics constraint.
UnconstrDynamics(const Robot &robot)
Constructs the inverse dynamics.
void evalUnconstrDynamics(Robot &robot, const SplitSolution &s)
Computes the residual in the unconstrained dynamics constraint.
void getStateFeedbackGain(const Eigen::MatrixBase< MatrixType1 > &Kaq, const Eigen::MatrixBase< MatrixType2 > &Kav, const Eigen::MatrixBase< MatrixType3 > &Kuq, const Eigen::MatrixBase< MatrixType4 > &Kuv) const
Definition: unconstr_dynamics.hpp:133
double primalFeasibility() const
Definition: unconstr_dynamics.hpp:104
void expandPrimal(SplitDirection &d) const
Expands the primal variables, i.e., computes the Newton direction of the condensed primal variable (c...
UnconstrDynamics & operator=(const UnconstrDynamics &)=default
Default copy operator.
Definition: constraint_component_base.hpp:17