9 #ifndef CROCODDYL_CORE_STATE_BASE_HPP_
10 #define CROCODDYL_CORE_STATE_BASE_HPP_
16 #include "crocoddyl/core/fwd.hpp"
17 #include "crocoddyl/core/mathbase.hpp"
18 #include "crocoddyl/core/utils/exception.hpp"
22 enum Jcomponent { both = 0, first = 1, second = 2 };
24 inline bool is_a_Jcomponent(Jcomponent firstsecond) {
25 return (firstsecond == first || firstsecond == second || firstsecond == both);
45 template <
typename _Scalar>
46 class StateAbstractTpl {
48 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
50 typedef _Scalar Scalar;
51 typedef MathBaseTpl<Scalar> MathBase;
52 typedef typename MathBase::VectorXs VectorXs;
53 typedef typename MathBase::MatrixXs MatrixXs;
68 virtual VectorXs
zero()
const = 0;
73 virtual VectorXs
rand()
const = 0;
92 virtual void diff(
const Eigen::Ref<const VectorXs>& x0,
93 const Eigen::Ref<const VectorXs>& x1,
94 Eigen::Ref<VectorXs> dxout)
const = 0;
112 virtual void integrate(
const Eigen::Ref<const VectorXs>& x,
113 const Eigen::Ref<const VectorXs>& dx,
114 Eigen::Ref<VectorXs> xout)
const = 0;
157 virtual void Jdiff(
const Eigen::Ref<const VectorXs>& x0,
158 const Eigen::Ref<const VectorXs>& x1,
159 Eigen::Ref<MatrixXs> Jfirst, Eigen::Ref<MatrixXs> Jsecond,
160 const Jcomponent firstsecond = both)
const = 0;
201 virtual void Jintegrate(
const Eigen::Ref<const VectorXs>& x,
202 const Eigen::Ref<const VectorXs>& dx,
203 Eigen::Ref<MatrixXs> Jfirst,
204 Eigen::Ref<MatrixXs> Jsecond,
205 const Jcomponent firstsecond = both,
206 const AssignmentOp op = setto)
const = 0;
223 const Eigen::Ref<const VectorXs>& dx,
224 Eigen::Ref<MatrixXs> Jin,
225 const Jcomponent firstsecond)
const = 0;
235 VectorXs
diff_dx(
const Eigen::Ref<const VectorXs>& x0,
236 const Eigen::Ref<const VectorXs>& x1);
245 VectorXs
integrate_x(
const Eigen::Ref<const VectorXs>& x,
246 const Eigen::Ref<const VectorXs>& dx);
255 std::vector<MatrixXs>
Jdiff_Js(
const Eigen::Ref<const VectorXs>& x0,
256 const Eigen::Ref<const VectorXs>& x1,
257 const Jcomponent firstsecond = both);
266 std::vector<MatrixXs>
Jintegrate_Js(
const Eigen::Ref<const VectorXs>& x,
267 const Eigen::Ref<const VectorXs>& dx,
268 const Jcomponent firstsecond = both);
273 std::size_t
get_nx()
const;
283 std::size_t
get_nq()
const;
288 std::size_t
get_nv()
const;
293 const VectorXs&
get_lb()
const;
298 const VectorXs&
get_ub()
const;
308 void set_lb(
const VectorXs& lb);
313 void set_ub(
const VectorXs& ub);
316 void update_has_limits();
332 #include "crocoddyl/core/state-base.hxx"
334 #endif // CROCODDYL_CORE_STATE_BASE_HPP_