Skip to content

Commit

Permalink
Fix loss of yaml key/values when using import-from-file feature
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Dec 27, 2023
1 parent fc6435c commit 6cdab12
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mola_kernel/src/interfaces/FrontEndBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ void FrontEndBase::initialize_common(const Yaml& cfg)
}
else
{
MRPT_LOG_WARN(
MRPT_LOG_WARN_STREAM(
"No 'raw_data_source' entry found in the YAML definition for a "
"FrontEndBase.");
"FrontEndBase: YAML contents:\n"
<< cfg << "\n");
}

// Optional: attach to the SLAM backend:
Expand Down
13 changes: 13 additions & 0 deletions mola_launcher/src/MolaLauncherApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,20 @@ void MolaLauncherApp::setup(

// Overwrite configuration block: the external file should
// contain a "params:" YAML map, etc.
// But keep other map entries apart of "params":
mola::Yaml old = mola::Yaml::Map();
for (const auto& [k, v] : info.yaml_cfg_block.asMap())
{
if (k.as<std::string>() == "params") continue;
old[k.as<std::string>()] = v;
}

// overwrite:
info.yaml_cfg_block = mola::load_yaml_file(absPathParamsFile);

// apend other entries:
for (const auto& [k, v] : old.asMap())
info.yaml_cfg_block[k.as<std::string>()] = v;
}

MRPT_LOG_INFO_STREAM(
Expand Down

0 comments on commit 6cdab12

Please sign in to comment.