Skip to content
Snippets Groups Projects
Commit e537afe2 authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

less verbose Problem::autoSetup

parent 0d40266e
No related branches found
No related tags found
1 merge request!448Draft: Resolve "Implementation of new nodes creation"
...@@ -115,7 +115,7 @@ ProblemPtr Problem::create(const std::string& _frame_structure, SizeEigen _dim, ...@@ -115,7 +115,7 @@ ProblemPtr Problem::create(const std::string& _frame_structure, SizeEigen _dim,
ProblemPtr Problem::autoSetup(const std::string& _input_yaml_file, std::vector<std::string> _schema_folders) ProblemPtr Problem::autoSetup(const std::string& _input_yaml_file, std::vector<std::string> _schema_folders)
{ {
// Create YAML server // Create YAML server
WOLF_INFO("Loading YAML file..."); WOLF_DEBUG("Loading YAML file...");
auto server = yaml_schema_cpp::YamlServer({}, _input_yaml_file); auto server = yaml_schema_cpp::YamlServer({}, _input_yaml_file);
auto params_node = server.getNode(); auto params_node = server.getNode();
WOLF_DEBUG("Loaded node:\n", params_node); WOLF_DEBUG("Loaded node:\n", params_node);
...@@ -132,7 +132,7 @@ ProblemPtr Problem::autoSetup(const std::string& _input_yaml_file, std::vector<s ...@@ -132,7 +132,7 @@ ProblemPtr Problem::autoSetup(const std::string& _input_yaml_file, std::vector<s
server.addFolderSchema(_schema_folders); server.addFolderSchema(_schema_folders);
// Validate against schema // Validate against schema
WOLF_INFO("Validating YAML file..."); WOLF_DEBUG("Validating YAML file...");
if (not server.applySchema("Problem.schema")) if (not server.applySchema("Problem.schema"))
{ {
WOLF_ERROR(server.getLog()); WOLF_ERROR(server.getLog());
...@@ -145,7 +145,7 @@ ProblemPtr Problem::autoSetup(const std::string& _input_yaml_file, std::vector<s ...@@ -145,7 +145,7 @@ ProblemPtr Problem::autoSetup(const std::string& _input_yaml_file, std::vector<s
WOLF_ERROR(server.getLog()); WOLF_ERROR(server.getLog());
return nullptr; return nullptr;
} }
WOLF_INFO("YAML file validated!"); WOLF_DEBUG("YAML file validated!");
WOLF_DEBUG(server.getLog()); WOLF_DEBUG(server.getLog());
// Get param node // Get param node
...@@ -156,13 +156,13 @@ ProblemPtr Problem::autoSetup(YAML::Node _param_node, LoaderPtr _loader) ...@@ -156,13 +156,13 @@ ProblemPtr Problem::autoSetup(YAML::Node _param_node, LoaderPtr _loader)
{ {
// PROBLEM =============================================================================== // PROBLEM ===============================================================================
// structure and dimension // structure and dimension
WOLF_INFO("Loading problem parameters..."); WOLF_DEBUG("Loading problem parameters...");
YAML::Node problem_node = _param_node["problem"]; YAML::Node problem_node = _param_node["problem"];
int dim = problem_node["dimension"].as<int>(); int dim = problem_node["dimension"].as<int>();
auto problem = Problem::create("", dim, _loader); auto problem = Problem::create("", dim, _loader);
// Tree manager // Tree manager
WOLF_INFO("Loading tree manager parameters..."); WOLF_DEBUG("Loading tree manager parameters...");
YAML::Node tree_manager_node = problem_node["tree_manager"]; YAML::Node tree_manager_node = problem_node["tree_manager"];
std::string tree_manager_type = tree_manager_node["type"].as<std::string>(); std::string tree_manager_type = tree_manager_node["type"].as<std::string>();
if (tree_manager_type != "none" and tree_manager_type != "None" and tree_manager_type != "NONE") if (tree_manager_type != "none" and tree_manager_type != "None" and tree_manager_type != "NONE")
...@@ -173,25 +173,23 @@ ProblemPtr Problem::autoSetup(YAML::Node _param_node, LoaderPtr _loader) ...@@ -173,25 +173,23 @@ ProblemPtr Problem::autoSetup(YAML::Node _param_node, LoaderPtr _loader)
} }
// First frame // First frame
WOLF_INFO("Loading problem first frame parameters..."); WOLF_DEBUG("Loading problem first frame parameters...");
WOLF_INFO(problem_node["first_frame"]);
SpecStateComposite priors(problem_node["first_frame"]); SpecStateComposite priors(problem_node["first_frame"]);
WOLF_INFO(priors);
problem->setPriorOptions(priors); problem->setPriorOptions(priors);
// SENSORS =============================================================================== // SENSORS ===============================================================================
// load plugin if sensor is not registered // load plugin if sensor is not registered
WOLF_INFO("Installing sensors..."); WOLF_DEBUG("Installing sensors...");
for (auto sensor_n : _param_node["sensors"]) problem->installSensor(sensor_n); for (auto sensor_n : _param_node["sensors"]) problem->installSensor(sensor_n);
// PROCESSORS =============================================================================== // PROCESSORS ===============================================================================
// load plugin if processor is not registered // load plugin if processor is not registered
WOLF_INFO("Installing processors..."); WOLF_DEBUG("Installing processors...");
for (auto processor_n : _param_node["processors"]) problem->installProcessor(processor_n); for (auto processor_n : _param_node["processors"]) problem->installProcessor(processor_n);
// MAP (optional) =============================================================================== // MAP (optional) ===============================================================================
// Default MapBase // Default MapBase
WOLF_INFO("Creating map..."); WOLF_DEBUG("Creating map...");
if (not _param_node["map"]) if (not _param_node["map"])
{ {
_param_node["map"]["type"] = "MapBase"; _param_node["map"]["type"] = "MapBase";
...@@ -277,7 +275,7 @@ void Problem::loadPlugin(LoaderPtr _loader, const std::string& plugin_name) ...@@ -277,7 +275,7 @@ void Problem::loadPlugin(LoaderPtr _loader, const std::string& plugin_name)
} }
std::string plugin = plugins_path + "libwolf" + plugin_name + lib_extension; std::string plugin = plugins_path + "libwolf" + plugin_name + lib_extension;
WOLF_TRACE("Loading plugin " + plugin_name + " in " + plugins_path); WOLF_DEBUG("Loading plugin " + plugin_name + " in " + plugins_path);
_loader->load(plugin); _loader->load(plugin);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment