9 #ifndef CROCODDYL_MULTIBODY_RESIDUALS_MOMENTUM_HPP_
10 #define CROCODDYL_MULTIBODY_RESIDUALS_MOMENTUM_HPP_
12 #include "crocoddyl/multibody/fwd.hpp"
13 #include "crocoddyl/core/residual-base.hpp"
14 #include "crocoddyl/multibody/states/multibody.hpp"
15 #include "crocoddyl/multibody/data/multibody.hpp"
32 template <
typename _Scalar>
35 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
37 typedef _Scalar Scalar;
45 typedef typename MathBase::Vector6s Vector6s;
46 typedef typename MathBase::VectorXs VectorXs;
47 typedef typename MathBase::Matrix6xs Matrix6xs;
57 const std::size_t nu);
77 virtual void calc(
const boost::shared_ptr<ResidualDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x,
78 const Eigen::Ref<const VectorXs>& u);
87 virtual void calcDiff(
const boost::shared_ptr<ResidualDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x,
88 const Eigen::Ref<const VectorXs>& u);
110 virtual void print(std::ostream& os)
const;
120 boost::shared_ptr<typename StateMultibody::PinocchioModel> pin_model_;
123 template <
typename _Scalar>
125 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
127 typedef _Scalar Scalar;
131 typedef typename MathBase::Matrix6xs Matrix6xs;
133 template <
template <
typename Scalar>
class Model>
135 :
Base(model, data),
dhd_dq(6, model->get_state()->get_nv()),
dhd_dv(6, model->get_state()->get_nv()) {
142 throw_pretty(
"Invalid argument: the shared data should be derived from DataCollectorMultibody");
163 #include "crocoddyl/multibody/residuals/centroidal-momentum.hxx"
Abstract class for residual models.
bool u_dependent_
Label that indicates if the residual function depends on u.
boost::shared_ptr< StateAbstract > state_
State description.
std::size_t nu_
Control dimension.
VectorXs unone_
No control vector.
Centroidal momentum residual.
ResidualModelCentroidalMomentumTpl(boost::shared_ptr< StateMultibody > state, const Vector6s &href, const std::size_t nu)
Initialize the centroidal momentum residual model.
virtual void print(std::ostream &os) const
Print relevant information of the centroidal-momentum residual.
virtual void calc(const boost::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the centroidal momentum residual.
void set_reference(const Vector6s &href)
Modify the reference centroidal momentum.
ResidualModelCentroidalMomentumTpl(boost::shared_ptr< StateMultibody > state, const Vector6s &href)
Initialize the centroidal momentum residual model.
virtual void calcDiff(const boost::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the derivatives of the centroidal momentum residual.
const Vector6s & get_reference() const
Return the reference centroidal momentum.
virtual boost::shared_ptr< ResidualDataAbstract > createData(DataCollectorAbstract *const data)
Create the centroidal momentum residual data.
State multibody representation.
MatrixXs Ru
Jacobian of the residual vector with respect the control.
MatrixXs Rx
Jacobian of the residual vector with respect the state.
DataCollectorAbstract * shared
Shared data allocated by the action model.
VectorXs r
Residual vector.
Matrix6xs dhd_dq
Jacobian of the centroidal momentum.
DataCollectorAbstract * shared
Shared data allocated by the action model.
Matrix6xs dhd_dv
Jacobian of the centroidal momentum.
pinocchio::DataTpl< Scalar > * pinocchio
Pinocchio data.