Template Class ControlParametrizationModelPolyTwoRKTpl

Inheritance Relationships

Base Type

Class Documentation

template<typename _Scalar>
class ControlParametrizationModelPolyTwoRKTpl : public crocoddyl::ControlParametrizationModelAbstractTpl<_Scalar>

A polynomial function of time of degree two, that is a quadratic function.

The size of the parameters \(\mathbf{u}\) is 3 times the size of the control input \(\mathbf{w}\). It defines a polynomial of degree two, customized for the RK4 and RK4 integrators (even though it can be used with whatever integration scheme). The first third of \(\mathbf{u}\) represents the value of \(\mathbf{w}\) at time 0. The second third of \(\mathbf{u}\) represents the value of \(\mathbf{w}\) at time 0.5 or 1/3 for RK4 and RK3 parametrization, respectively. The last third of \(\mathbf{u}\) represents the value of \(\mathbf{w}\) at time 1 or 2/3 for the RK4 and RK3 parametrization, respectively. This parametrization is suitable to be used with the RK-4 or RK-3 integration schemes, because they require the value of \(\mathbf{w}\) exactly at 0, 0.5, 1 (for RK4) or 0, 1/3, 2/3 (for RK3).

The main computations are carried out in calc, multiplyByJacobian and multiplyJacobianTransposeBy, where the former computes control input \(\mathbf{w}\in\mathbb{R}^{nw}\) from a set of control parameters \(\mathbf{u}\in\mathbb{R}^{nu}\) where nw and nu represent the dimension of the control inputs and parameters, respectively, and the latter defines useful operations across the Jacobian of the control-parametrization model. Finally, params allows us to obtain the control parameters from a the control input, i.e., it is the inverse of calc. Note that multiplyByJacobian and multiplyJacobianTransposeBy requires to run calc first.

See also

ControlParametrizationAbstractTpl, calc(), calcDiff(), createData(), params, multiplyByJacobian, multiplyJacobianTransposeBy

Public Types

typedef MathBaseTpl<Scalar> MathBase
typedef ControlParametrizationDataAbstractTpl<Scalar> ControlParametrizationDataAbstract
typedef ControlParametrizationModelAbstractTpl<Scalar> Base
typedef ControlParametrizationDataPolyTwoRKTpl<Scalar> Data
typedef MathBase::VectorXs VectorXs
typedef MathBase::MatrixXs MatrixXs

Public Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW CROCODDYL_DERIVED_CAST (ControlParametrizationModelBase, ControlParametrizationModelPolyTwoRKTpl) typedef _Scalar Scalar
explicit ControlParametrizationModelPolyTwoRKTpl(const std::size_t nw, const RKType rktype)

Initialize the poly-two RK control parametrization.

Parameters:
  • nw[in] Dimension of control vector

  • rktype[in] Type of RK parametrization

virtual ~ControlParametrizationModelPolyTwoRKTpl() = default
virtual void calc(const std::shared_ptr<ControlParametrizationDataAbstract> &data, const Scalar t, const Eigen::Ref<const VectorXs> &u) const override

Get the value of the control at the specified time.

Parameters:
  • data[in] Poly-two-RK data

  • t[in] Time in [0,1]

  • u[in] Control parameters

virtual void calcDiff(const std::shared_ptr<ControlParametrizationDataAbstract> &data, const Scalar t, const Eigen::Ref<const VectorXs> &u) const override

Get the value of the Jacobian of the control with respect to the parameters.

It assumes that calc() has been run first

Parameters:
  • data[in] Poly-two-RK data

  • t[in] Time in [0,1]

  • u[in] Control parameters

virtual std::shared_ptr<ControlParametrizationDataAbstract> createData() override

Create the control-parametrization data.

Returns:

the control-parametrization data

virtual void params(const std::shared_ptr<ControlParametrizationDataAbstract> &data, const Scalar t, const Eigen::Ref<const VectorXs> &w) const override

Get a value of the control parameters u such that the control at the specified time t is equal to the specified value w.

Parameters:
  • data[in] Poly-two-RK data

  • t[in] Time in [0,1]

  • w[in] Control values

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 override

Map the specified bounds from the control space to the parameter space.

Parameters:
  • w_lb[in] Control lower bound

  • w_ub[in] Control lower bound

  • u_lb[out] Control parameters lower bound

  • u_ub[out] Control parameters upper bound

virtual void multiplyByJacobian(const std::shared_ptr<ControlParametrizationDataAbstract> &data, const Eigen::Ref<const MatrixXs> &A, Eigen::Ref<MatrixXs> out, const AssignmentOp = setto) const override

Compute the product between a specified matrix and the Jacobian of the control (with respect to the parameters)

It assumes that calc() has been run first

Parameters:
  • data[in] Poly-two-RK data

  • A[in] A matrix to multiply times the Jacobian

  • out[out] Product between the matrix A and the Jacobian of the control with respect to the parameters

  • op[in] Assignment operator which sets, adds, or removes the given results

virtual void multiplyJacobianTransposeBy(const std::shared_ptr<ControlParametrizationDataAbstract> &data, const Eigen::Ref<const MatrixXs> &A, Eigen::Ref<MatrixXs> out, const AssignmentOp = setto) const override

Compute the product between the transposed Jacobian of the control (with respect to the parameters) and a specified matrix.

It assumes that calc() has been run first

Parameters:
  • data[in] Poly-two-RK data

  • A[in] A matrix to multiply times the Jacobian

  • out[out] Product between the transposed Jacobian of the control with respect to the parameters and the matrix A

  • op[in] Assignment operator which sets, adds, or removes the given results

template<typename NewScalar>
ControlParametrizationModelPolyTwoRKTpl<NewScalar> cast() const
virtual void print(std::ostream &os) const override

Print relevant information of the control model.

Parameters:

os[out] Output stream object

Protected Attributes

std::size_t nu_

Control parameters dimension.

std::size_t nw_

Control dimension.