From 6e6aa233f6aff110dce733a5911505a83bd9c753 Mon Sep 17 00:00:00 2001 From: phesch <ulila@student.kit.edu> Date: Tue, 26 Apr 2022 19:26:17 +0200 Subject: [PATCH] Add PredictingMemoryInterface to armem --- source/RobotAPI/interface/CMakeLists.txt | 3 ++- .../RobotAPI/interface/armem/predictions.ice | 20 ++++++++++++++++ source/RobotAPI/interface/armem/server.ice | 1 + .../armem/server/MemoryInterface.ice | 3 +++ .../armem/server/MemoryPredictorInterface.ice | 16 ------------- .../server/PredictingMemoryInterface.ice | 23 +++++++++++++++++++ .../server/plugins/ReadWritePluginUser.cpp | 15 ++++++++++++ .../server/plugins/ReadWritePluginUser.h | 4 ++++ 8 files changed, 68 insertions(+), 17 deletions(-) create mode 100644 source/RobotAPI/interface/armem/predictions.ice delete mode 100644 source/RobotAPI/interface/armem/server/MemoryPredictorInterface.ice create mode 100644 source/RobotAPI/interface/armem/server/PredictingMemoryInterface.ice diff --git a/source/RobotAPI/interface/CMakeLists.txt b/source/RobotAPI/interface/CMakeLists.txt index be1193d66..2913cd662 100644 --- a/source/RobotAPI/interface/CMakeLists.txt +++ b/source/RobotAPI/interface/CMakeLists.txt @@ -110,6 +110,7 @@ set(SLICE_FILES armem/io.ice armem/commit.ice armem/memory.ice + armem/predictions.ice armem/query.ice armem/client.ice @@ -120,7 +121,7 @@ set(SLICE_FILES armem/server/StoringMemoryInterface.ice armem/server/LoadingMemoryInterface.ice armem/server/MemoryInterface.ice - armem/server/MemoryPredictorInterface.ice + armem/server/PredictingMemoryInterface.ice armem/server/ReadingMemoryInterface.ice armem/server/WritingMemoryInterface.ice diff --git a/source/RobotAPI/interface/armem/predictions.ice b/source/RobotAPI/interface/armem/predictions.ice new file mode 100644 index 000000000..5748a11cf --- /dev/null +++ b/source/RobotAPI/interface/armem/predictions.ice @@ -0,0 +1,20 @@ +#pragma once + +module armarx +{ + module armem + { + module predictions + { + module data + { + struct PredictionSettings + { + string predictionEngine = ""; + }; + + sequence<string> PredictionEngineSeq; + }; + }; + }; +}; diff --git a/source/RobotAPI/interface/armem/server.ice b/source/RobotAPI/interface/armem/server.ice index 4d9b0bce8..5c7a32c47 100644 --- a/source/RobotAPI/interface/armem/server.ice +++ b/source/RobotAPI/interface/armem/server.ice @@ -3,3 +3,4 @@ #include <RobotAPI/interface/armem/server/MemoryInterface.ice> #include <RobotAPI/interface/armem/server/ReadingMemoryInterface.ice> #include <RobotAPI/interface/armem/server/WritingMemoryInterface.ice> +#include <RobotAPI/interface/armem/server/PredictingMemoryInterface.ice> diff --git a/source/RobotAPI/interface/armem/server/MemoryInterface.ice b/source/RobotAPI/interface/armem/server/MemoryInterface.ice index 05b2ea8c5..2c6c1e14c 100644 --- a/source/RobotAPI/interface/armem/server/MemoryInterface.ice +++ b/source/RobotAPI/interface/armem/server/MemoryInterface.ice @@ -5,6 +5,8 @@ #include <RobotAPI/interface/armem/server/ReadingMemoryInterface.ice> #include <RobotAPI/interface/armem/server/WritingMemoryInterface.ice> +#include <RobotAPI/interface/armem/server/PredictingMemoryInterface.ice> + #include <RobotAPI/interface/armem/server/ActionsInterface.ice> #include <RobotAPI/interface/armem/client/MemoryListenerInterface.ice> @@ -27,6 +29,7 @@ module armarx interface MemoryInterface extends WorkingMemoryInterface, LongTermMemoryInterface, + PredictingMemoryInterface, actions::ActionsInterface, client::MemoryListenerInterface { diff --git a/source/RobotAPI/interface/armem/server/MemoryPredictorInterface.ice b/source/RobotAPI/interface/armem/server/MemoryPredictorInterface.ice deleted file mode 100644 index 42920804f..000000000 --- a/source/RobotAPI/interface/armem/server/MemoryPredictorInterface.ice +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include <RobotAPI/interface/armem/server/ReadingMemoryInterface.ice> -#include <RobotAPI/interface/armem/server/WritingMemoryInterface.ice> - -module armarx { - module armem { - module server { - interface MemoryPredictorInterface - { - // TODO - void predict(); - } - }; - }; -}; diff --git a/source/RobotAPI/interface/armem/server/PredictingMemoryInterface.ice b/source/RobotAPI/interface/armem/server/PredictingMemoryInterface.ice new file mode 100644 index 000000000..2a805895d --- /dev/null +++ b/source/RobotAPI/interface/armem/server/PredictingMemoryInterface.ice @@ -0,0 +1,23 @@ +#pragma once + +#include <RobotAPI/interface/armem/memory.ice> +#include <RobotAPI/interface/armem/predictions.ice> +#include <RobotAPI/interface/armem/query.ice> + +module armarx +{ + module armem + { + module server + { + interface PredictingMemoryInterface + { + armem::query::data::Result + predict(armem::data::MemoryID memoryID, + predictions::data::PredictionSettings predictionSettings); + + predictions::data::PredictionEngineSeq getAvailableEngines(); + } + }; + }; +}; diff --git a/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.cpp b/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.cpp index 41e09c13b..4ce314f5a 100644 --- a/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.cpp +++ b/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.cpp @@ -117,4 +117,19 @@ namespace armarx::armem::server::plugins return {}; } + // PREDICTIONS + armem::query::data::Result ReadWritePluginUser::predict(const data::MemoryID& /*memoryID*/, const armem::predictions::data::PredictionSettings& /*predictionSettings*/, const ::Ice::Current& /*unused*/) + { + armem::query::data::Result result; + result.success = false; + result.errorMessage = "This memory does not implement predictions."; + result.memory = nullptr; + return result; + } + + armem::predictions::data::PredictionEngineSeq ReadWritePluginUser::getAvailableEngines(const ::Ice::Current& /*unused*/) + { + return {}; + } + } // namespace armarx::armem::server::plugins diff --git a/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.h b/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.h index 83e761281..3ecd8915f 100644 --- a/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.h +++ b/source/RobotAPI/libraries/armem/server/plugins/ReadWritePluginUser.h @@ -55,6 +55,10 @@ namespace armarx::armem::server::plugins virtual armem::actions::GetActionsOutputSeq getActions(const armem::actions::GetActionsInputSeq& inputs, const ::Ice::Current&) override; virtual armem::actions::ExecuteActionOutputSeq executeActions(const armem::actions::ExecuteActionInputSeq& inputs, const ::Ice::Current&) override; + // PredictingInterface interface + virtual armem::query::data::Result predict(const data::MemoryID& memoryID, const armem::predictions::data::PredictionSettings& predictionSettings, const ::Ice::Current& = Ice::emptyCurrent) override; + virtual armem::predictions::data::PredictionEngineSeq getAvailableEngines(const ::Ice::Current& = Ice::emptyCurrent) override; + public: Plugin& memoryServerPlugin(); -- GitLab