9 #ifndef CROCODDYL_CORE_ACTIONS_LQR_HPP_
10 #define CROCODDYL_CORE_ACTIONS_LQR_HPP_
14 #include "crocoddyl/core/action-base.hpp"
15 #include "crocoddyl/core/fwd.hpp"
16 #include "crocoddyl/core/states/euclidean.hpp"
20 template <
typename _Scalar>
23 typedef _Scalar Scalar;
29 typedef typename MathBase::VectorXs VectorXs;
30 typedef typename MathBase::MatrixXs MatrixXs;
33 const bool drift_free =
true);
36 virtual void calc(
const boost::shared_ptr<ActionDataAbstract>& data,
37 const Eigen::Ref<const VectorXs>& x,
38 const Eigen::Ref<const VectorXs>& u);
39 virtual void calc(
const boost::shared_ptr<ActionDataAbstract>& data,
40 const Eigen::Ref<const VectorXs>& x);
41 virtual void calcDiff(
const boost::shared_ptr<ActionDataAbstract>& data,
42 const Eigen::Ref<const VectorXs>& x,
43 const Eigen::Ref<const VectorXs>& u);
44 virtual void calcDiff(
const boost::shared_ptr<ActionDataAbstract>& data,
45 const Eigen::Ref<const VectorXs>& x);
46 virtual boost::shared_ptr<ActionDataAbstract>
createData();
47 virtual bool checkData(
const boost::shared_ptr<ActionDataAbstract>& data);
49 const MatrixXs& get_Fx()
const;
50 const MatrixXs& get_Fu()
const;
51 const VectorXs& get_f0()
const;
52 const VectorXs& get_lx()
const;
53 const VectorXs& get_lu()
const;
54 const MatrixXs& get_Lxx()
const;
55 const MatrixXs& get_Lxu()
const;
56 const MatrixXs& get_Luu()
const;
58 void set_Fx(
const MatrixXs& Fx);
59 void set_Fu(
const MatrixXs& Fu);
60 void set_f0(
const VectorXs& f0);
61 void set_lx(
const VectorXs& lx);
62 void set_lu(
const VectorXs& lu);
63 void set_Lxx(
const MatrixXs& Lxx);
64 void set_Lxu(
const MatrixXs& Lxu);
65 void set_Luu(
const MatrixXs& Luu);
72 virtual void print(std::ostream& os)
const;
90 template <
typename _Scalar>
92 typedef _Scalar Scalar;
95 typedef typename MathBase::VectorXs VectorXs;
97 template <
template <
typename Scalar>
class Model>
100 Luu_u_tmp(VectorXs::Zero(
static_cast<Eigen::Index
>(model->get_nu()))),
101 Lxx_x_tmp(VectorXs::Zero(
102 static_cast<Eigen::Index
>(model->get_state()->get_ndx()))) {
105 Fx = model->get_Fx();
106 Fu = model->get_Fu();
107 Lxx = model->get_Lxx();
108 Luu = model->get_Luu();
109 Lxu = model->get_Lxu();
133 #include "crocoddyl/core/actions/lqr.hxx"
Abstract class for action model.
boost::shared_ptr< StateAbstract > state_
Model of the state.
std::size_t nu_
Control dimension.
virtual void print(std::ostream &os) const
Print relevant information of the LQR model.
virtual void calc(const boost::shared_ptr< ActionDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the next state and cost value.
virtual void calcDiff(const boost::shared_ptr< ActionDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the derivatives of the dynamics and cost functions.
virtual bool checkData(const boost::shared_ptr< ActionDataAbstract > &data)
Checks that a specific data belongs to this model.
virtual void calc(const boost::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 calcDiff(const boost::shared_ptr< ActionDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
Compute the derivatives of the cost functions with respect to the state only.
virtual boost::shared_ptr< ActionDataAbstract > createData()
Create the action data.
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 .
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 .
MatrixXs Lxx
Hessian of the cost w.r.t. the state .