diff --git a/bindings/python/crocoddyl/core/numdiff/action.hpp b/bindings/python/crocoddyl/core/numdiff/action.hpp index d31b34050321437b54f2d8e649663329429dbd1b..9e0c6edfcdf6986cc7e1a521c868b693b7ce5b81 100644 --- a/bindings/python/crocoddyl/core/numdiff/action.hpp +++ b/bindings/python/crocoddyl/core/numdiff/action.hpp @@ -19,11 +19,11 @@ namespace bp = boost::python; void exposeActionNumDiff() { bp::class_<ActionModelNumDiff, bp::bases<ActionModelAbstract> >( "ActionModelNumDiff", "Abstract class for computing calcDiff by using numerical differentiation.\n\n", - bp::init<ActionModelAbstract&, bp::optional<bool> >( - bp::args(" self", " model", " gaussApprox=False"), + bp::init<ActionModelAbstract&>( + bp::args(" self", " model"), "Initialize the action model NumDiff.\n\n" - ":param model: action model where we compute the derivatives through NumDiff,\n" - ":param gaussApprox: compute the Hessian using Gauss approximation")[bp::with_custodian_and_ward<1, 2>()]) + ":param model: action model where we compute the derivatives through NumDiff" + )[bp::with_custodian_and_ward<1, 2>()]) .def("calc", &ActionModelNumDiff::calc_wrap, ActionModel_calc_wraps(bp::args(" self", " data", " x", " u=None"), "Compute the next state and cost value.\n\n" diff --git a/include/crocoddyl/core/numdiff/action.hpp b/include/crocoddyl/core/numdiff/action.hpp index 022a4a29a125802ff25692643018576e5d27a3fc..fcf7eabd85b522cae71f356dc57e9119fffd584d 100644 --- a/include/crocoddyl/core/numdiff/action.hpp +++ b/include/crocoddyl/core/numdiff/action.hpp @@ -94,6 +94,14 @@ class ActionModelNumDiff : public ActionModelAbstract { */ const double& get_disturbance() const; + /** + * @brief Identify if the Gauss approximation is going to be used or not. + * + * @return true + * @return false + */ + bool get_with_gauss_approx(); + private: /** * @brief Make sure that when we finite difference the Action Model, the user diff --git a/unittest/test_actions.cpp b/unittest/test_actions.cpp index 367c9a8181d89eb847b35ae47e8803310d0f5640..672db8abf269ef590d0d08888bec069d66e0a01d 100644 --- a/unittest/test_actions.cpp +++ b/unittest/test_actions.cpp @@ -55,10 +55,7 @@ void test_partial_derivatives_against_numdiff(crocoddyl::ActionModelAbstract& mo // create the corresponding data object and set the cost to nan boost::shared_ptr<crocoddyl::ActionDataAbstract> data = model.createData(); - // create the num diff model and data - bool with_gauss_approx = model.get_nr() > 1; - - crocoddyl::ActionModelNumDiff model_num_diff(model, with_gauss_approx); + crocoddyl::ActionModelNumDiff model_num_diff(model); boost::shared_ptr<crocoddyl::ActionDataAbstract> data_num_diff = model_num_diff.createData(); // Generating random values for the state and control