Crocoddyl
 
Loading...
Searching...
No Matches
IntegratedActionModelAbstractTpl< _Scalar > Class Template Reference

Abstract class for an integrated action model. More...

#include <integ-action-base.hpp>

Inheritance diagram for IntegratedActionModelAbstractTpl< _Scalar >:
ActionModelAbstractTpl< _Scalar > ActionModelBase IntegratedActionModelEulerTpl< _Scalar > IntegratedActionModelRKTpl< _Scalar >

Public Types

typedef ActionDataAbstractTpl< Scalar > ActionDataAbstract
 
typedef ActionModelAbstractTpl< Scalar > Base
 
typedef ControlParametrizationModelAbstractTpl< Scalar > ControlParametrizationModelAbstract
 
typedef IntegratedActionDataAbstractTpl< Scalar > Data
 
typedef DifferentialActionModelAbstractTpl< Scalar > DifferentialActionModelAbstract
 
typedef MathBaseTpl< Scalar > MathBase
 
typedef MathBase::MatrixXs MatrixXs
 
typedef MathBase::VectorXs VectorXs
 
- Public Types inherited from ActionModelAbstractTpl< _Scalar >
typedef ActionDataAbstractTpl< Scalar > ActionDataAbstract
 
typedef MathBaseTpl< Scalar > MathBase
 
typedef ScalarSelector< Scalar >::type ScalarType
 
typedef StateAbstractTpl< Scalar > StateAbstract
 
typedef MathBase::VectorXs VectorXs
 

Public Member Functions

 IntegratedActionModelAbstractTpl (std::shared_ptr< DifferentialActionModelAbstract > model, const Scalar time_step=Scalar(1e-3), const bool with_cost_residual=true)
 Initialize the integrator.
 
 IntegratedActionModelAbstractTpl (std::shared_ptr< DifferentialActionModelAbstract > model, std::shared_ptr< ControlParametrizationModelAbstract > control, const Scalar time_step=Scalar(1e-3), const bool with_cost_residual=true)
 Initialize the integrator.
 
virtual std::shared_ptr< ActionDataAbstractcreateData () override
 Create the integrator data.
 
 DEPRECATED ("The DifferentialActionModel should be set at construction time", void set_differential(std::shared_ptr< DifferentialActionModelAbstract > model))
 
const std::shared_ptr< ControlParametrizationModelAbstract > & get_control () const
 Return the control parametrization model associated to this integrated action model.
 
const std::shared_ptr< DifferentialActionModelAbstract > & get_differential () const
 Return the differential action model associated to this integrated action model.
 
const Scalar get_dt () const
 Return the time step used for the integration.
 
virtual const VectorXs & get_g_lb () const override
 Return the lower bound of the inequality constraints.
 
virtual const VectorXs & get_g_ub () const override
 Return the upper bound of the inequality constraints.
 
virtual std::size_t get_ng () const override
 Return the number of inequality constraints.
 
virtual std::size_t get_ng_T () const override
 Return the number of inequality terminal constraints.
 
virtual std::size_t get_nh () const override
 Return the number of equality constraints.
 
virtual std::size_t get_nh_T () const override
 Return the number of equality terminal constraints.
 
void set_dt (const Scalar dt)
 Set the time step for the integration.
 
- Public Member Functions inherited from ActionModelAbstractTpl< _Scalar >
 ActionModelAbstractTpl (const ActionModelAbstractTpl< Scalar > &other)
 Copy constructor.
 
 ActionModelAbstractTpl (std::shared_ptr< StateAbstract > state, const std::size_t nu, const std::size_t nr=0, const std::size_t ng=0, const std::size_t nh=0, const std::size_t ng_T=0, const std::size_t nh_T=0)
 Initialize the action model.
 
virtual void calc (const std::shared_ptr< ActionDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
 Compute the total cost value for nodes that depends only on the state.
 
virtual void calc (const std::shared_ptr< ActionDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)=0
 Compute the next state and cost value.
 
virtual void calcDiff (const std::shared_ptr< ActionDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
 Compute the derivatives of the cost functions with respect to the state only.
 
virtual void calcDiff (const std::shared_ptr< ActionDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)=0
 Compute the derivatives of the dynamics and cost functions.
 
virtual bool checkData (const std::shared_ptr< ActionDataAbstract > &data)
 Checks that a specific data belongs to this model.
 
bool get_has_control_limits () const
 Indicates if there are defined control limits.
 
std::size_t get_nr () const
 Return the dimension of the cost-residual vector.
 
std::size_t get_nu () const
 Return the dimension of the control input.
 
const std::shared_ptr< StateAbstract > & get_state () const
 Return the state.
 
const VectorXs & get_u_lb () const
 Return the control lower bound.
 
const VectorXs & get_u_ub () const
 Return the control upper bound.
 
virtual void print (std::ostream &os) const
 Print relevant information of the action model.
 
virtual void quasiStatic (const std::shared_ptr< ActionDataAbstract > &data, Eigen::Ref< VectorXs > u, const Eigen::Ref< const VectorXs > &x, const std::size_t maxiter=100, const Scalar tol=Scalar(1e-9))
 Computes the quasic static commands.
 
VectorXs quasiStatic_x (const std::shared_ptr< ActionDataAbstract > &data, const VectorXs &x, const std::size_t maxiter=100, const Scalar tol=Scalar(1e-9))
 
void set_g_lb (const VectorXs &g_lb)
 Modify the lower bound of the inequality constraints.
 
void set_g_ub (const VectorXs &g_ub)
 Modify the upper bound of the inequality constraints.
 
void set_u_lb (const VectorXs &u_lb)
 Modify the control lower bounds.
 
void set_u_ub (const VectorXs &u_ub)
 Modify the control upper bounds.
 

Public Attributes

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

Protected Member Functions

 IntegratedActionModelAbstractTpl ()
 < Upper control limits
 
void init ()
 
- Protected Member Functions inherited from ActionModelAbstractTpl< _Scalar >
void update_has_control_limits ()
 Update the status of the control limits (i.e. if there are defined limits)
 

Protected Attributes

std::shared_ptr< ControlParametrizationModelAbstractcontrol_
 Model of the control parametrization.
 
std::shared_ptr< DifferentialActionModelAbstractdifferential_
 Differential action model that is integrated.
 
bool has_control_limits_
 
std::size_t nr_
 
std::size_t nu_
 < Dimension of the cost residual
 
std::shared_ptr< StateAbstractstate_
 < Dimension of the control
 
Scalar time_step2_
 Square of the time step used for integration.
 
Scalar time_step_
 Time step used for integration.
 
VectorXs u_lb_
 < Model of the state
 
VectorXs u_ub_
 < Lower control limits
 
bool with_cost_residual_
 Flag indicating whether a cost residual is used.
 
- Protected Attributes inherited from ActionModelAbstractTpl< _Scalar >
VectorXs g_lb_
 Lower bound of the inequality constraints.
 
VectorXs g_ub_
 Lower bound of the inequality constraints.
 
bool has_control_limits_
 
std::size_t ng_
 Number of inequality constraints.
 
std::size_t ng_T_
 Number of inequality terminal constraints.
 
std::size_t nh_
 Number of equality constraints.
 
std::size_t nh_T_
 Number of equality terminal constraints.
 
std::size_t nr_
 Dimension of the cost residual.
 
std::size_t nu_
 Control dimension.
 
std::shared_ptr< StateAbstractstate_
 Model of the state.
 
VectorXs u_lb_
 Lower control limits.
 
VectorXs u_ub_
 Upper control limits.
 
VectorXs unone_
 Neutral state.
 

Detailed Description

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

Abstract class for an integrated action model.

An integrated action model is a special kind of action model that is obtained by applying a numerical integration scheme to a differential (i.e., continuous time) action model. Different integration schemes can be implemented inheriting from this base class.

The numerical integration introduces also the possibility to parametrize the control trajectory inside an integration step, for instance using polynomials. This requires introducing some notation to clarify the difference between the control inputs of the differential model and the control inputs to the integrated model. We have decided to use \(\mathbf{w}\) to refer to the control inputs of the differential model and \(\mathbf{u}\) for the control inputs of the integrated action model.

See also
calc(), calcDiff(), createData()

Definition at line 41 of file integ-action-base.hpp.

Member Typedef Documentation

◆ MathBase

template<typename _Scalar >
typedef MathBaseTpl<Scalar> MathBase

Definition at line 47 of file integ-action-base.hpp.

◆ Base

template<typename _Scalar >
typedef ActionModelAbstractTpl<Scalar> Base

Definition at line 48 of file integ-action-base.hpp.

◆ Data

template<typename _Scalar >
typedef IntegratedActionDataAbstractTpl<Scalar> Data

Definition at line 49 of file integ-action-base.hpp.

◆ ActionDataAbstract

template<typename _Scalar >
typedef ActionDataAbstractTpl<Scalar> ActionDataAbstract

Definition at line 50 of file integ-action-base.hpp.

◆ DifferentialActionModelAbstract

template<typename _Scalar >
typedef DifferentialActionModelAbstractTpl<Scalar> DifferentialActionModelAbstract

Definition at line 52 of file integ-action-base.hpp.

◆ ControlParametrizationModelAbstract

Definition at line 54 of file integ-action-base.hpp.

◆ VectorXs

template<typename _Scalar >
typedef MathBase::VectorXs VectorXs

Definition at line 55 of file integ-action-base.hpp.

◆ MatrixXs

template<typename _Scalar >
typedef MathBase::MatrixXs MatrixXs

Definition at line 56 of file integ-action-base.hpp.

Constructor & Destructor Documentation

◆ IntegratedActionModelAbstractTpl() [1/3]

template<typename _Scalar >
IntegratedActionModelAbstractTpl ( std::shared_ptr< DifferentialActionModelAbstract model,
std::shared_ptr< ControlParametrizationModelAbstract control,
const Scalar  time_step = Scalar(1e-3),
const bool  with_cost_residual = true 
)

Initialize the integrator.

Parameters
[in]modelDifferential action model
[in]controlControl parametrization
[in]time_stepStep time (default 1e-3)
[in]with_cost_residualCompute cost residual (default true)

◆ IntegratedActionModelAbstractTpl() [2/3]

template<typename _Scalar >
IntegratedActionModelAbstractTpl ( std::shared_ptr< DifferentialActionModelAbstract model,
const Scalar  time_step = Scalar(1e-3),
const bool  with_cost_residual = true 
)

Initialize the integrator.

This initialization uses ControlParametrizationPolyZeroTpl for the control parametrization.

Parameters
[in]modelDifferential action model
[in]time_stepStep time (default 1e-3)
[in]with_cost_residualCompute cost residual (default true)

◆ IntegratedActionModelAbstractTpl() [3/3]

template<typename _Scalar >
IntegratedActionModelAbstractTpl ( )
inlineprotected

< Upper control limits

Definition at line 162 of file integ-action-base.hpp.

Member Function Documentation

◆ createData()

template<typename _Scalar >
virtual std::shared_ptr< ActionDataAbstract > createData ( )
overridevirtual

Create the integrator data.

Returns
the sympletic integrator data

Reimplemented from ActionModelAbstractTpl< _Scalar >.

Reimplemented in IntegratedActionModelEulerTpl< _Scalar >, and IntegratedActionModelRKTpl< _Scalar >.

◆ get_ng()

template<typename _Scalar >
virtual std::size_t get_ng ( ) const
overridevirtual

Return the number of inequality constraints.

Reimplemented from ActionModelAbstractTpl< _Scalar >.

◆ get_nh()

template<typename _Scalar >
virtual std::size_t get_nh ( ) const
overridevirtual

Return the number of equality constraints.

Reimplemented from ActionModelAbstractTpl< _Scalar >.

◆ get_ng_T()

template<typename _Scalar >
virtual std::size_t get_ng_T ( ) const
overridevirtual

Return the number of inequality terminal constraints.

Reimplemented from ActionModelAbstractTpl< _Scalar >.

◆ get_nh_T()

template<typename _Scalar >
virtual std::size_t get_nh_T ( ) const
overridevirtual

Return the number of equality terminal constraints.

Reimplemented from ActionModelAbstractTpl< _Scalar >.

◆ get_g_lb()

template<typename _Scalar >
virtual const VectorXs & get_g_lb ( ) const
overridevirtual

Return the lower bound of the inequality constraints.

Reimplemented from ActionModelAbstractTpl< _Scalar >.

◆ get_g_ub()

template<typename _Scalar >
virtual const VectorXs & get_g_ub ( ) const
overridevirtual

Return the upper bound of the inequality constraints.

Reimplemented from ActionModelAbstractTpl< _Scalar >.

Member Data Documentation

◆ Scalar

template<typename _Scalar >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Definition at line 46 of file integ-action-base.hpp.

◆ differential_

template<typename _Scalar >
std::shared_ptr<DifferentialActionModelAbstract> differential_
protected

Differential action model that is integrated.

Definition at line 171 of file integ-action-base.hpp.

◆ control_

template<typename _Scalar >
std::shared_ptr<ControlParametrizationModelAbstract> control_
protected

Model of the control parametrization.

Definition at line 173 of file integ-action-base.hpp.

◆ time_step_

template<typename _Scalar >
Scalar time_step_
protected

Time step used for integration.

Definition at line 175 of file integ-action-base.hpp.

◆ time_step2_

template<typename _Scalar >
Scalar time_step2_
protected

Square of the time step used for integration.

Definition at line 176 of file integ-action-base.hpp.

◆ with_cost_residual_

template<typename _Scalar >
bool with_cost_residual_
protected

Flag indicating whether a cost residual is used.

Definition at line 178 of file integ-action-base.hpp.

◆ has_control_limits_

template<typename _Scalar >
bool has_control_limits_
protected

Indicates whether any of the control limits is finite

Definition at line 340 of file action-base.hpp.

◆ nr_

template<typename _Scalar >
std::size_t nr_
protected

< Indicates whether any of the control limits are active

Definition at line 329 of file action-base.hpp.

◆ nu_

template<typename _Scalar >
std::size_t nu_
protected

< Dimension of the cost residual

Definition at line 328 of file action-base.hpp.

◆ state_

template<typename _Scalar >
std::shared_ptr<StateAbstract> state_
protected

< Dimension of the control

Definition at line 334 of file action-base.hpp.

◆ u_lb_

template<typename _Scalar >
VectorXs u_lb_
protected

< Model of the state

Definition at line 338 of file action-base.hpp.

◆ u_ub_

template<typename _Scalar >
VectorXs u_ub_
protected

< Lower control limits

Definition at line 339 of file action-base.hpp.


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