12 #ifndef CROCODDYL_CORE_NUMDIFF_CONTROL_HPP_
13 #define CROCODDYL_CORE_NUMDIFF_CONTROL_HPP_
15 #include <boost/make_shared.hpp>
19 #include "crocoddyl/core/control-base.hpp"
20 #include "crocoddyl/core/fwd.hpp"
24 template <
typename _Scalar>
28 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
30 typedef _Scalar Scalar;
36 typedef typename MathBase::VectorXs VectorXs;
37 typedef typename MathBase::MatrixXs MatrixXs;
54 void calc(
const std::shared_ptr<ControlParametrizationDataAbstract>& data,
55 const Scalar t,
const Eigen::Ref<const VectorXs>& u)
const;
65 void calcDiff(
const std::shared_ptr<ControlParametrizationDataAbstract>& data,
66 const Scalar t,
const Eigen::Ref<const VectorXs>& u)
const;
73 virtual std::shared_ptr<ControlParametrizationDataAbstract>
createData();
83 void params(
const std::shared_ptr<ControlParametrizationDataAbstract>& data,
84 const Scalar t,
const Eigen::Ref<const VectorXs>& w)
const;
96 const Eigen::Ref<const VectorXs>& w_ub,
97 Eigen::Ref<VectorXs> u_lb,
98 Eigen::Ref<VectorXs> u_ub)
const;
112 const std::shared_ptr<ControlParametrizationDataAbstract>& data,
113 const Eigen::Ref<const MatrixXs>& A, Eigen::Ref<MatrixXs> out,
114 const AssignmentOp = setto)
const;
128 const std::shared_ptr<ControlParametrizationDataAbstract>& data,
129 const Eigen::Ref<const MatrixXs>& A, Eigen::Ref<MatrixXs> out,
130 const AssignmentOp = setto)
const;
152 std::shared_ptr<Base>
162 template <
typename _Scalar>
165 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
167 typedef _Scalar Scalar;
169 typedef typename MathBase::VectorXs VectorXs;
170 typedef typename MathBase::MatrixXs MatrixXs;
173 template <
template <
typename Scalar>
class Model>
175 :
Base(model),
du(model->get_nu()) {
178 const std::size_t nu = model->get_model()->get_nu();
179 data_0 = model->get_model()->createData();
180 for (std::size_t i = 0; i < nu; ++i) {
181 data_u.push_back(model->get_model()->createData());
189 std::vector<std::shared_ptr<Base> >
198 #include "crocoddyl/core/numdiff/control.hxx"
Abstract class for the control trajectory parametrization.
std::size_t nw_
Control dimension.
std::size_t nu_
Control parameters dimension.
const std::shared_ptr< Base > & get_model() const
Get the model_ object.
void multiplyJacobianTransposeBy(const std::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...
const Scalar get_disturbance() const
Return the disturbance constant used in the numerical differentiation routine.
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
Convert the bounds on the control to bounds on the control parameters.
void set_disturbance(const Scalar disturbance)
Modify the disturbance constant used in the numerical differentiation routine.
ControlParametrizationModelNumDiffTpl(std::shared_ptr< Base > model)
Construct a new ControlParametrizationModelNumDiff object.
void calc(const std::shared_ptr< ControlParametrizationDataAbstract > &data, const Scalar t, const Eigen::Ref< const VectorXs > &u) const
Get the value of the control at the specified time.
void params(const std::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...
void multiplyByJacobian(const std::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 std::shared_ptr< ControlParametrizationDataAbstract > createData()
Create the control-parametrization data.
void calcDiff(const std::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.
std::vector< std::shared_ptr< Base > > data_u
The temporary data associated with the control variation.
VectorXs du
temporary variable used for finite differencing
std::shared_ptr< Base > data_0
The data that contains the final results.