Crocoddyl
poly-one.hpp
1 // BSD 3-Clause License
3 //
4 // Copyright (C) 2021, University of Edinburgh, University of Trento
5 // Copyright note valid unless otherwise stated in individual files.
6 // All rights reserved.
8 
9 #ifndef CROCODDYL_CORE_CONTROLS_POLY_ONE_HPP_
10 #define CROCODDYL_CORE_CONTROLS_POLY_ONE_HPP_
11 
12 #include "crocoddyl/core/control-base.hpp"
13 #include "crocoddyl/core/fwd.hpp"
14 #include "crocoddyl/core/utils/exception.hpp"
15 
16 namespace crocoddyl {
17 
40 template <typename _Scalar>
42  : public ControlParametrizationModelAbstractTpl<_Scalar> {
43  public:
44  typedef _Scalar Scalar;
50  typedef typename MathBase::VectorXs VectorXs;
51  typedef typename MathBase::MatrixXs MatrixXs;
52 
58  explicit ControlParametrizationModelPolyOneTpl(const std::size_t nw);
60 
68  virtual void calc(
69  const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
70  const Scalar t, const Eigen::Ref<const VectorXs>& u) const;
71 
82  virtual void calcDiff(
83  const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
84  const Scalar t, const Eigen::Ref<const VectorXs>& u) const;
85 
91  virtual boost::shared_ptr<ControlParametrizationDataAbstract> createData();
92 
101  virtual void params(
102  const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
103  const Scalar t, const Eigen::Ref<const VectorXs>& w) const;
104 
114  virtual void convertBounds(const Eigen::Ref<const VectorXs>& w_lb,
115  const Eigen::Ref<const VectorXs>& w_ub,
116  Eigen::Ref<VectorXs> u_lb,
117  Eigen::Ref<VectorXs> u_ub) const;
118 
132  virtual void multiplyByJacobian(
133  const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
134  const Eigen::Ref<const MatrixXs>& A, Eigen::Ref<MatrixXs> out,
135  const AssignmentOp = setto) const;
136 
151  const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
152  const Eigen::Ref<const MatrixXs>& A, Eigen::Ref<MatrixXs> out,
153  const AssignmentOp = setto) const;
154 
155  protected:
156  using Base::nu_;
157  using Base::nw_;
158 };
159 
160 template <typename _Scalar>
162  : public ControlParametrizationDataAbstractTpl<_Scalar> {
163  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
164 
165  typedef _Scalar Scalar;
168  typedef typename MathBase::Vector2s Vector2s;
169 
170  template <template <typename Scalar> class Model>
171  explicit ControlParametrizationDataPolyOneTpl(Model<Scalar>* const model)
172  : Base(model) {
173  c.setZero();
174  }
175 
177 
178  Vector2s c;
179 };
180 
181 } // namespace crocoddyl
182 
183 /* --- Details -------------------------------------------------------------- */
184 /* --- Details -------------------------------------------------------------- */
185 /* --- Details -------------------------------------------------------------- */
186 #include "crocoddyl/core/controls/poly-one.hxx"
187 
188 #endif // CROCODDYL_CORE_CONTROLS_POLY_ONE_HPP_
Abstract class for the control trajectory parametrization.
std::size_t nu_
Control parameters dimension.
A polynomial function of time of degree one, that is a linear function.
Definition: poly-one.hpp:42
virtual void calc(const boost::shared_ptr< ControlParametrizationDataAbstract > &data, const Scalar t, const Eigen::Ref< const VectorXs > &u) const
Get the value of the control at the specified time.
virtual void convertBounds(const Eigen::Ref< const VectorXs > &w_lb, const Eigen::Ref< const VectorXs > &w_ub, Eigen::Ref< VectorXs > u_lb, Eigen::Ref< VectorXs > u_ub) const
Map the specified bounds from the control space to the parameter space.
virtual void params(const boost::shared_ptr< ControlParametrizationDataAbstract > &data, const Scalar t, const Eigen::Ref< const VectorXs > &w) const
Get a value of the control parameters such that the control at the specified time t is equal to the s...
virtual void calcDiff(const boost::shared_ptr< ControlParametrizationDataAbstract > &data, const Scalar t, const Eigen::Ref< const VectorXs > &u) const
Get the value of the Jacobian of the control with respect to the parameters.
virtual void multiplyJacobianTransposeBy(const boost::shared_ptr< ControlParametrizationDataAbstract > &data, const Eigen::Ref< const MatrixXs > &A, Eigen::Ref< MatrixXs > out, const AssignmentOp=setto) const
Compute the product between the transposed Jacobian of the control (with respect to the parameters) a...
ControlParametrizationModelPolyOneTpl(const std::size_t nw)
Initialize the poly-one control parametrization.
virtual void multiplyByJacobian(const boost::shared_ptr< ControlParametrizationDataAbstract > &data, const Eigen::Ref< const MatrixXs > &A, Eigen::Ref< MatrixXs > out, const AssignmentOp=setto) const
Compute the product between a specified matrix and the Jacobian of the control (with respect to the p...
virtual boost::shared_ptr< ControlParametrizationDataAbstract > createData()
Create the control-parametrization data.
Vector2s c
Coefficients of the linear control that depends on time.
Definition: poly-one.hpp:178