10 #ifndef CROCODDYL_CORE_NUMDIFF_ACTIVATION_HPP_
11 #define CROCODDYL_CORE_NUMDIFF_ACTIVATION_HPP_
16 #include "crocoddyl/core/activation-base.hpp"
17 #include "crocoddyl/core/fwd.hpp"
21 template <
typename _Scalar>
24 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
26 typedef _Scalar Scalar;
31 typedef typename MathBase::VectorXs VectorXs;
32 typedef typename MathBase::MatrixXs MatrixXs;
49 virtual void calc(
const boost::shared_ptr<ActivationDataAbstract>& data,
50 const Eigen::Ref<const VectorXs>& r);
55 virtual void calcDiff(
const boost::shared_ptr<ActivationDataAbstract>& data,
56 const Eigen::Ref<const VectorXs>& r);
63 virtual boost::shared_ptr<ActivationDataAbstract>
createData();
85 boost::shared_ptr<Base>
94 template <
typename _Scalar>
96 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
98 typedef _Scalar Scalar;
100 typedef typename MathBase::VectorXs VectorXs;
102 typedef typename MathBase::MatrixXs MatrixXs;
110 template <
template <
typename Scalar>
class Model>
113 dr(model->get_model()->get_nr()),
114 rp(model->get_model()->get_nr()),
115 Arr_(Arr.rows(), Arr.cols()) {
119 data_0 = model->get_model()->createData();
120 const std::size_t nr = model->get_model()->get_nr();
122 for (std::size_t i = 0; i < nr; ++i) {
123 data_rp.push_back(model->get_model()->createData());
127 for (std::size_t i = 0; i < 4; ++i) {
128 data_r2p.push_back(model->get_model()->createData());
136 std::vector<boost::shared_ptr<Base> >
138 std::vector<boost::shared_ptr<Base> >
152 #include "crocoddyl/core/numdiff/activation.hxx"
virtual boost::shared_ptr< ActivationDataAbstract > createData()
Create a Data object from the given model.
const Scalar get_disturbance() const
Return the disturbance constant used in the numerical differentiation routine.
virtual void calc(const boost::shared_ptr< ActivationDataAbstract > &data, const Eigen::Ref< const VectorXs > &r)
void set_disturbance(const Scalar disturbance)
Modify the disturbance constant used in the numerical differentiation routine.
ActivationModelNumDiffTpl(boost::shared_ptr< Base > model)
Construct a new ActivationModelNumDiff object.
virtual void calcDiff(const boost::shared_ptr< ActivationDataAbstract > &data, const Eigen::Ref< const VectorXs > &r)
const boost::shared_ptr< Base > & get_model() const
Get the model_ object.
virtual ~ActivationModelNumDiffTpl()
Destroy the ActivationModelNumDiff object.
boost::shared_ptr< Base > data_0
The data that contains the final results.
std::vector< boost::shared_ptr< Base > > data_rp
The temporary data associated with the input variation.
ActivationDataNumDiffTpl(Model< Scalar > *const model)
Construct a new ActivationDataNumDiff object.
std::vector< boost::shared_ptr< Base > > data_r2p
The temporary data associated with the input variation.