7#include <crocoddyl/core/cost-base.hpp>
8#include <crocoddyl/core/action-base.hpp>
12template <
typename _Scalar>
13struct CrocCostModelWrapperTpl : CostAbstractTpl<_Scalar> {
32 boost::shared_ptr<CrocActionModel> action_model)
33 :
Base(
StateWrap(action_model->get_state()), (int)action_model->get_nu()),
36 void evaluate(
const ConstVectorRef &x,
const ConstVectorRef &u,
39 Data &d =
static_cast<Data &
>(data);
42 d.
value_ = d.croc_cost_data_->cost;
45 d.value_ = d.croc_act_data_->cost;
52 Data &d =
static_cast<Data &
>(data);
55 d.
Lx_ = d.croc_cost_data_->Lx;
56 d.Lu_ = d.croc_cost_data_->Lu;
59 d.Lx_ = d.croc_act_data_->Lx;
60 d.Lu_ = d.croc_act_data_->Lu;
67 Data &d =
static_cast<Data &
>(data);
70 d.
Lxx_ = d.croc_cost_data_->Lxx;
71 d.Lxu_ = d.croc_cost_data_->Lxu;
72 d.Luu_ = d.croc_cost_data_->Luu;
75 d.Lxx_ = d.croc_act_data_->Lxx;
76 d.Lxu_ = d.croc_act_data_->Lxu;
77 d.Luu_ = d.croc_act_data_->Luu;
83 boost::shared_ptr<crocoddyl::ActionDataAbstractTpl<Scalar>> am_data =
85 return std::make_shared<CrocCostDataWrapperTpl<Scalar>>(am_data);
88 "crocoddyl cost model only.");
93template <
typename Scalar>
95 using CostData = ::crocoddyl::CostDataAbstractTpl<Scalar>;
96 using ActionData = ::crocoddyl::ActionDataAbstractTpl<Scalar>;
102 :
Base((int)crocdata->Lx.rows(), (int)crocdata->Lu.rows()),
106 :
Base((int)actdata->Lx.rows(), (int)actdata->Lu.rows()),
110#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
111extern template struct CrocCostModelWrapperTpl<context::Scalar>;
112extern template struct CrocCostDataWrapperTpl<context::Scalar>;
#define ALIGATOR_DOMAIN_ERROR(msg)
Headers for the Crocoddyl compatibility module.
Stage costs for control problems.
Data struct for CostAbstractTpl.
CrocCostDataWrapperTpl(const boost::shared_ptr< ActionData > &actdata)
CrocCostDataWrapperTpl(const boost::shared_ptr< CostData > &crocdata)
::crocoddyl::ActionDataAbstractTpl< Scalar > ActionData
::crocoddyl::CostDataAbstractTpl< Scalar > CostData
boost::shared_ptr< CostData > croc_cost_data_
boost::shared_ptr< ActionData > croc_act_data_
void computeHessians(const ConstVectorRef &x, const ConstVectorRef &u, BaseData &data) const
crocoddyl::ActionModelAbstractTpl< Scalar > CrocActionModel
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
CrocCostModelWrapperTpl(boost::shared_ptr< CrocActionModel > action_model)
Constructor using a terminal action model.
boost::shared_ptr< CrocActionModel > action_model_
crocoddyl::CostModelAbstractTpl< Scalar > CrocCostModel
void computeGradients(const ConstVectorRef &x, const ConstVectorRef &u, BaseData &data) const
boost::shared_ptr< CrocCostModel > croc_cost_
void evaluate(const ConstVectorRef &x, const ConstVectorRef &u, BaseData &data) const
shared_ptr< BaseData > createData() const
CrocCostModelWrapperTpl(boost::shared_ptr< CrocCostModel > cost)
Constructor from a crocoddyl cost model.
Wraps a crocoddyl::StateAbstractTpl to a manifold (proxsuite::nlp::ManifoldAbstractTpl).