9#ifndef CROCODDYL_CORE_COSTS_RESIDUAL_COST_HPP_
10#define CROCODDYL_CORE_COSTS_RESIDUAL_COST_HPP_
12#include "crocoddyl/core/fwd.hpp"
13#include "crocoddyl/core/cost-base.hpp"
14#include "crocoddyl/core/residual-base.hpp"
35template <
typename _Scalar>
38 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
40 typedef _Scalar Scalar;
48 typedef typename MathBase::VectorXs VectorXs;
49 typedef typename MathBase::MatrixXs MatrixXs;
59 boost::shared_ptr<ActivationModelAbstract> activation,
60 boost::shared_ptr<ResidualModelAbstract> residual);
70 boost::shared_ptr<ResidualModelAbstract> residual);
80 virtual void calc(
const boost::shared_ptr<CostDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x,
81 const Eigen::Ref<const VectorXs>& u);
92 virtual void calc(
const boost::shared_ptr<CostDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x);
101 virtual void calcDiff(
const boost::shared_ptr<CostDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x,
102 const Eigen::Ref<const VectorXs>& u);
113 virtual void calcDiff(
const boost::shared_ptr<CostDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x);
125 virtual void print(std::ostream& os)
const;
135template <
typename _Scalar>
137 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
139 typedef _Scalar Scalar;
143 typedef typename MathBase::MatrixXs MatrixXs;
145 template <
template <
typename Scalar>
class Model>
148 Arr_Rx(model->get_residual()->get_nr(), model->get_state()->get_ndx()),
149 Arr_Ru(model->get_residual()->get_nr(), model->get_nu()) {
156 using Base::activation;
163 using Base::residual;
172#include "crocoddyl/core/costs/residual.hxx"
Abstract class for cost models.
boost::shared_ptr< ActivationModelAbstract > activation_
Activation model.
boost::shared_ptr< StateAbstract > state_
State description.
std::size_t nu_
Control dimension.
VectorXs unone_
No control vector.
boost::shared_ptr< ResidualModelAbstract > residual_
Residual model.
CostModelResidualTpl(boost::shared_ptr< typename Base::StateAbstract > state, boost::shared_ptr< ResidualModelAbstract > residual)
Initialize the residual cost model.
virtual void calcDiff(const boost::shared_ptr< CostDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
Compute the derivatives of the residual cost 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< CostDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the residual cost.
virtual void calcDiff(const boost::shared_ptr< CostDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the derivatives of the residual cost.
virtual boost::shared_ptr< CostDataAbstract > createData(DataCollectorAbstract *const data)
Create the residual cost data.
CostModelResidualTpl(boost::shared_ptr< typename Base::StateAbstract > state, boost::shared_ptr< ActivationModelAbstract > activation, boost::shared_ptr< ResidualModelAbstract > residual)
Initialize the residual cost model.
virtual void calc(const boost::shared_ptr< CostDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
Compute the residual cost based on state only.
Abstract class for residual models.