Skip to content
Snippets Groups Projects
Commit cf371065 authored by Joana Plewnia's avatar Joana Plewnia
Browse files

Loading LTM into current WM on startup of memory server.

As the snapshots are the oldest though, they will be forgotten relatively fast if maxHistorySize for that CoreSegment is small.
Currently import path is assumed to be the same as export path or empty.
When empty, nothing is done, when non-empty export path and export name are used to import last snapshots for this memory.
parent c85eac75
No related branches found
No related tags found
1 merge request!469Loading the last n Snapshots from LTM on Startup
Pipeline #20752 passed
......@@ -52,6 +52,8 @@ namespace armarx::armem::server::ltm::detail
configure()
{
bool en = p.enabled_on_startup;
ARMARX_INFO << VAROUT(p.import_name);
ARMARX_INFO << VAROUT(p.import_path);
ARMARX_INFO << VAROUT(p.configuration_on_startup);
ARMARX_INFO << VAROUT(p.export_name);
this->setExportName(p.export_name);
......@@ -75,6 +77,12 @@ namespace armarx::armem::server::ltm::detail
{
this->startRecording();
}
std::string importPath = p.import_path;
if (importPath.length() > 0){
this->loadOnStartup();
}
}
/// enable this LTM
......@@ -203,6 +211,8 @@ namespace armarx::armem::server::ltm::detail
defs->optional(p.enabled_on_startup, prefix + "enabled");
defs->optional(p.configuration_on_startup, prefix + "configuration");
defs->optional(p.export_name, prefix + "exportName");
defs->optional(p.import_name, prefix + "importName");
defs->optional(p.import_path, prefix + "importPath");
}
/// enable/disable
......@@ -270,6 +280,16 @@ namespace armarx::armem::server::ltm::detail
return "LT-Memory";
}
void loadOnStartup(){
ARMARX_INFO << "Loading on startup from " << p.import_path << "/" << p.import_name;
try{
this->loadAllAndResolve();
}
catch(...){
ARMARX_INFO << "Could not load memory " << this->name() << " on startup";
}
}
protected:
/// configuration
virtual void
......@@ -307,6 +327,8 @@ namespace armarx::armem::server::ltm::detail
"\"PngConverter\": {}, \"ExrConverter\": {}}"; //record with 20 fps as standard
std::string export_name = "MemoryExport";
std::string export_path = "/tmp/ltm";
std::string import_path = "/tmp/ltm";
std::string import_name = "MemoryExport";
} p;
protected:
......
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