9 #ifndef CROCODDYL_CORE_CONSTRAINTS_RESIDUAL_CONSTRAINT_HPP_
10 #define CROCODDYL_CORE_CONSTRAINTS_RESIDUAL_CONSTRAINT_HPP_
12 #include "crocoddyl/core/fwd.hpp"
14 #include "crocoddyl/core/constraint-base.hpp"
15 #include "crocoddyl/core/residual-base.hpp"
46 template <
typename _Scalar>
49 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
51 typedef _Scalar Scalar;
57 typedef typename MathBase::VectorXs VectorXs;
68 boost::shared_ptr<typename Base::StateAbstract> state,
69 boost::shared_ptr<ResidualModelAbstract> residual,
const VectorXs& lower,
70 const VectorXs& upper);
79 boost::shared_ptr<typename Base::StateAbstract> state,
80 boost::shared_ptr<ResidualModelAbstract> residual);
90 virtual void calc(
const boost::shared_ptr<ConstraintDataAbstract>& data,
91 const Eigen::Ref<const VectorXs>& x,
92 const Eigen::Ref<const VectorXs>& u);
103 virtual void calc(
const boost::shared_ptr<ConstraintDataAbstract>& data,
104 const Eigen::Ref<const VectorXs>& x);
113 virtual void calcDiff(
const boost::shared_ptr<ConstraintDataAbstract>& data,
114 const Eigen::Ref<const VectorXs>& x,
115 const Eigen::Ref<const VectorXs>& u);
128 virtual void calcDiff(
const boost::shared_ptr<ConstraintDataAbstract>& data,
129 const Eigen::Ref<const VectorXs>& x);
134 virtual boost::shared_ptr<ConstraintDataAbstract>
createData(
142 virtual void print(std::ostream& os)
const;
145 void updateCalc(
const boost::shared_ptr<ConstraintDataAbstract>& data);
146 void updateCalcDiff(
const boost::shared_ptr<ConstraintDataAbstract>& data);
160 template <
typename _Scalar>
162 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
164 typedef _Scalar Scalar;
169 template <
template <
typename Scalar>
class Model>
172 :
Base(model, data) {}
189 #include "crocoddyl/core/constraints/residual.hxx"
Abstract class for constraint models.
boost::shared_ptr< StateAbstract > state_
State description.
std::size_t nu_
Control dimension.
VectorXs unone_
No control vector.
std::size_t nh_
Number of equality constraints.
boost::shared_ptr< ResidualModelAbstract > residual_
Residual model.
VectorXs lb_
Lower bound of the constraint.
ConstraintType type_
Type of constraint: inequality=0, equality=1, both=2.
VectorXs ub_
Upper bound of the constraint.
std::size_t ng_
Number of inequality constraints.
Residual-based constraint.
virtual boost::shared_ptr< ConstraintDataAbstract > createData(DataCollectorAbstract *const data)
Create the residual constraint data.
virtual void calcDiff(const boost::shared_ptr< ConstraintDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
Compute the derivatives of the residual constraint with respect to the state only.
virtual void print(std::ostream &os) const
Print relevant information of the cost-residual model.
virtual void calc(const boost::shared_ptr< ConstraintDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
Compute the residual constraint based on state only.
ConstraintModelResidualTpl(boost::shared_ptr< typename Base::StateAbstract > state, boost::shared_ptr< ResidualModelAbstract > residual, const VectorXs &lower, const VectorXs &upper)
Initialize the residual constraint model as an inequality constraint.
virtual void calc(const boost::shared_ptr< ConstraintDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the residual constraint.
virtual void calcDiff(const boost::shared_ptr< ConstraintDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the derivatives of the residual constraint.
ConstraintModelResidualTpl(boost::shared_ptr< typename Base::StateAbstract > state, boost::shared_ptr< ResidualModelAbstract > residual)
Initialize the residual constraint model as an equality constraint.
Abstract class for residual models.
MatrixXs Gx
Jacobian of the inequality constraint.
VectorXs h
Equality constraint values.
boost::shared_ptr< ResidualDataAbstract > residual
Residual data.
VectorXs g
Inequality constraint values.
MatrixXs Hx
Jacobian of the equality constraint.
MatrixXs Hu
Jacobian of the equality constraint.
DataCollectorAbstract * shared
Shared data.
MatrixXs Gu
Jacobian of the inequality constraint.