crocoddyl  1.8.1
Contact RObot COntrol by Differential DYnamic programming Library (Crocoddyl)
CostModelNumDiffTpl< _Scalar > Class Template Reference
Inheritance diagram for CostModelNumDiffTpl< _Scalar >:
Collaboration diagram for CostModelNumDiffTpl< _Scalar >:

Public Types

typedef CostModelAbstractTpl< Scalar > Base
 
typedef CostDataAbstractTpl< Scalar > CostDataAbstract
 
typedef CostDataNumDiffTpl< Scalar > Data
 
typedef DataCollectorAbstractTpl< Scalar > DataCollectorAbstract
 
typedef MathBaseTpl< Scalar > MathBase
 
typedef MathBaseTpl< Scalar >::MatrixXs MatrixXs
 
typedef boost::function< void(const VectorXs &, const VectorXs &)> ReevaluationFunction
 
typedef MathBaseTpl< Scalar >::VectorXs VectorXs
 
- Public Types inherited from CostModelAbstractTpl< _Scalar >
typedef ActivationModelAbstractTpl< Scalar > ActivationModelAbstract
 
typedef ActivationModelQuadTpl< Scalar > ActivationModelQuad
 
typedef CostDataAbstractTpl< Scalar > CostDataAbstract
 
typedef DataCollectorAbstractTpl< Scalar > DataCollectorAbstract
 
typedef MathBaseTpl< Scalar > MathBase
 
typedef MathBase::MatrixXs MatrixXs
 
typedef ResidualModelAbstractTpl< Scalar > ResidualModelAbstract
 
typedef StateAbstractTpl< Scalar > StateAbstract
 
typedef MathBase::VectorXs VectorXs
 

Public Member Functions

 CostModelNumDiffTpl (const boost::shared_ptr< Base > &model)
 Initialize the numdiff cost model. More...
 
virtual ~CostModelNumDiffTpl ()
 Initialize the numdiff cost model.
 
virtual void calc (const boost::shared_ptr< CostDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
 Compute the cost value and its residual vector. More...
 
virtual void calcDiff (const boost::shared_ptr< CostDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
 Compute the Jacobian and Hessian of cost and its residual vector. More...
 
virtual boost::shared_ptr< CostDataAbstractcreateData (DataCollectorAbstract *const data)
 Create a Data object. More...
 
const Scalar get_disturbance () const
 Return the disturbance value used by the numdiff routine.
 
const boost::shared_ptr< Base > & get_model () const
 Return the original cost model.
 
bool get_with_gauss_approx ()
 Identify if the Gauss approximation is going to be used or not. More...
 
void set_disturbance (const Scalar disturbance)
 Modify the disturbance value used by the numdiff routine.
 
void set_reevals (const std::vector< ReevaluationFunction > &reevals)
 Register functions that updates the shared data computed for a system rollout The updated data is used to evaluate of the gradient and hessian. More...
 
- Public Member Functions inherited from CostModelAbstractTpl< _Scalar >
 CostModelAbstractTpl (boost::shared_ptr< StateAbstract > state, boost::shared_ptr< ActivationModelAbstract > activation, boost::shared_ptr< ResidualModelAbstract > residual)
 Initialize the cost model. More...
 
 CostModelAbstractTpl (boost::shared_ptr< StateAbstract > state, boost::shared_ptr< ActivationModelAbstract > activation, const std::size_t nu)
 Initialize the cost model. More...
 
 CostModelAbstractTpl (boost::shared_ptr< StateAbstract > state, boost::shared_ptr< ActivationModelAbstract > activation)
 
 CostModelAbstractTpl (boost::shared_ptr< StateAbstract > state, boost::shared_ptr< ResidualModelAbstract > residual)
 
 CostModelAbstractTpl (boost::shared_ptr< StateAbstract > state, const std::size_t nr, const std::size_t nu)
 
 CostModelAbstractTpl (boost::shared_ptr< StateAbstract > state, const std::size_t nr)
 
virtual void calc (const boost::shared_ptr< CostDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)=0
 Compute the cost value and its residual vector. More...
 
void calc (const boost::shared_ptr< CostDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
 
virtual void calcDiff (const boost::shared_ptr< CostDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)=0
 Compute the Jacobian and Hessian of cost and its residual vector. More...
 
void calcDiff (const boost::shared_ptr< CostDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
 
const boost::shared_ptr< ActivationModelAbstract > & get_activation () const
 Return the activation model.
 
std::size_t get_nu () const
 Return the dimension of the control input.
 
template<class ReferenceType >
ReferenceType get_reference ()
 Return the cost reference.
 
const boost::shared_ptr< ResidualModelAbstract > & get_residual () const
 Return the residual model.
 
const boost::shared_ptr< StateAbstract > & get_state () const
 Return the state.
 
virtual void print (std::ostream &os) const
 Print relevant information of the cost model. More...
 
template<class ReferenceType >
void set_reference (ReferenceType ref)
 Modify the cost reference.
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar
 
- Public Attributes inherited from CostModelAbstractTpl< _Scalar >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar
 

Protected Attributes

Scalar disturbance_
 Numerical disturbance used in the numerical differentiation.
 
boost::shared_ptr< Basemodel_
 Model of the cost.
 
std::vector< ReevaluationFunction > reevals_
 Functions that needs execution before calc or calcDiff.
 
- Protected Attributes inherited from CostModelAbstractTpl< _Scalar >
boost::shared_ptr< ActivationModelAbstractactivation_
 Activation model.
 
std::size_t nu_
 Control dimension.
 
boost::shared_ptr< ResidualModelAbstractresidual_
 Residual model.
 
boost::shared_ptr< StateAbstractstate_
 State description.
 
VectorXs unone_
 No control vector.
 

Additional Inherited Members

- Protected Member Functions inherited from CostModelAbstractTpl< _Scalar >
virtual void get_referenceImpl (const std::type_info &, void *)
 
virtual void set_referenceImpl (const std::type_info &, const void *)
 

Detailed Description

template<typename _Scalar>
class crocoddyl::CostModelNumDiffTpl< _Scalar >

Definition at line 20 of file cost.hpp.

Constructor & Destructor Documentation

◆ CostModelNumDiffTpl()

CostModelNumDiffTpl ( const boost::shared_ptr< Base > &  model)
explicit

Initialize the numdiff cost model.

Parameters
model

Member Function Documentation

◆ calc()

virtual void calc ( const boost::shared_ptr< CostDataAbstract > &  data,
const Eigen::Ref< const VectorXs > &  x,
const Eigen::Ref< const VectorXs > &  u 
)
virtual

Compute the cost value and its residual vector.

Parameters
[in]dataCost data
[in]xState point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
[in]uControl input \(\mathbf{u}\in\mathbb{R}^{nu}\)

◆ calcDiff()

virtual void calcDiff ( const boost::shared_ptr< CostDataAbstract > &  data,
const Eigen::Ref< const VectorXs > &  x,
const Eigen::Ref< const VectorXs > &  u 
)
virtual

Compute the Jacobian and Hessian of cost and its residual vector.

It computes the Jacobian and Hessian of the cost function. It assumes that calc() has been run first.

Parameters
[in]dataCost data
[in]xState point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
[in]uControl input \(\mathbf{u}\in\mathbb{R}^{nu}\)

◆ createData()

virtual boost::shared_ptr<CostDataAbstract> createData ( DataCollectorAbstract *const  data)
virtual

Create a Data object.

Parameters
dataData collector used by the original model
Returns
the cost data

Reimplemented from CostModelAbstractTpl< _Scalar >.

◆ get_with_gauss_approx()

bool get_with_gauss_approx ( )

Identify if the Gauss approximation is going to be used or not.

Returns
true
false

◆ set_reevals()

void set_reevals ( const std::vector< ReevaluationFunction > &  reevals)

Register functions that updates the shared data computed for a system rollout The updated data is used to evaluate of the gradient and hessian.

Parameters
reevalsare the registered functions.

The documentation for this class was generated from the following file: