From bf7b8ba2d5ead28c25b13a55b70d1c04a71827b6 Mon Sep 17 00:00:00 2001
From: Joaquim Casals <jcasals@iri.upc.edu>
Date: Fri, 31 May 2019 16:12:26 +0200
Subject: [PATCH] Changes to Problem to actually close #219

---
 include/core/problem/problem.h | 2 +-
 src/problem/problem.cpp        | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/core/problem/problem.h b/include/core/problem/problem.h
index 6b2e32db1..fdfb8a105 100644
--- a/include/core/problem/problem.h
+++ b/include/core/problem/problem.h
@@ -61,7 +61,7 @@ class Problem : public std::enable_shared_from_this<Problem>
 
     public:
         static ProblemPtr create(const std::string& _frame_structure, SizeEigen _dim); // USE THIS AS A CONSTRUCTOR!
-        static ProblemPtr autoSetup(const std::string& _frame_structure, SizeEigen _dim, const std::string& _yaml_file);
+        static ProblemPtr autoSetup(const std::string& _yaml_file);
         virtual ~Problem();
 
         // Properties -----------------------------------------
diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp
index e22751548..fa78a9e38 100644
--- a/src/problem/problem.cpp
+++ b/src/problem/problem.cpp
@@ -72,13 +72,15 @@ ProblemPtr Problem::create(const std::string& _frame_structure, SizeEigen _dim)
     p->setup();
     return p->shared_from_this();
 }
-ProblemPtr Problem::autoSetup(const std::string& _frame_structure, SizeEigen _dim, const std::string& _yaml_file)
+ProblemPtr Problem::autoSetup(const std::string& _yaml_file)
 {
-    auto p = Problem::create(_frame_structure, _dim);
     // string file = "/home/jcasals/catkin_ws/src/wolf_ros_wrapper/src/params.yaml";
     parserYAML parser = parserYAML(_yaml_file);
     parser.parse();
     paramsServer server = paramsServer(parser.getParams(), parser.sensorsSerialization(), parser.processorsSerialization());
+    std::string frame_structure = server.getParam<std::string>("problem/frame structure", "PO");
+    int dim = server.getParam<int>("problem/dimension", "2");
+    auto p = Problem::create(frame_structure, dim);
     // cout << "PRINTING SERVER MAP" << endl;
     // server.print();
     // cout << "-----------------------------------" << endl;
-- 
GitLab