10 #ifndef CROCODDYL_CORE_NUMDIFF_ACTUATION_HPP_
11 #define CROCODDYL_CORE_NUMDIFF_ACTUATION_HPP_
16 #include "crocoddyl/core/actuation-base.hpp"
17 #include "crocoddyl/core/fwd.hpp"
33 template <
typename _Scalar>
36 typedef _Scalar Scalar;
41 typedef typename MathBase::VectorXs VectorXs;
42 typedef typename MathBase::MatrixXs MatrixXs;
60 virtual void calc(
const boost::shared_ptr<ActuationDataAbstract>& data,
61 const Eigen::Ref<const VectorXs>& x,
62 const Eigen::Ref<const VectorXs>& u);
68 virtual void calc(
const boost::shared_ptr<ActuationDataAbstract>& data,
69 const Eigen::Ref<const VectorXs>& x);
74 virtual void calcDiff(
const boost::shared_ptr<ActuationDataAbstract>& data,
75 const Eigen::Ref<const VectorXs>& x,
76 const Eigen::Ref<const VectorXs>& u);
83 virtual void calcDiff(
const boost::shared_ptr<ActuationDataAbstract>& data,
84 const Eigen::Ref<const VectorXs>& x);
89 virtual void commands(
const boost::shared_ptr<ActuationDataAbstract>& data,
90 const Eigen::Ref<const VectorXs>& x,
91 const Eigen::Ref<const VectorXs>& tau);
97 const boost::shared_ptr<ActuationDataAbstract>& data,
98 const Eigen::Ref<const VectorXs>& x,
const Eigen::Ref<const VectorXs>& u);
103 virtual boost::shared_ptr<ActuationDataAbstract>
createData();
123 boost::shared_ptr<Base> model_;
132 template <
typename _Scalar>
134 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
136 typedef _Scalar Scalar;
138 typedef typename MathBase::VectorXs VectorXs;
147 template <
template <
typename Scalar>
class Model>
150 dx(model->get_model()->get_state()->get_ndx()),
151 du(model->get_model()->get_nu()),
152 xp(model->get_model()->get_state()->get_nx()) {
156 const std::size_t ndx = model->get_model()->get_state()->get_ndx();
157 const std::size_t nu = model->get_model()->get_nu();
158 data_0 = model->get_model()->createData();
159 for (std::size_t i = 0; i < ndx; ++i) {
160 data_x.push_back(model->get_model()->createData());
162 for (std::size_t i = 0; i < nu; ++i) {
163 data_u.push_back(model->get_model()->createData());
177 std::vector<boost::shared_ptr<Base> >
179 std::vector<boost::shared_ptr<Base> >
192 #include "crocoddyl/core/numdiff/actuation.hxx"
Abstract class for the actuation-mapping model.
std::size_t nu_
Dimension of joint torque inputs.
This class computes the numerical differentiation of an actuation model.
virtual void calcDiff(const boost::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
virtual void calcDiff(const boost::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the Jacobians of the actuation function.
virtual void calc(const boost::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the actuation signal from the state point and joint torque inputs .
const Scalar get_disturbance() const
Return the disturbance constant used by the numerical differentiation routine.
virtual void commands(const boost::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &tau)
Compute the joint torque input from the generalized torques.
void set_disturbance(const Scalar disturbance)
Modify the disturbance constant used by the numerical differentiation routine.
virtual void calc(const boost::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
virtual void torqueTransform(const boost::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the torque transform from generalized torques to joint torque inputs.
ActuationModelNumDiffTpl(boost::shared_ptr< Base > model)
Initialize the numdiff residual model.
const boost::shared_ptr< Base > & get_model() const
Return the original actuation model.
virtual boost::shared_ptr< ActuationDataAbstract > createData()
Create the actuation data.
virtual ~ActuationModelNumDiffTpl()
Destroy the numdiff actuation model.
VectorXs tau
Generalized torques.
std::vector< boost::shared_ptr< Base > > data_u
The temporary data associated with the control variation.
Scalar x_norm
Norm of the state vector.
boost::shared_ptr< Base > data_0
The data that contains the final results.
Scalar uh_jac
Disturbance value used for computing .
Scalar xh_jac
Disturbance value used for computing .
VectorXs du
Control disturbance.
std::vector< boost::shared_ptr< Base > > data_x
The temporary data associated with the state variation.
ActuationDataNumDiffTpl(Model< Scalar > *const model)
Initialize the numdiff actuation data.
VectorXs dx
State disturbance.