10 #ifndef CROCODDYL_MULTIBODY_RESIDUALS_COM_POSITION_HPP_
11 #define CROCODDYL_MULTIBODY_RESIDUALS_COM_POSITION_HPP_
13 #include "crocoddyl/core/residual-base.hpp"
14 #include "crocoddyl/multibody/data/multibody.hpp"
15 #include "crocoddyl/multibody/fwd.hpp"
16 #include "crocoddyl/multibody/states/multibody.hpp"
35 template <
typename _Scalar>
38 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
41 typedef _Scalar Scalar;
48 typedef typename MathBase::Vector3s Vector3s;
49 typedef typename MathBase::VectorXs VectorXs;
59 const Vector3s& cref,
const std::size_t nu);
70 const Vector3s& cref);
80 virtual void calc(
const std::shared_ptr<ResidualDataAbstract>& data,
81 const Eigen::Ref<const VectorXs>& x,
82 const Eigen::Ref<const VectorXs>& u)
override;
91 virtual void calcDiff(
const std::shared_ptr<ResidualDataAbstract>& data,
92 const Eigen::Ref<const VectorXs>& x,
93 const Eigen::Ref<const VectorXs>& u)
override;
94 virtual std::shared_ptr<ResidualDataAbstract>
createData(
106 template <
typename NewScalar>
124 virtual void print(std::ostream& os)
const override;
136 template <
typename _Scalar>
138 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
140 typedef _Scalar Scalar;
144 typedef typename MathBase::Matrix3xs Matrix3xs;
146 template <
template <
typename Scalar>
class Model>
149 :
Base(model, data) {
155 "Invalid argument: the shared data should be derived from "
156 "DataCollectorMultibody");
176 #include "crocoddyl/multibody/residuals/com-position.hxx"
Abstract class for residual models.
std::shared_ptr< StateAbstract > state_
State description.
std::size_t nu_
Control dimension.
ResidualModelCoMPositionTpl(std::shared_ptr< StateMultibody > state, const Vector3s &cref, const std::size_t nu)
Initialize the CoM position residual model.
const Vector3s & get_reference() const
Return the CoM position reference.
virtual void calcDiff(const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u) override
Compute the derivatives of the CoM position residual.
ResidualModelCoMPositionTpl< NewScalar > cast() const
Cast the com-position residual model to a different scalar type.
void set_reference(const Vector3s &cref)
Modify the CoM position reference.
ResidualModelCoMPositionTpl(std::shared_ptr< StateMultibody > state, const Vector3s &cref)
Initialize the CoM position residual model.
virtual void calc(const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u) override
Compute the CoM position residual.
virtual void print(std::ostream &os) const override
Print relevant information of the com-position residual.
virtual std::shared_ptr< ResidualDataAbstract > createData(DataCollectorAbstract *const data) override
Create the 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.
DataCollectorAbstract * shared
Shared data allocated by the action model.
pinocchio::DataTpl< Scalar > * pinocchio
Pinocchio data.