crocoddyl  1.3.0
Contact RObot COntrol by Differential DYnamic programming Library (Crocoddyl)
unicycle.hpp
1 // BSD 3-Clause License
3 //
4 // Copyright (C) 2018-2020, LAAS-CNRS, University of Edinburgh
5 // Copyright note valid unless otherwise stated in individual files.
6 // All rights reserved.
8 
9 #ifndef CROCODDYL_CORE_ACTIONS_UNICYCLE_HPP_
10 #define CROCODDYL_CORE_ACTIONS_UNICYCLE_HPP_
11 
12 #include <stdexcept>
13 
14 #include "crocoddyl/core/fwd.hpp"
15 #include "crocoddyl/core/action-base.hpp"
16 #include "crocoddyl/core/states/euclidean.hpp"
17 
18 namespace crocoddyl {
19 template <typename _Scalar>
21  public:
22  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
23 
24  typedef _Scalar Scalar;
29  typedef typename MathBase::VectorXs VectorXs;
30  typedef typename MathBase::Vector2s Vector2s;
31 
33  virtual ~ActionModelUnicycleTpl();
34 
35  virtual void calc(const boost::shared_ptr<ActionDataAbstract>& data, const Eigen::Ref<const VectorXs>& x,
36  const Eigen::Ref<const VectorXs>& u);
37  virtual void calcDiff(const boost::shared_ptr<ActionDataAbstract>& data, const Eigen::Ref<const VectorXs>& x,
38  const Eigen::Ref<const VectorXs>& u);
39  virtual boost::shared_ptr<ActionDataAbstract> createData();
40 
41  const Vector2s& get_cost_weights() const;
42  void set_cost_weights(const Vector2s& weights);
43 
44  protected:
46  using Base::nr_;
47  using Base::nu_;
48  using Base::state_;
49  using Base::u_lb_;
50  using Base::u_ub_;
51  using Base::unone_;
52 
53  private:
54  Vector2s cost_weights_;
55  Scalar dt_;
56 };
57 
58 template <typename _Scalar>
59 struct ActionDataUnicycleTpl : public ActionDataAbstractTpl<_Scalar> {
60  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
61 
62  typedef _Scalar Scalar;
65  using Base::cost;
66  using Base::Fu;
67  using Base::Fx;
68  using Base::Lu;
69  using Base::Luu;
70  using Base::Lx;
71  using Base::Lxu;
72  using Base::Lxx;
73  using Base::r;
74  using Base::xnext;
75 
76  template <template <typename Scalar> class Model>
77  explicit ActionDataUnicycleTpl(Model<Scalar>* const model) : Base(model) {
78  Fx.diagonal().array() = Scalar(1.);
79  }
80 };
81 
82 } // namespace crocoddyl
83 
84 /* --- Details -------------------------------------------------------------- */
85 /* --- Details -------------------------------------------------------------- */
86 /* --- Details -------------------------------------------------------------- */
87 #include "crocoddyl/core/actions/unicycle.hxx"
88 
89 #endif // CROCODDYL_CORE_ACTIONS_UNICYCLE_HPP_
bool has_control_limits_
Indicates whether any of the control limits is finite.
Definition: action-base.hpp:70
std::size_t nu_
Control dimension.
Definition: action-base.hpp:64
VectorXs unone_
Neutral state.
Definition: action-base.hpp:67
VectorXs u_ub_
Upper control limits.
Definition: action-base.hpp:69
VectorXs u_lb_
Lower control limits.
Definition: action-base.hpp:68
boost::shared_ptr< StateAbstract > state_
Model of the state.
Definition: action-base.hpp:66
std::size_t nr_
Dimension of the cost residual.
Definition: action-base.hpp:65