9 #ifndef CROCODDYL_CORE_CONTROL_BASE_HPP_ 10 #define CROCODDYL_CORE_CONTROL_BASE_HPP_ 12 #include <boost/shared_ptr.hpp> 14 #include "crocoddyl/core/fwd.hpp" 15 #include "crocoddyl/core/mathbase.hpp" 16 #include "crocoddyl/core/utils/exception.hpp" 39 template <
typename _Scalar>
42 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
44 typedef _Scalar Scalar;
47 typedef typename MathBase::VectorXs VectorXs;
48 typedef typename MathBase::MatrixXs MatrixXs;
66 virtual void calc(
const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
const Scalar t,
67 const Eigen::Ref<const VectorXs>& u)
const = 0;
78 virtual void calcDiff(
const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
const Scalar t,
79 const Eigen::Ref<const VectorXs>& u)
const = 0;
86 virtual boost::shared_ptr<ControlParametrizationDataAbstract>
createData();
95 virtual void params(
const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
const Scalar t,
96 const Eigen::Ref<const VectorXs>& w)
const = 0;
106 virtual void convertBounds(
const Eigen::Ref<const VectorXs>& w_lb,
const Eigen::Ref<const VectorXs>& w_ub,
107 Eigen::Ref<VectorXs> u_lb, Eigen::Ref<VectorXs> u_ub)
const = 0;
120 virtual void multiplyByJacobian(
const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
121 const Eigen::Ref<const MatrixXs>& A, Eigen::Ref<MatrixXs> out,
122 const AssignmentOp = setto)
const = 0;
124 virtual MatrixXs multiplyByJacobian_J(
const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
125 const Eigen::Ref<const MatrixXs>& A,
const AssignmentOp = setto)
const;
140 const Eigen::Ref<const MatrixXs>& A, Eigen::Ref<MatrixXs> out,
141 const AssignmentOp = setto)
const = 0;
143 virtual MatrixXs multiplyJacobianTransposeBy_J(
const boost::shared_ptr<ControlParametrizationDataAbstract>& data,
144 const Eigen::Ref<const MatrixXs>& A,
145 const AssignmentOp = setto)
const;
150 virtual bool checkData(
const boost::shared_ptr<ControlParametrizationDataAbstract>& data);
155 std::size_t
get_nw()
const;
160 std::size_t
get_nu()
const;
167 template <
typename _Scalar>
169 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
171 typedef _Scalar Scalar;
173 typedef typename MathBase::VectorXs VectorXs;
174 typedef typename MathBase::MatrixXs MatrixXs;
176 template <
template <
typename Scalar>
class Model>
178 : w(model->get_nw()), u(model->get_nu()), dw_du(model->get_nw(), model->get_nu()) {
183 virtual ~ControlParametrizationDataAbstractTpl() {}
195 #include "crocoddyl/core/control-base.hxx" 197 #endif // CROCODDYL_CORE_CONTROL_BASE_HPP_ VectorXs w
value of the differential control
virtual void params(const boost::shared_ptr< ControlParametrizationDataAbstract > &data, const Scalar t, const Eigen::Ref< const VectorXs > &w) const =0
Update the control parameters u for a specified time t given the control input w. ...
virtual void calcDiff(const boost::shared_ptr< ControlParametrizationDataAbstract > &data, const Scalar t, const Eigen::Ref< const VectorXs > &u) const =0
Get the value of the Jacobian of the control with respect to the parameters.
virtual void calc(const boost::shared_ptr< ControlParametrizationDataAbstract > &data, const Scalar t, const Eigen::Ref< const VectorXs > &u) const =0
Get the value of the control at the specified time.
virtual bool checkData(const boost::shared_ptr< ControlParametrizationDataAbstract > &data)
Checks that a specific data belongs to this model.
std::size_t get_nw() const
Return the dimension of the control inputs.
Abstract class for the control trajectory parametrization.
std::size_t nw_
Control dimension.
std::size_t nu_
Control parameters dimension.
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 =0
Convert the bounds on the control inputs w to bounds on the control parameters u. ...
virtual boost::shared_ptr< ControlParametrizationDataAbstract > createData()
Create the control-parametrization data.
virtual void multiplyByJacobian(const boost::shared_ptr< ControlParametrizationDataAbstract > &data, const Eigen::Ref< const MatrixXs > &A, Eigen::Ref< MatrixXs > out, const AssignmentOp=setto) const =0
Compute the product between the given matrix A and the derivative of the control input with respect t...
ControlParametrizationModelAbstractTpl(const std::size_t nw, const std::size_t nu)
Initialize the control dimensions.
MatrixXs dw_du
Jacobian of the differential control with respect to the parameters.
VectorXs u
value of the control parameters
std::size_t get_nu() const
Return the dimension of control parameters.
virtual void multiplyJacobianTransposeBy(const boost::shared_ptr< ControlParametrizationDataAbstract > &data, const Eigen::Ref< const MatrixXs > &A, Eigen::Ref< MatrixXs > out, const AssignmentOp=setto) const =0
Compute the product between the transpose of the derivative of the control input with respect to the ...