crocoddyl  1.9.0
Contact RObot COntrol by Differential DYnamic programming Library (Crocoddyl)
integ-action-base.hpp
1 // BSD 3-Clause License
3 //
4 // Copyright (C) 2021, LAAS-CNRS, University of Edinburgh, University of Oxford,
5 // University of Trento
6 // Copyright note valid unless otherwise stated in individual files.
7 // All rights reserved.
9 
10 #ifndef CROCODDYL_CORE_INTEGRATED_ACTION_BASE_HPP_
11 #define CROCODDYL_CORE_INTEGRATED_ACTION_BASE_HPP_
12 
13 #include "crocoddyl/core/fwd.hpp"
14 #include "crocoddyl/core/action-base.hpp"
15 #include "crocoddyl/core/diff-action-base.hpp"
16 #include "crocoddyl/core/control-base.hpp"
17 #include "crocoddyl/core/utils/deprecate.hpp"
18 
19 namespace crocoddyl {
20 
36 template <typename _Scalar>
38  public:
39  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
40 
41  typedef _Scalar Scalar;
48  typedef typename MathBase::VectorXs VectorXs;
49  typedef typename MathBase::MatrixXs MatrixXs;
50 
59  IntegratedActionModelAbstractTpl(boost::shared_ptr<DifferentialActionModelAbstract> model,
60  boost::shared_ptr<ControlParametrizationModelAbstract> control,
61  const Scalar time_step = Scalar(1e-3), const bool with_cost_residual = true);
62 
72  IntegratedActionModelAbstractTpl(boost::shared_ptr<DifferentialActionModelAbstract> model,
73  const Scalar time_step = Scalar(1e-3), const bool with_cost_residual = true);
75 
81  virtual boost::shared_ptr<ActionDataAbstract> createData();
82 
86  const boost::shared_ptr<DifferentialActionModelAbstract>& get_differential() const;
87 
91  const boost::shared_ptr<ControlParametrizationModelAbstract>& get_control() const;
92 
96  const Scalar get_dt() const;
97 
101  void set_dt(const Scalar dt);
102 
103  DEPRECATED("The DifferentialActionModel should be set at construction time",
104  void set_differential(boost::shared_ptr<DifferentialActionModelAbstract> model));
105 
106  protected:
108  using Base::nr_;
109  using Base::nu_;
110  using Base::state_;
111  using Base::u_lb_;
112  using Base::u_ub_;
113  using Base::unone_;
114 
115  void init();
116 
117  boost::shared_ptr<DifferentialActionModelAbstract> differential_;
118  boost::shared_ptr<ControlParametrizationModelAbstract> control_;
119 
120  Scalar time_step_;
121  Scalar time_step2_;
123 };
124 
125 template <typename _Scalar>
127  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
128 
129  typedef _Scalar Scalar;
132  typedef typename MathBase::VectorXs VectorXs;
133  typedef typename MathBase::MatrixXs MatrixXs;
134 
135  template <template <typename Scalar> class Model>
136  explicit IntegratedActionDataAbstractTpl(Model<Scalar>* const model) : Base(model) {}
137  virtual ~IntegratedActionDataAbstractTpl() {}
138 
139  using Base::cost;
140  using Base::Fu;
141  using Base::Fx;
142  using Base::Lu;
143  using Base::Luu;
144  using Base::Lx;
145  using Base::Lxu;
146  using Base::Lxx;
147  using Base::r;
148  using Base::xnext;
149 };
150 
151 } // namespace crocoddyl
152 
153 /* --- Details -------------------------------------------------------------- */
154 /* --- Details -------------------------------------------------------------- */
155 /* --- Details -------------------------------------------------------------- */
156 #include "crocoddyl/core/integ-action-base.hxx"
157 
158 #endif // CROCODDYL_CORE_INTEGRATED_ACTION_BASE_HPP_
Abstract class for action model.
Definition: action-base.hpp:59
VectorXs u_lb_
Lower control limits.
VectorXs u_ub_
Upper control limits.
bool has_control_limits_
Indicates whether any of the control limits is finite.
boost::shared_ptr< StateAbstract > state_
Model of the state.
std::size_t nu_
Control dimension.
VectorXs unone_
Neutral state.
std::size_t nr_
Dimension of the cost residual.
Abstract class for the control trajectory parametrization.
Abstract class for differential action model.
Abstract class for an integrated action model.
const Scalar get_dt() const
Return the time step used for the integration.
bool with_cost_residual_
Flag indicating whether a cost residual is used.
const boost::shared_ptr< ControlParametrizationModelAbstract > & get_control() const
Return the control parametrization model associated to this integrated action model.
Scalar time_step_
Time step used for integration.
void set_dt(const Scalar dt)
Set the time step for the integration.
boost::shared_ptr< DifferentialActionModelAbstract > differential_
Differential action model that is integrated.
boost::shared_ptr< ControlParametrizationModelAbstract > control_
Model of the control parametrization.
IntegratedActionModelAbstractTpl(boost::shared_ptr< DifferentialActionModelAbstract > model, boost::shared_ptr< ControlParametrizationModelAbstract > control, const Scalar time_step=Scalar(1e-3), const bool with_cost_residual=true)
Initialize the integrator.
Scalar time_step2_
Square of the time step used for integration.
IntegratedActionModelAbstractTpl(boost::shared_ptr< DifferentialActionModelAbstract > model, const Scalar time_step=Scalar(1e-3), const bool with_cost_residual=true)
Initialize the integrator.
const boost::shared_ptr< DifferentialActionModelAbstract > & get_differential() const
Return the differential action model associated to this integrated action model.
virtual boost::shared_ptr< ActionDataAbstract > createData()
Create the integrator data.
VectorXs xnext
evolution state
MatrixXs Fx
Jacobian of the dynamics.
MatrixXs Fu
Jacobian of the dynamics.
MatrixXs Luu
Hessian of the cost function.
VectorXs Lx
Jacobian of the cost function.
MatrixXs Lxx
Hessian of the cost function.
VectorXs Lu
Jacobian of the cost function.
MatrixXs Lxu
Hessian of the cost function.
VectorXs r
Cost residual.