7#include <crocoddyl/core/cost-base.hpp>
8#include <crocoddyl/core/action-base.hpp>
12template <
typename _Scalar>
32 :
Base(
StateWrap(action_model->get_state()), (int)action_model->get_nu()),
35 void evaluate(
const ConstVectorRef &x,
const ConstVectorRef &u,
38 Data &d =
static_cast<Data &
>(data);
41 d.value_ = d.croc_cost_data_->cost;
44 d.value_ = d.croc_act_data_->cost;
51 Data &d =
static_cast<Data &
>(data);
54 d.Lx_ = d.croc_cost_data_->Lx;
55 d.Lu_ = d.croc_cost_data_->Lu;
58 d.Lx_ = d.croc_act_data_->Lx;
59 d.Lu_ = d.croc_act_data_->Lu;
66 Data &d =
static_cast<Data &
>(data);
69 d.Lxx_ = d.croc_cost_data_->Lxx;
70 d.Lxu_ = d.croc_cost_data_->Lxu;
71 d.Luu_ = d.croc_cost_data_->Luu;
74 d.Lxx_ = d.croc_act_data_->Lxx;
75 d.Lxu_ = d.croc_act_data_->Lxu;
76 d.Luu_ = d.croc_act_data_->Luu;
82 shared_ptr<crocoddyl::ActionDataAbstractTpl<Scalar>> am_data =
84 return std::make_shared<CrocCostDataWrapperTpl<Scalar>>(am_data);
87 "crocoddyl cost model only.");
92template <
typename Scalar>
94 using CostData = ::crocoddyl::CostDataAbstractTpl<Scalar>;
95 using ActionData = ::crocoddyl::ActionDataAbstractTpl<Scalar>;
101 :
Base((int)crocdata->Lx.rows(), (int)crocdata->Lu.rows()),
105 :
Base((int)actdata->Lx.rows(), (int)actdata->Lu.rows()),
109#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
110extern template struct CrocCostModelWrapperTpl<context::Scalar>;
111extern template struct CrocCostDataWrapperTpl<context::Scalar>;
#define ALIGATOR_DOMAIN_ERROR(...)
Headers for the Crocoddyl compatibility module.
CostAbstractTpl(U &&space, const int nu)
Data struct for CostAbstractTpl.
CostDataAbstractTpl(const int ndx, const int nu)
CrocCostDataWrapperTpl(const shared_ptr< CostData > &crocdata)
::crocoddyl::ActionDataAbstractTpl< Scalar > ActionData
CrocCostDataWrapperTpl(const shared_ptr< ActionData > &actdata)
::crocoddyl::CostDataAbstractTpl< Scalar > CostData
shared_ptr< CostData > croc_cost_data_
CostDataAbstractTpl< Scalar > Base
shared_ptr< ActionData > croc_act_data_
CostDataAbstractTpl< Scalar > BaseData
void computeGradients(const ConstVectorRef &x, const ConstVectorRef &u, BaseData &data) const
Compute the cost gradients .
StateWrapperTpl< Scalar > StateWrap
shared_ptr< CrocActionModel > action_model_
shared_ptr< BaseData > createData() const
shared_ptr< CrocCostModel > croc_cost_
crocoddyl::ActionModelAbstractTpl< Scalar > CrocActionModel
CrocCostModelWrapperTpl(shared_ptr< CrocCostModel > cost)
Constructor from a crocoddyl cost model.
void computeHessians(const ConstVectorRef &x, const ConstVectorRef &u, BaseData &data) const
Compute the cost Hessians .
CostAbstractTpl< Scalar > Base
void evaluate(const ConstVectorRef &x, const ConstVectorRef &u, BaseData &data) const
Evaluate the cost function.
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
crocoddyl::CostModelAbstractTpl< Scalar > CrocCostModel
CrocCostModelWrapperTpl(shared_ptr< CrocActionModel > action_model)
Constructor using a terminal action model.
Wraps a crocoddyl::StateAbstractTpl to a manifold (proxsuite::nlp::ManifoldAbstractTpl).