crocoddyl  1.9.0
Contact RObot COntrol by Differential DYnamic programming Library (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/fwd.hpp"
13 #include "crocoddyl/core/utils/exception.hpp"
14 #include "crocoddyl/core/control-base.hpp"
15 
16 namespace crocoddyl {
17 
36 template <typename _Scalar>
38  public:
39  typedef _Scalar Scalar;
44  typedef typename MathBase::VectorXs VectorXs;
45  typedef typename MathBase::MatrixXs MatrixXs;
46 
52  explicit ControlParametrizationModelPolyOneTpl(const std::size_t nw);
54 
62  virtual void calc(const boost::shared_ptr<ControlParametrizationDataAbstract>& data, const Scalar t,
63  const Eigen::Ref<const VectorXs>& u) const;
64 
74  virtual void calcDiff(const boost::shared_ptr<ControlParametrizationDataAbstract>& data, const Scalar t,
75  const Eigen::Ref<const VectorXs>& u) const;
76 
82  virtual boost::shared_ptr<ControlParametrizationDataAbstract> createData();
83 
92  virtual void params(const boost::shared_ptr<ControlParametrizationDataAbstract>& data, const Scalar t,
93  const Eigen::Ref<const VectorXs>& w) const;
94 
103  virtual void convertBounds(const Eigen::Ref<const VectorXs>& w_lb, const Eigen::Ref<const VectorXs>& w_ub,
104  Eigen::Ref<VectorXs> u_lb, Eigen::Ref<VectorXs> u_ub) const;
105 
117  virtual void multiplyByJacobian(const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
118  const Eigen::Ref<const MatrixXs>& A, Eigen::Ref<MatrixXs> out,
119  const AssignmentOp = setto) const;
120 
133  virtual void multiplyJacobianTransposeBy(const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
134  const Eigen::Ref<const MatrixXs>& A, Eigen::Ref<MatrixXs> out,
135  const AssignmentOp = setto) const;
136 
137  protected:
138  using Base::nu_;
139  using Base::nw_;
140 };
141 
142 template <typename _Scalar>
144  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
145 
146  typedef _Scalar Scalar;
149  typedef typename MathBase::Vector2s Vector2s;
150 
151  template <template <typename Scalar> class Model>
152  explicit ControlParametrizationDataPolyOneTpl(Model<Scalar>* const model) : Base(model) {
153  c.setZero();
154  }
155 
157 
158  Vector2s c;
159 };
160 
161 } // namespace crocoddyl
162 
163 /* --- Details -------------------------------------------------------------- */
164 /* --- Details -------------------------------------------------------------- */
165 /* --- Details -------------------------------------------------------------- */
166 #include "crocoddyl/core/controls/poly-one.hxx"
167 
168 #endif // CROCODDYL_CORE_CONTROLS_POLY_ONE_HPP_
crocoddyl::MathBaseTpl< Scalar >
crocoddyl::ControlParametrizationModelAbstractTpl
Abstract class for the control trajectory parametrization.
Definition: control-base.hpp:40
crocoddyl::ControlParametrizationModelPolyOneTpl::multiplyJacobianTransposeBy
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...
crocoddyl::ControlParametrizationModelPolyOneTpl::calc
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.
crocoddyl::ControlParametrizationModelAbstractTpl::nu_
std::size_t nu_
Control parameters dimension.
Definition: control-base.hpp:164
crocoddyl::ControlParametrizationDataPolyOneTpl::c
Vector2s c
Coefficients of the linear control that depends on time.
Definition: poly-one.hpp:158
crocoddyl::ControlParametrizationModelPolyOneTpl
A polynomial function of time of degree one, that is a linear function.
Definition: poly-one.hpp:37
crocoddyl::ControlParametrizationModelPolyOneTpl::params
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...
crocoddyl::ControlParametrizationModelAbstractTpl::nw_
std::size_t nw_
Control dimension.
Definition: control-base.hpp:163
crocoddyl::ControlParametrizationModelPolyOneTpl::convertBounds
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.
crocoddyl::ControlParametrizationModelPolyOneTpl::multiplyByJacobian
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...
crocoddyl::ControlParametrizationDataAbstractTpl
Definition: control-base.hpp:168
crocoddyl::ControlParametrizationModelPolyOneTpl::ControlParametrizationModelPolyOneTpl
ControlParametrizationModelPolyOneTpl(const std::size_t nw)
Initialize the poly-one control parametrization.
crocoddyl::ControlParametrizationModelPolyOneTpl::calcDiff
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.
crocoddyl::ControlParametrizationDataPolyOneTpl
Definition: poly-one.hpp:143
crocoddyl::ControlParametrizationModelPolyOneTpl::createData
virtual boost::shared_ptr< ControlParametrizationDataAbstract > createData()
Create the control-parametrization data.