From ee7e1711b42e74bd805ee6ceb6a8164d751c5f2f Mon Sep 17 00:00:00 2001
From: Maximilien Naveau <maximilien.naveau@tuebingen.mpg.de>
Date: Thu, 26 Sep 2019 17:58:54 +0200
Subject: [PATCH] [action num diff] Fix the previous commit

---
 bindings/python/crocoddyl/core/numdiff/action.hpp | 8 ++++----
 include/crocoddyl/core/numdiff/action.hpp         | 8 ++++++++
 unittest/test_actions.cpp                         | 5 +----
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/bindings/python/crocoddyl/core/numdiff/action.hpp b/bindings/python/crocoddyl/core/numdiff/action.hpp
index d31b3405..9e0c6edf 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 022a4a29..fcf7eabd 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 367c9a81..672db8ab 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
-- 
GitLab