Crocoddyl
poly-zero.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_ZERO_HPP_
10 #define CROCODDYL_CORE_CONTROLS_POLY_ZERO_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 
35 template <typename _Scalar>
37  : public ControlParametrizationModelAbstractTpl<_Scalar> {
38  public:
39  typedef _Scalar Scalar;
45  typedef typename MathBase::VectorXs VectorXs;
46  typedef typename MathBase::MatrixXs MatrixXs;
47 
53  explicit ControlParametrizationModelPolyZeroTpl(const std::size_t nw);
55 
63  virtual void calc(
64  const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
65  const Scalar t, const Eigen::Ref<const VectorXs>& u) const;
66 
77  virtual void calcDiff(
78  const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
79  const Scalar t, const Eigen::Ref<const VectorXs>& u) const;
80 
86  virtual boost::shared_ptr<ControlParametrizationDataAbstract> createData();
87 
96  virtual void params(
97  const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
98  const Scalar t, const Eigen::Ref<const VectorXs>& w) const;
99 
109  virtual void convertBounds(const Eigen::Ref<const VectorXs>& w_lb,
110  const Eigen::Ref<const VectorXs>& w_ub,
111  Eigen::Ref<VectorXs> u_lb,
112  Eigen::Ref<VectorXs> u_ub) const;
113 
127  virtual void multiplyByJacobian(
128  const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
129  const Eigen::Ref<const MatrixXs>& A, Eigen::Ref<MatrixXs> out,
130  const AssignmentOp = setto) const;
131 
146  const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
147  const Eigen::Ref<const MatrixXs>& A, Eigen::Ref<MatrixXs> out,
148  const AssignmentOp = setto) const;
149 
150  protected:
151  using Base::nu_;
152  using Base::nw_;
153 };
154 
155 } // namespace crocoddyl
156 
157 /* --- Details -------------------------------------------------------------- */
158 /* --- Details -------------------------------------------------------------- */
159 /* --- Details -------------------------------------------------------------- */
160 #include "crocoddyl/core/controls/poly-zero.hxx"
161 
162 #endif // CROCODDYL_CORE_CONTROLS_POLY_ZERO_HPP_
Abstract class for the control trajectory parametrization.
std::size_t nu_
Control parameters dimension.
A polynomial function of time of degree zero, that is a constant.
Definition: poly-zero.hpp:37
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.
ControlParametrizationModelPolyZeroTpl(const std::size_t nw)
Initialize the poly-zero control parametrization.
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...
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.