diff --git a/CMakeLists.txt b/CMakeLists.txt index c6c2db62aa3d682dd1c78bdfbb696b837fa07120..bbf2bd89066bd7357d353381e56be842c604b25c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,6 +186,7 @@ SET(HDRS_TRAJECTORY include/core/trajectory/trajectory_base.h ) SET(HDRS_MAP + include/core/map/factory_map.h include/core/map/map_base.h ) SET(HDRS_FRAME diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index 8258db880b80a7def50a5dde2d6e623efacfbd87..daf1b49909392719da9188aa74746f4b1da46ab4 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -170,11 +170,38 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server) procesorMap.insert(std::pair<std::string, ProcessorBasePtr>(prc["name"], problem->installProcessor(prc["type"], prc["name"], prc["sensor_name"], _server))); } + // Map + std::string map_type = _server.getParam<std::string>("map/type"); + WOLF_TRACE("Map Type: ", map_type); + std::string map_plugin = _server.getParam<std::string>("map/plugin"); + if (map_plugin != "core" and map_plugin != "wolf") + { + std::string plugin = plugins_path + "libwolf" + map_plugin + lib_extension; + WOLF_TRACE("Loading plugin " + plugin); + auto l = new LoaderRaw(plugin); + l->load(); + loaders.push_back(l); + } + auto map = AutoConfFactoryMap::create(map_type, _server); + map->setProblem(problem); + problem->setMap(map); + // Tree manager std::string tree_manager_type = _server.getParam<std::string>("problem/tree_manager/type"); WOLF_TRACE("Tree Manager Type: ", tree_manager_type); if (tree_manager_type != "None" and tree_manager_type != "none") + { + std::string tm_plugin = _server.getParam<std::string>("problem/tree_manager/plugin"); + if (tm_plugin != "core" and tm_plugin != "wolf") + { + std::string plugin = plugins_path + "libwolf" + tm_plugin + lib_extension; + WOLF_TRACE("Loading plugin " + plugin); + auto l = new LoaderRaw(plugin); + l->load(); + loaders.push_back(l); + } problem->setTreeManager(AutoConfFactoryTreeManager::create(tree_manager_type, "tree manager", _server)); + } // Prior std::string prior_mode = _server.getParam<std::string>("problem/prior/mode"); @@ -199,18 +226,6 @@ ProblemPtr Problem::autoSetup(ParamsServer &_server) _server.getParam<VectorComposite>("problem/prior/state")); } - // Map - std::string map_type = _server.getParam<std::string>("map/type"); - WOLF_TRACE("Map Type: ", map_type); - auto map = AutoConfFactoryMap::create(map_type, _server); - WOLF_INFO("Map created"); - WOLF_INFO_COND(problem->getMap() == nullptr, "Problem map is nullptr"); - WOLF_INFO_COND(problem->getMap() != nullptr, "Problem map is OK"); - map->setProblem(problem); - WOLF_INFO("Map problem set"); - problem->setMap(map); - WOLF_INFO("Problem map set"); - // Done return problem; } diff --git a/test/yaml/params_problem_odom_3d.yaml b/test/yaml/params_problem_odom_3d.yaml index 387924859ffebd1cec161a215dc2e572aeb585a6..c61eab58146a9a5917c1130a14e234afa08a01b6 100644 --- a/test/yaml/params_problem_odom_3d.yaml +++ b/test/yaml/params_problem_odom_3d.yaml @@ -14,7 +14,8 @@ config: tree_manager: type: "None" map: - type: "MapBase" + type: "MapBase" + plugin: "core" sensors: - type: "SensorOdom3d" diff --git a/test/yaml/params_tree_manager1.yaml b/test/yaml/params_tree_manager1.yaml index a27f60df2d6e64ecf2a8511d5923713c71daa2d9..4f3b8f336b643ece24537d1b0d21afab52bfbd61 100644 --- a/test/yaml/params_tree_manager1.yaml +++ b/test/yaml/params_tree_manager1.yaml @@ -17,9 +17,11 @@ config: time_tolerance: 0.1 tree_manager: type: "TreeManagerDummy" + plugin: "core" toy_param: 0 map: type: "MapBase" + plugin: "core" sensors: - type: "SensorOdom3d" diff --git a/test/yaml/params_tree_manager2.yaml b/test/yaml/params_tree_manager2.yaml index 10759a6ede49ee2990c0a9177987fc4ca5a8a3a6..c58498238dc8fca1cd108cfddd875b102830cace 100644 --- a/test/yaml/params_tree_manager2.yaml +++ b/test/yaml/params_tree_manager2.yaml @@ -15,10 +15,11 @@ config: O: [0.31, 0.31, 0.31] V: [0.31, 0.31, 0.31] time_tolerance: 0.1 - tree_manager: + tree_manager: type: "None" map: type: "MapBase" + plugin: "core" sensors: - type: "SensorOdom3d" diff --git a/test/yaml/params_tree_manager_sliding_window1.yaml b/test/yaml/params_tree_manager_sliding_window1.yaml index d0c3d81dda9444acde8a83b851e31aca28b00d46..81658b1833d024e935e367af23b5109fa3fb99ab 100644 --- a/test/yaml/params_tree_manager_sliding_window1.yaml +++ b/test/yaml/params_tree_manager_sliding_window1.yaml @@ -13,11 +13,13 @@ config: time_tolerance: 0.1 tree_manager: type: "TreeManagerSlidingWindow" + plugin: "core" n_frames: 3 n_fix_first_frames: 2 viral_remove_empty_parent: true map: type: "MapBase" + plugin: "core" sensors: - type: "SensorOdom3d" diff --git a/test/yaml/params_tree_manager_sliding_window2.yaml b/test/yaml/params_tree_manager_sliding_window2.yaml index e7a7bc9b90c538a3d598e6610bce4a5c742086bc..c9e7aeb048ef6b2336db594a13131a2c9b43a02a 100644 --- a/test/yaml/params_tree_manager_sliding_window2.yaml +++ b/test/yaml/params_tree_manager_sliding_window2.yaml @@ -13,11 +13,13 @@ config: time_tolerance: 0.1 tree_manager: type: "TreeManagerSlidingWindow" + plugin: "core" n_frames: 3 n_fix_first_frames: 0 viral_remove_empty_parent: false map: type: "MapBase" + plugin: "core" sensors: - type: "SensorOdom3d" diff --git a/test/yaml/params_tree_manager_sliding_window_dual_rate1.yaml b/test/yaml/params_tree_manager_sliding_window_dual_rate1.yaml index 299fa63e0698b3938033a3e52bf4847c80320d98..704953933ddf02972e4cbe4d644344f2cceaf49f 100644 --- a/test/yaml/params_tree_manager_sliding_window_dual_rate1.yaml +++ b/test/yaml/params_tree_manager_sliding_window_dual_rate1.yaml @@ -13,6 +13,7 @@ config: time_tolerance: 0.1 tree_manager: type: "TreeManagerSlidingWindowDualRate" + plugin: "core" n_frames: 5 n_frames_recent: 3 rate_old_frames: 2 @@ -20,3 +21,4 @@ config: viral_remove_empty_parent: true map: type: "MapBase" + plugin: "core" diff --git a/test/yaml/params_tree_manager_sliding_window_dual_rate2.yaml b/test/yaml/params_tree_manager_sliding_window_dual_rate2.yaml index 928408fcb3ae6b1b2016a3fd53da0040f63044bd..a3b4f469d3dc11eff15f0fbbceaa40e025319351 100644 --- a/test/yaml/params_tree_manager_sliding_window_dual_rate2.yaml +++ b/test/yaml/params_tree_manager_sliding_window_dual_rate2.yaml @@ -13,6 +13,7 @@ config: time_tolerance: 0.1 tree_manager: type: "TreeManagerSlidingWindowDualRate" + plugin: "core" n_frames: 5 n_frames_recent: 3 rate_old_frames: 2 @@ -20,3 +21,4 @@ config: viral_remove_empty_parent: false map: type: "MapBase" + plugin: "core" diff --git a/test/yaml/params_tree_manager_sliding_window_dual_rate3.yaml b/test/yaml/params_tree_manager_sliding_window_dual_rate3.yaml index 9e64db064b95bbe2b55f1b2117ba33cfce364055..11b3c1c7b207cf96382cac09c70fbbbcaf843b66 100644 --- a/test/yaml/params_tree_manager_sliding_window_dual_rate3.yaml +++ b/test/yaml/params_tree_manager_sliding_window_dual_rate3.yaml @@ -19,6 +19,7 @@ config: time_tolerance: 0.1 tree_manager: type: "TreeManagerSlidingWindowDualRate" + plugin: "core" n_frames: 5 n_frames_recent: 3 rate_old_frames: 2 @@ -26,6 +27,7 @@ config: viral_remove_empty_parent: true map: type: "MapBase" + plugin: "core" sensors: - type: "SensorOdom3d" diff --git a/test/yaml/params_tree_manager_sliding_window_dual_rate_baseline.yaml b/test/yaml/params_tree_manager_sliding_window_dual_rate_baseline.yaml index 16e421556cda457fa6b23564d5d4cdc4f024ef5d..7716b669a95101f5863597dbb33a252f8e7cd71b 100644 --- a/test/yaml/params_tree_manager_sliding_window_dual_rate_baseline.yaml +++ b/test/yaml/params_tree_manager_sliding_window_dual_rate_baseline.yaml @@ -20,6 +20,7 @@ config: type: "None" map: type: "MapBase" + plugin: "core" sensors: - type: "SensorOdom3d"