33 , _tau(model.getJointTorqueVariable())
34 , _fc(model.getModelContacts().getContactForcesVariable())
35 , _chi(
"chi", model.getJointTorqueVariable(), model.getModelContacts().getContactForcesVariable())
36 , _reducedProblemDataAreUpToDate(false)
38 , _InertiaMatrixInverseJchiT(model.nbDofs(), model.nbDofs())
39 , _InertiaMatrixInverseLinNonLinGrav(model.nbDofs())
47 const Eigen::MatrixXd& JchiT = _jacobian.rightCols(_chi.
getSize());
49 _InertiaMatrixInverseJchiT = Minv * JchiT;
50 _InertiaMatrixInverseLinNonLinGrav = Minv *
_b;
52 _reducedProblemDataAreUpToDate =
true;
67 , pimpl( new
Pimpl(model))
73 pimpl->_model.connect<
EVT_CHANGE_VALUE>(*
this, &FullDynamicEquationFunction::invalidateReducedProblemData);
83 pimpl->_model.disconnect<
EVT_CHANGE_VALUE>(*
this, &FullDynamicEquationFunction::invalidateReducedProblemData);
90 pimpl->_useGrav = useGrav;
103 _jacobian.rightCols(pimpl->_fc.getSize()) = pimpl->_model.getModelContacts().getJct();
113 _b = pimpl->_model.getLinearTerms() + pimpl->_model.getNonLinearTerms() + pimpl->_model.getGravityTerms();
115 _b = pimpl->_model.getLinearTerms() + pimpl->_model.getNonLinearTerms();
142 int index = pimpl->_model.hasFixedRoot() ? 0 : 6;
144 _jacobian.block(index,
_dim, pimpl->_tau.getSize(), pimpl->_tau.getSize()).diagonal() = -pimpl->_model.getActuatedDofs();
156 Variable& FullDynamicEquationFunction::createDEVariable(
const Model& model)
159 std::stringstream name;
160 name <<
"dyn_eq" << cpt++;
188 void FullDynamicEquationFunction::invalidateReducedProblemData(
int timestamp)
190 pimpl->_reducedProblemDataAreUpToDate =
false;
196 if (!pimpl->_reducedProblemDataAreUpToDate)
198 return pimpl->_InertiaMatrixInverseJchiT;
203 if (!pimpl->_reducedProblemDataAreUpToDate)
205 return pimpl->_InertiaMatrixInverseLinNonLinGrav;
const Variable & getVariable() const
Pimpl(const Model &model)
~FullDynamicEquationFunction()
void updateReduceProblemData(const Eigen::MatrixXd &_jacobian, const Eigen::VectorXd &_b)
void updateJacobian() const
const Eigen::VectorXd & getInertiaMatrixInverseLinNonLinGrav() const
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
virtual void doUpdateInputSizeEnd()
void takeIntoAccountGravity(bool useGrav)
const MatrixXd & getJacobian() const
const VectorXd & getb() const
void invalidateb(int timestamp)
This class represents a variable in a mathematical sense.
FullDynamicEquationFunction(const Model &model)
Eigen::MatrixXd _InertiaMatrixInverseJchiT
bool _reducedProblemDataAreUpToDate
Variable & getJointTorqueVariable() const
Variable & getAccelerationVariable() const
CompositeVariable & add(Variable &child)
Attach/detach the child to/from this node.
A concatenation of base variables and other composite variables.
Eigen::VectorXd _InertiaMatrixInverseLinNonLinGrav
virtual const Eigen::MatrixXd & getInertiaMatrixInverse() const =0
Define base class that can be used as constraints in wOcra controller.
Variable & getActionVariable() const
virtual void doUpdateInputSizeBegin()
const Eigen::MatrixXd & getInertiaMatrixInverseJchiT() const
ModelContacts & getModelContacts() const