10 #ifndef CROCODDYL_CORE_INTEGRATOR_EULER_HPP_
11 #define CROCODDYL_CORE_INTEGRATOR_EULER_HPP_
13 #include "crocoddyl/core/fwd.hpp"
14 #include "crocoddyl/core/integ-action-base.hpp"
36 template <
typename _Scalar>
40 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
43 typedef _Scalar Scalar;
54 typedef typename MathBase::VectorXs VectorXs;
55 typedef typename MathBase::MatrixXs MatrixXs;
66 std::shared_ptr<DifferentialActionModelAbstract> model,
67 std::shared_ptr<ControlParametrizationModelAbstract> control,
68 const Scalar time_step = Scalar(1e-3),
69 const bool with_cost_residual =
true);
82 std::shared_ptr<DifferentialActionModelAbstract> model,
83 const Scalar time_step = Scalar(1e-3),
84 const bool with_cost_residual =
true);
95 virtual void calc(
const std::shared_ptr<ActionDataAbstract>& data,
96 const Eigen::Ref<const VectorXs>& x,
97 const Eigen::Ref<const VectorXs>& u)
override;
109 virtual void calc(
const std::shared_ptr<ActionDataAbstract>& data,
110 const Eigen::Ref<const VectorXs>& x)
override;
119 virtual void calcDiff(
const std::shared_ptr<ActionDataAbstract>& data,
120 const Eigen::Ref<const VectorXs>& x,
121 const Eigen::Ref<const VectorXs>& u)
override;
133 virtual void calcDiff(
const std::shared_ptr<ActionDataAbstract>& data,
134 const Eigen::Ref<const VectorXs>& x)
override;
141 virtual std::shared_ptr<ActionDataAbstract>
createData()
override;
152 template <
typename NewScalar>
159 const std::shared_ptr<ActionDataAbstract>& data)
override;
174 virtual void quasiStatic(
const std::shared_ptr<ActionDataAbstract>& data,
175 Eigen::Ref<VectorXs> u,
176 const Eigen::Ref<const VectorXs>& x,
177 const std::size_t maxiter = 100,
178 const Scalar tol = Scalar(1e-9))
override;
185 virtual void print(std::ostream& os)
const override;
200 template <
typename _Scalar>
203 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
205 typedef _Scalar Scalar;
212 typedef typename MathBase::VectorXs VectorXs;
213 typedef typename MathBase::MatrixXs MatrixXs;
215 template <
template <
typename Scalar>
class Model>
219 control = model->get_control()->createData();
220 const std::size_t ndx = model->get_state()->get_ndx();
221 const std::size_t nv = model->get_state()->get_nv();
222 dx = VectorXs::Zero(ndx);
223 da_du = MatrixXs::Zero(nv, model->get_nu());
224 Lwu = MatrixXs::Zero(model->get_control()->get_nw(), model->get_nu());
228 std::shared_ptr<DifferentialActionDataAbstract>
230 std::shared_ptr<ControlParametrizationDataAbstract>
254 #include "crocoddyl/core/integrator/euler.hxx"
256 CROCODDYL_DECLARE_EXTERN_TEMPLATE_CLASS(
258 CROCODDYL_DECLARE_EXTERN_TEMPLATE_STRUCT(
Abstract class for action model.
std::size_t nh_
Number of equality constraints.
std::size_t ng_
Number of inequality constraints.
Abstract class for the control trajectory parametrization.
Abstract class for differential action model.
Abstract class for an integrated action model.
bool with_cost_residual_
Flag indicating whether a cost residual is used.
Scalar time_step_
Time step used for integration.
std::shared_ptr< StateAbstract > state_
< Dimension of the control
std::shared_ptr< ControlParametrizationModelAbstract > control_
Model of the control parametrization.
std::size_t nu_
< Dimension of the cost residual
std::shared_ptr< DifferentialActionModelAbstract > differential_
Differential action model that is integrated.
Scalar time_step2_
Square of the time step used for integration.
Symplectic Euler integrator.
virtual void calc(const std::shared_ptr< ActionDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u) override
Integrate the differential action model using symplectic Euler scheme.
virtual std::shared_ptr< ActionDataAbstract > createData() override
Create the symplectic Euler data.
virtual void calcDiff(const std::shared_ptr< ActionDataAbstract > &data, const Eigen::Ref< const VectorXs > &x) override
Compute the partial derivatives of the cost.
virtual bool checkData(const std::shared_ptr< ActionDataAbstract > &data) override
Checks that a specific data belongs to this model.
IntegratedActionModelEulerTpl(std::shared_ptr< DifferentialActionModelAbstract > model, const Scalar time_step=Scalar(1e-3), const bool with_cost_residual=true)
Initialize the symplectic Euler integrator.
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)) override
Computes the quasic static commands.
virtual void calc(const std::shared_ptr< ActionDataAbstract > &data, const Eigen::Ref< const VectorXs > &x) override
Integrate the total cost value for nodes that depends only on the state using symplectic Euler scheme...
IntegratedActionModelEulerTpl(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 symplectic Euler integrator.
virtual void calcDiff(const std::shared_ptr< ActionDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u) override
Compute the partial derivatives of the symplectic Euler integrator.
virtual void print(std::ostream &os) const override
Print relevant information of the Euler integrator model.
IntegratedActionModelEulerTpl< NewScalar > cast() const
Cast the Euler integrated-action model to a different scalar type.
VectorXs xnext
evolution state
MatrixXs Fx
Jacobian of the dynamics w.r.t. the state .
MatrixXs Fu
Jacobian of the dynamics w.r.t. the control .
MatrixXs Luu
Hessian of the cost w.r.t. the control .
VectorXs Lx
Jacobian of the cost w.r.t. the state .
MatrixXs Lxx
Hessian of the cost w.r.t. the state .
VectorXs Lu
Jacobian of the cost w.r.t. the control .
std::shared_ptr< ControlParametrizationDataAbstract > control
Control parametrization data.
std::shared_ptr< DifferentialActionDataAbstract > differential
Differential model data.