diff --git a/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.cpp b/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.cpp index 1e8f298029912c1eab459cd5d285ba0a8e144ff5..a82524efcbe911b9c896bee7a4e926be7ac31f86 100644 --- a/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.cpp +++ b/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.cpp @@ -272,10 +272,10 @@ namespace armarx return result.toIce(); } - armem::prediction::data::PredictionEngineSeq + armem::prediction::data::EngineSupportMap ExampleMemory::getAvailableEngines() { - return {{"Latest"}}; + return {{armarx::toIce<armem::data::MemoryID>(workingMemory().id()), {{"Latest"}}}}; } // REMOTE GUI diff --git a/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.h b/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.h index de89914ba8ed44517ce40639849afa826d022ef1..fa9c2b1eacc314bcb37de05f4f19039d9bcbd582 100644 --- a/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.h +++ b/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.h @@ -76,7 +76,7 @@ namespace armarx armem::prediction::data::PredictionResultSeq predict(const armem::prediction::data::PredictionRequestSeq& requests) override; - armem::prediction::data::PredictionEngineSeq getAvailableEngines() override; + armem::prediction::data::EngineSupportMap getAvailableEngines() override; protected: diff --git a/source/RobotAPI/interface/armem/prediction.ice b/source/RobotAPI/interface/armem/prediction.ice index f42535928e434be36702a949f9929246a8f08f7b..a2aae725e3ef5a399ccfacf819d07eb56693f8e4 100644 --- a/source/RobotAPI/interface/armem/prediction.ice +++ b/source/RobotAPI/interface/armem/prediction.ice @@ -17,6 +17,7 @@ module armarx string engineID; } sequence<PredictionEngine> PredictionEngineSeq; + dictionary<armem::data::MemoryID, PredictionEngineSeq> EngineSupportMap; // Settings to use for a given prediction (e.g. which engine to use) struct PredictionSettings diff --git a/source/RobotAPI/interface/armem/server/PredictingMemoryInterface.ice b/source/RobotAPI/interface/armem/server/PredictingMemoryInterface.ice index 65e0c2a6e03aac24dccc85038884d46b13382ed0..ead5ad03b5edd7f1bbb39dd1c528376005c8b041 100644 --- a/source/RobotAPI/interface/armem/server/PredictingMemoryInterface.ice +++ b/source/RobotAPI/interface/armem/server/PredictingMemoryInterface.ice @@ -17,9 +17,11 @@ module armarx prediction::data::PredictionResultSeq predict(prediction::data::PredictionRequestSeq requests); - /* Get the list of engines the memory offers for use in predictions. + /* Get a map from memory segments to the prediction engines they support. + * Best used with the armem::core::PrefixMap to easily retrieve + * the available engine selection for fully evaluated MemoryIDs. */ - prediction::data::PredictionEngineSeq getAvailableEngines(); + prediction::data::EngineSupportMap getAvailableEngines(); } }; }; diff --git a/source/RobotAPI/libraries/armem/client/Reader.cpp b/source/RobotAPI/libraries/armem/client/Reader.cpp index 52be34eb42c8f5c54f2138731690a5f43728d6f8..ce2d0cfcfa41bedc7f6cab56f45e79d959bc68da 100644 --- a/source/RobotAPI/libraries/armem/client/Reader.cpp +++ b/source/RobotAPI/libraries/armem/client/Reader.cpp @@ -479,7 +479,7 @@ namespace armarx::armem::client return boResults; } - std::vector<PredictionEngine> + armem::prediction::data::EngineSupportMap Reader::getAvailablePredictionEngines() const { if (!predictionPrx) @@ -489,7 +489,7 @@ namespace armarx::armem::client "Prediction interface proxy must be set to request a prediction."); } - std::vector<armem::prediction::data::PredictionEngine> engines; + armem::prediction::data::EngineSupportMap engines; try { engines = predictionPrx->getAvailableEngines(); @@ -499,13 +499,13 @@ namespace armarx::armem::client // Just leave engines empty in this case. } - std::vector<PredictionEngine> boEngines; - boEngines.reserve(engines.size()); - for (const auto& engine : engines) - { - boEngines.push_back(armarx::fromIce<PredictionEngine>(engine)); - } + //std::vector<PredictionEngine> boEngines; + //boEngines.reserve(engines.size()); + //for (const auto& engine : engines) + //{ + // boEngines.push_back(armarx::fromIce<PredictionEngine>(engine)); + //} - return boEngines; + return engines; } } // namespace armarx::armem::client diff --git a/source/RobotAPI/libraries/armem/client/Reader.h b/source/RobotAPI/libraries/armem/client/Reader.h index beb0e53f5ff25078cb881d4477c19c5cd291fe1a..37bc5fba0d58385a5c6dd7538b681e84eec21f3c 100644 --- a/source/RobotAPI/libraries/armem/client/Reader.h +++ b/source/RobotAPI/libraries/armem/client/Reader.h @@ -185,7 +185,7 @@ namespace armarx::armem::client * * @return the vector of supported prediction engines */ - std::vector<PredictionEngine> getAvailablePredictionEngines() const; + armem::prediction::data::EngineSupportMap getAvailablePredictionEngines() const; inline operator bool() const { diff --git a/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.cpp b/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.cpp index 115e38311ae09d9d5e1362bf362b1207a76173a8..51aab481336392d1b4a78695410fc2607b4d93f8 100644 --- a/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.cpp +++ b/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.cpp @@ -134,7 +134,7 @@ namespace armarx::armem::server::plugins return result; } - armem::prediction::data::PredictionEngineSeq + armem::prediction::data::EngineSupportMap ReadWritePluginUser::getAvailableEngines() { return {}; @@ -147,7 +147,7 @@ namespace armarx::armem::server::plugins return predict(requests); } - armem::prediction::data::PredictionEngineSeq + armem::prediction::data::EngineSupportMap ReadWritePluginUser::getAvailableEngines(const ::Ice::Current& /*unused*/) { return getAvailableEngines(); diff --git a/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.h b/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.h index 1e0b4bc82568382ead82cbf7b337529db4f46251..37f25fd8f3199179402755dc76d98367964aa2af 100644 --- a/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.h +++ b/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.h @@ -57,10 +57,10 @@ namespace armarx::armem::server::plugins // PredictingInterface interface virtual armem::prediction::data::PredictionResultSeq predict(const armem::prediction::data::PredictionRequestSeq& requests); - virtual armem::prediction::data::PredictionEngineSeq getAvailableEngines(); + virtual armem::prediction::data::EngineSupportMap getAvailableEngines(); virtual armem::prediction::data::PredictionResultSeq predict(const armem::prediction::data::PredictionRequestSeq& requests, const ::Ice::Current&) override; - virtual armem::prediction::data::PredictionEngineSeq getAvailableEngines(const ::Ice::Current&) override; + virtual armem::prediction::data::EngineSupportMap getAvailableEngines(const ::Ice::Current&) override; public: