diff --git a/scenarios/RobotSkillsMemory/RobotSkillsMemory.scx b/scenarios/RobotSkillsMemory/RobotSkillsMemory.scx new file mode 100644 index 0000000000000000000000000000000000000000..9622c34e544899a5f2e81e01f5f6f7ad6744b013 --- /dev/null +++ b/scenarios/RobotSkillsMemory/RobotSkillsMemory.scx @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<scenario name="RobotSkillsMemory" creation="2021-05-07.11:08:24" globalConfigName="./config/global.cfg" package="RobotAPI" deploymentType="local" nodeName="NodeMain"> + <application name="RemoteGuiProviderApp" instance="" package="ArmarXGui" nodeName="" enabled="true" iceAutoRestart="false"/> + <application name="SkillsMemory" instance="" package="RobotAPI" nodeName="" enabled="true" iceAutoRestart="false"/> + <application name="MemoryNameSystem" instance="" package="RobotAPI" nodeName="" enabled="true" iceAutoRestart="false"/> +</scenario> + diff --git a/scenarios/RobotSkillsMemory/config/MemoryNameSystem.cfg b/scenarios/RobotSkillsMemory/config/MemoryNameSystem.cfg new file mode 100644 index 0000000000000000000000000000000000000000..7dd22218243ca4f9e67e843da8b42916f3b8568a --- /dev/null +++ b/scenarios/RobotSkillsMemory/config/MemoryNameSystem.cfg @@ -0,0 +1,196 @@ +# ================================================================== +# MemoryNameSystem properties +# ================================================================== + +# ArmarX.AdditionalPackages: List of additional ArmarX packages which should be in the list of default packages. If you have custom packages, which should be found by the gui or other apps, specify them here. Comma separated List. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: yes +# - Required: no +# ArmarX.AdditionalPackages = Default value not mapped. + + +# ArmarX.ApplicationName: Application name +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.ApplicationName = "" + + +# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_USER_CONFIG_DIR is set, the cache path will be made relative to ARMARX_USER_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${HOME}/.armarx) +# Attributes: +# - Default: mongo/.cache +# - Case sensitivity: yes +# - Required: no +# ArmarX.CachePath = mongo/.cache + + +# ArmarX.Config: Comma-separated list of configuration files +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.Config = "" + + +# ArmarX.DataPath: Semicolon-separated search list for data files +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.DataPath = "" + + +# ArmarX.DefaultPackages: List of ArmarX packages which are accessible by default. Comma separated List. If you want to add your own packages and use all default ArmarX packages, use the property 'AdditionalPackages'. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: yes +# - Required: no +# ArmarX.DefaultPackages = Default value not mapped. + + +# ArmarX.DependenciesConfig: Path to the (usually generated) config file containing all data paths of all dependent projects. This property usually does not need to be edited. +# Attributes: +# - Default: ./config/dependencies.cfg +# - Case sensitivity: yes +# - Required: no +# ArmarX.DependenciesConfig = ./config/dependencies.cfg + + +# ArmarX.DisableLogging: Turn logging off in whole application +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.DisableLogging = false + + +# ArmarX.EnableProfiling: Enable profiling of CPU load produced by this application +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.EnableProfiling = false + + +# ArmarX.LoadLibraries: Libraries to load at start up of the application. Must be enabled by the Application with enableLibLoading(). Format: PackageName:LibraryName;... or /absolute/path/to/library;... +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.LoadLibraries = "" + + +# ArmarX.LoggingGroup: The logging group is transmitted with every ArmarX log message over Ice in order to group the message in the GUI. +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.LoggingGroup = "" + + +# ArmarX.MemoryNameSystem.EnableProfiling: enable profiler which is used for logging performance events +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.MemoryNameSystem.EnableProfiling = false + + +# ArmarX.MemoryNameSystem.MinimumLoggingLevel: Local logging level only for this component +# Attributes: +# - Default: Undefined +# - Case sensitivity: yes +# - Required: no +# - Possible values: {Debug, Error, Fatal, Important, Info, Undefined, Verbose, Warning} +# ArmarX.MemoryNameSystem.MinimumLoggingLevel = Undefined + + +# ArmarX.MemoryNameSystem.ObjectName: Name of IceGrid well-known object +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.MemoryNameSystem.ObjectName = "" + + +# ArmarX.MemoryNameSystem.RemoteGuiName: Name of the remote gui provider +# Attributes: +# - Default: RemoteGuiProvider +# - Case sensitivity: yes +# - Required: no +# ArmarX.MemoryNameSystem.RemoteGuiName = RemoteGuiProvider + + +# ArmarX.RedirectStdout: Redirect std::cout and std::cerr to ArmarXLog +# Attributes: +# - Default: true +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.RedirectStdout = true + + +# ArmarX.RemoteHandlesDeletionTimeout: The timeout (in ms) before a remote handle deletes the managed object after the use count reached 0. This time can be used by a client to increment the count again (may be required when transmitting remote handles) +# Attributes: +# - Default: 3000 +# - Case sensitivity: yes +# - Required: no +# ArmarX.RemoteHandlesDeletionTimeout = 3000 + + +# ArmarX.SecondsStartupDelay: The startup will be delayed by this number of seconds (useful for debugging) +# Attributes: +# - Default: 0 +# - Case sensitivity: yes +# - Required: no +# ArmarX.SecondsStartupDelay = 0 + + +# ArmarX.StartDebuggerOnCrash: If this application crashes (segmentation fault) qtcreator will attach to this process and start the debugger. +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.StartDebuggerOnCrash = false + + +# ArmarX.ThreadPoolSize: Size of the ArmarX ThreadPool that is always running. +# Attributes: +# - Default: 1 +# - Case sensitivity: yes +# - Required: no +# ArmarX.ThreadPoolSize = 1 + + +# ArmarX.TopicSuffix: Suffix appended to all topic names for outgoing topics. This is mainly used to direct all topics to another name for TopicReplaying purposes. +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.TopicSuffix = "" + + +# ArmarX.UseTimeServer: Enable using a global Timeserver (e.g. from ArmarXSimulator) +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.UseTimeServer = false + + +# ArmarX.Verbosity: Global logging level for whole application +# Attributes: +# - Default: Info +# - Case sensitivity: yes +# - Required: no +# - Possible values: {Debug, Error, Fatal, Important, Info, Undefined, Verbose, Warning} +# ArmarX.Verbosity = Info + + diff --git a/scenarios/RobotSkillsMemory/config/RemoteGuiProviderApp.cfg b/scenarios/RobotSkillsMemory/config/RemoteGuiProviderApp.cfg new file mode 100644 index 0000000000000000000000000000000000000000..4fd690cefd94559b207493cf40e346a3e47f3b12 --- /dev/null +++ b/scenarios/RobotSkillsMemory/config/RemoteGuiProviderApp.cfg @@ -0,0 +1,196 @@ +# ================================================================== +# RemoteGuiProviderApp properties +# ================================================================== + +# ArmarX.AdditionalPackages: List of additional ArmarX packages which should be in the list of default packages. If you have custom packages, which should be found by the gui or other apps, specify them here. Comma separated List. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: yes +# - Required: no +# ArmarX.AdditionalPackages = Default value not mapped. + + +# ArmarX.ApplicationName: Application name +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.ApplicationName = "" + + +# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_USER_CONFIG_DIR is set, the cache path will be made relative to ARMARX_USER_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${HOME}/.armarx) +# Attributes: +# - Default: mongo/.cache +# - Case sensitivity: yes +# - Required: no +# ArmarX.CachePath = mongo/.cache + + +# ArmarX.Config: Comma-separated list of configuration files +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.Config = "" + + +# ArmarX.DataPath: Semicolon-separated search list for data files +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.DataPath = "" + + +# ArmarX.DefaultPackages: List of ArmarX packages which are accessible by default. Comma separated List. If you want to add your own packages and use all default ArmarX packages, use the property 'AdditionalPackages'. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: yes +# - Required: no +# ArmarX.DefaultPackages = Default value not mapped. + + +# ArmarX.DependenciesConfig: Path to the (usually generated) config file containing all data paths of all dependent projects. This property usually does not need to be edited. +# Attributes: +# - Default: ./config/dependencies.cfg +# - Case sensitivity: yes +# - Required: no +# ArmarX.DependenciesConfig = ./config/dependencies.cfg + + +# ArmarX.DisableLogging: Turn logging off in whole application +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.DisableLogging = false + + +# ArmarX.EnableProfiling: Enable profiling of CPU load produced by this application +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.EnableProfiling = false + + +# ArmarX.LoadLibraries: Libraries to load at start up of the application. Must be enabled by the Application with enableLibLoading(). Format: PackageName:LibraryName;... or /absolute/path/to/library;... +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.LoadLibraries = "" + + +# ArmarX.LoggingGroup: The logging group is transmitted with every ArmarX log message over Ice in order to group the message in the GUI. +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.LoggingGroup = "" + + +# ArmarX.RedirectStdout: Redirect std::cout and std::cerr to ArmarXLog +# Attributes: +# - Default: true +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.RedirectStdout = true + + +# ArmarX.RemoteGuiProvider.EnableProfiling: enable profiler which is used for logging performance events +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.RemoteGuiProvider.EnableProfiling = false + + +# ArmarX.RemoteGuiProvider.MinimumLoggingLevel: Local logging level only for this component +# Attributes: +# - Default: Undefined +# - Case sensitivity: yes +# - Required: no +# - Possible values: {Debug, Error, Fatal, Important, Info, Undefined, Verbose, Warning} +# ArmarX.RemoteGuiProvider.MinimumLoggingLevel = Undefined + + +# ArmarX.RemoteGuiProvider.ObjectName: Name of IceGrid well-known object +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.RemoteGuiProvider.ObjectName = "" + + +# ArmarX.RemoteGuiProvider.TopicName: Name of the topic on which updates to the remote state are reported. +# Attributes: +# - Default: RemoteGuiTopic +# - Case sensitivity: yes +# - Required: no +# ArmarX.RemoteGuiProvider.TopicName = RemoteGuiTopic + + +# ArmarX.RemoteHandlesDeletionTimeout: The timeout (in ms) before a remote handle deletes the managed object after the use count reached 0. This time can be used by a client to increment the count again (may be required when transmitting remote handles) +# Attributes: +# - Default: 3000 +# - Case sensitivity: yes +# - Required: no +# ArmarX.RemoteHandlesDeletionTimeout = 3000 + + +# ArmarX.SecondsStartupDelay: The startup will be delayed by this number of seconds (useful for debugging) +# Attributes: +# - Default: 0 +# - Case sensitivity: yes +# - Required: no +# ArmarX.SecondsStartupDelay = 0 + + +# ArmarX.StartDebuggerOnCrash: If this application crashes (segmentation fault) qtcreator will attach to this process and start the debugger. +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.StartDebuggerOnCrash = false + + +# ArmarX.ThreadPoolSize: Size of the ArmarX ThreadPool that is always running. +# Attributes: +# - Default: 1 +# - Case sensitivity: yes +# - Required: no +# ArmarX.ThreadPoolSize = 1 + + +# ArmarX.TopicSuffix: Suffix appended to all topic names for outgoing topics. This is mainly used to direct all topics to another name for TopicReplaying purposes. +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.TopicSuffix = "" + + +# ArmarX.UseTimeServer: Enable using a global Timeserver (e.g. from ArmarXSimulator) +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.UseTimeServer = false + + +# ArmarX.Verbosity: Global logging level for whole application +# Attributes: +# - Default: Info +# - Case sensitivity: yes +# - Required: no +# - Possible values: {Debug, Error, Fatal, Important, Info, Undefined, Verbose, Warning} +# ArmarX.Verbosity = Info + + diff --git a/scenarios/RobotSkillsMemory/config/SkillsMemory.cfg b/scenarios/RobotSkillsMemory/config/SkillsMemory.cfg new file mode 100644 index 0000000000000000000000000000000000000000..57a92b84c82797807a38c8635dbe1fb7d3d3d43d --- /dev/null +++ b/scenarios/RobotSkillsMemory/config/SkillsMemory.cfg @@ -0,0 +1,262 @@ +# ================================================================== +# SkillsMemory properties +# ================================================================== + +# ArmarX.AdditionalPackages: List of additional ArmarX packages which should be in the list of default packages. If you have custom packages, which should be found by the gui or other apps, specify them here. Comma separated List. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: yes +# - Required: no +# ArmarX.AdditionalPackages = Default value not mapped. + + +# ArmarX.ApplicationName: Application name +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.ApplicationName = "" + + +# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_USER_CONFIG_DIR is set, the cache path will be made relative to ARMARX_USER_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${HOME}/.armarx) +# Attributes: +# - Default: mongo/.cache +# - Case sensitivity: yes +# - Required: no +# ArmarX.CachePath = mongo/.cache + + +# ArmarX.Config: Comma-separated list of configuration files +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.Config = "" + + +# ArmarX.DataPath: Semicolon-separated search list for data files +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.DataPath = "" + + +# ArmarX.DefaultPackages: List of ArmarX packages which are accessible by default. Comma separated List. If you want to add your own packages and use all default ArmarX packages, use the property 'AdditionalPackages'. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: yes +# - Required: no +# ArmarX.DefaultPackages = Default value not mapped. + + +# ArmarX.DependenciesConfig: Path to the (usually generated) config file containing all data paths of all dependent projects. This property usually does not need to be edited. +# Attributes: +# - Default: ./config/dependencies.cfg +# - Case sensitivity: yes +# - Required: no +# ArmarX.DependenciesConfig = ./config/dependencies.cfg + + +# ArmarX.DisableLogging: Turn logging off in whole application +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.DisableLogging = false + + +# ArmarX.EnableProfiling: Enable profiling of CPU load produced by this application +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.EnableProfiling = false + + +# ArmarX.LoadLibraries: Libraries to load at start up of the application. Must be enabled by the Application with enableLibLoading(). Format: PackageName:LibraryName;... or /absolute/path/to/library;... +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.LoadLibraries = "" + + +# ArmarX.LoggingGroup: The logging group is transmitted with every ArmarX log message over Ice in order to group the message in the GUI. +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.LoggingGroup = "" + + +# ArmarX.RedirectStdout: Redirect std::cout and std::cerr to ArmarXLog +# Attributes: +# - Default: true +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.RedirectStdout = true + + +# ArmarX.RemoteHandlesDeletionTimeout: The timeout (in ms) before a remote handle deletes the managed object after the use count reached 0. This time can be used by a client to increment the count again (may be required when transmitting remote handles) +# Attributes: +# - Default: 3000 +# - Case sensitivity: yes +# - Required: no +# ArmarX.RemoteHandlesDeletionTimeout = 3000 + + +# ArmarX.SecondsStartupDelay: The startup will be delayed by this number of seconds (useful for debugging) +# Attributes: +# - Default: 0 +# - Case sensitivity: yes +# - Required: no +# ArmarX.SecondsStartupDelay = 0 + + +# ArmarX.SkillsMemory.: +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.SkillsMemory. = "" + + +# ArmarX.SkillsMemory.EnableProfiling: enable profiler which is used for logging performance events +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.SkillsMemory.EnableProfiling = false + + +# ArmarX.SkillsMemory.MinimumLoggingLevel: Local logging level only for this component +# Attributes: +# - Default: Undefined +# - Case sensitivity: yes +# - Required: no +# - Possible values: {Debug, Error, Fatal, Important, Info, Undefined, Verbose, Warning} +# ArmarX.SkillsMemory.MinimumLoggingLevel = Undefined + + +# ArmarX.SkillsMemory.ObjectName: Name of IceGrid well-known object +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.SkillsMemory.ObjectName = "" + + +# ArmarX.SkillsMemory.StatechartCoreSegmentName: Name of the core segment for statecharts. +# Attributes: +# - Default: Statechart +# - Case sensitivity: yes +# - Required: no +# ArmarX.SkillsMemory.StatechartCoreSegmentName = Statechart + + +# ArmarX.SkillsMemory.TransitionsProviderSegmentName: Name of the provider segment for statechart transitions. +# Attributes: +# - Default: Transitions +# - Case sensitivity: yes +# - Required: no +# ArmarX.SkillsMemory.TransitionsProviderSegmentName = Transitions + + +# ArmarX.SkillsMemory.mem.MemoryName: Name of this memory server. +# Attributes: +# - Default: Skills +# - Case sensitivity: yes +# - Required: no +# ArmarX.SkillsMemory.mem.MemoryName = Skills + + +# ArmarX.SkillsMemory.mns.MemoryNameSystemEnabled: Whether to use (and depend on) the Memory Name System (MNS). +# Set to false to use this memory as a stand-alone. +# Attributes: +# - Default: true +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.SkillsMemory.mns.MemoryNameSystemEnabled = true + + +# ArmarX.SkillsMemory.mns.MemoryNameSystemName: Name of the Memory Name System (MNS) component. +# Attributes: +# - Default: MemoryNameSystem +# - Case sensitivity: yes +# - Required: no +# ArmarX.SkillsMemory.mns.MemoryNameSystemName = MemoryNameSystem + + +# ArmarX.SkillsMemory.tpc.pub.DebugObserver: Name of the `DebugObserver` topic to publish data to. +# Attributes: +# - Default: DebugObserver +# - Case sensitivity: yes +# - Required: no +# ArmarX.SkillsMemory.tpc.pub.DebugObserver = DebugObserver + + +# ArmarX.SkillsMemory.tpc.pub.MemoryListener: Name of the `MemoryListener` topic to publish data to. +# Attributes: +# - Default: MemoryUpdates +# - Case sensitivity: yes +# - Required: no +# ArmarX.SkillsMemory.tpc.pub.MemoryListener = MemoryUpdates + + +# ArmarX.SkillsMemory.tpc.sub.ProfilerListener: Name of the ProfilerListenerInterface topics to subscribe. +# Attributes: +# - Default: StateReportingTopic +# - Case sensitivity: yes +# - Required: no +# ArmarX.SkillsMemory.tpc.sub.ProfilerListener = StateReportingTopic + + +# ArmarX.StartDebuggerOnCrash: If this application crashes (segmentation fault) qtcreator will attach to this process and start the debugger. +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.StartDebuggerOnCrash = false + + +# ArmarX.ThreadPoolSize: Size of the ArmarX ThreadPool that is always running. +# Attributes: +# - Default: 1 +# - Case sensitivity: yes +# - Required: no +# ArmarX.ThreadPoolSize = 1 + + +# ArmarX.TopicSuffix: Suffix appended to all topic names for outgoing topics. This is mainly used to direct all topics to another name for TopicReplaying purposes. +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.TopicSuffix = "" + + +# ArmarX.UseTimeServer: Enable using a global Timeserver (e.g. from ArmarXSimulator) +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.UseTimeServer = false + + +# ArmarX.Verbosity: Global logging level for whole application +# Attributes: +# - Default: Info +# - Case sensitivity: yes +# - Required: no +# - Possible values: {Debug, Error, Fatal, Important, Info, Undefined, Verbose, Warning} +# ArmarX.Verbosity = Info + + diff --git a/scenarios/RobotSkillsMemory/config/global.cfg b/scenarios/RobotSkillsMemory/config/global.cfg new file mode 100644 index 0000000000000000000000000000000000000000..f9f5f6c52197a68f353b2a5a3f1f7cc7d4d6272b --- /dev/null +++ b/scenarios/RobotSkillsMemory/config/global.cfg @@ -0,0 +1,4 @@ +# ================================================================== +# Global Config from Scenario RobotSkillsMemory +# ================================================================== + diff --git a/source/RobotAPI/components/armem/server/SkillsMemory/CMakeLists.txt b/source/RobotAPI/components/armem/server/SkillsMemory/CMakeLists.txt index c00bd89e9c47178acbe3ea49ac4b3d3bc3cc5436..b9d1d4fd44ed2bf58f8eccd64faa9ab0eafc83ef 100644 --- a/source/RobotAPI/components/armem/server/SkillsMemory/CMakeLists.txt +++ b/source/RobotAPI/components/armem/server/SkillsMemory/CMakeLists.txt @@ -2,14 +2,15 @@ armarx_component_set_name("SkillsMemory") set(COMPONENT_LIBS - ArmarXCore ArmarXCoreInterfaces # for DebugObserverInterface + ArmarXCore ArmarXCoreInterfaces ArmarXCoreObservers # for DebugObserverInterface ArmarXGuiComponentPlugins - RobotAPICore RobotAPIInterfaces armem + RobotAPICore RobotAPIInterfaces armem armem_skills # RobotAPIComponentPlugins # for ArViz and other plugins ${IVT_LIBRARIES} ) + set(SOURCES SkillsMemory.cpp ) @@ -17,8 +18,10 @@ set(HEADERS SkillsMemory.h ) + armarx_add_component("${SOURCES}" "${HEADERS}") + #generate the application armarx_generate_and_add_component_executable() diff --git a/source/RobotAPI/components/armem/server/SkillsMemory/SkillsMemory.cpp b/source/RobotAPI/components/armem/server/SkillsMemory/SkillsMemory.cpp index 295e2c6aee2010162c6919af97141f28989b6040..8a03cc15970b9da91dd3699ca883c94db13db522 100644 --- a/source/RobotAPI/components/armem/server/SkillsMemory/SkillsMemory.cpp +++ b/source/RobotAPI/components/armem/server/SkillsMemory/SkillsMemory.cpp @@ -22,22 +22,39 @@ #include "SkillsMemory.h" +#include <ArmarXCore/core/ArmarXManager.h> +#include <ArmarXCore/core/ArmarXObjectScheduler.h> #include <ArmarXCore/core/exceptions/local/ExpressionException.h> - -#include <SimoxUtility/algorithm/string.h> +#include <ArmarXCore/core/time/TimeUtil.h> +#include <ArmarXCore/core/logging/Logging.h> #include <RobotAPI/libraries/armem/core/error.h> +#include <RobotAPI/libraries/armem/core/workingmemory/CoreSegment.h> #include <RobotAPI/libraries/armem/server/MemoryRemoteGui.h> +#include <RobotAPI/libraries/armem_skills/aron_conversions.h> + + namespace armarx { SkillsMemory::SkillsMemory() - { - } + = default; armarx::PropertyDefinitionsPtr SkillsMemory::createPropertyDefinitions() { armarx::PropertyDefinitionsPtr defs = new ComponentPropertyDefinitions(getConfigIdentifier()); + + // Publish + defs->topic(debugObserver); + + // Statechart Logging + defs->optional(p.statechartCoreSegmentName, "StatechartCoreSegmentName", "Name of the core segment for statecharts."); + defs->optional(p.statechartTransitionsProviderSegmentName, "TransitionsProviderSegmentName", "Name of the provider segment for statechart transitions."); + defs->optional(p.statechartTransitionsTopicName, "tpc.sub.ProfilerListener", "Name of the ProfilerListenerInterface topics to subscribe."); + + const std::string prefix = "mem."; + defs->optional(p.memoryName, prefix + "MemoryName", "Name of this memory server."); + return defs; } @@ -50,17 +67,27 @@ namespace armarx void SkillsMemory::onInitComponent() { - workingMemory.name() = memoryName; + workingMemory.name() = p.memoryName; + + { + armarx::armem::wm::CoreSegment& c = workingMemory.addCoreSegment(p.statechartCoreSegmentName, armarx::armem::arondto::Statechart::Transition::toInitialAronType()); + c.addProviderSegment("Transitions", armarx::armem::arondto::Statechart::Transition::toInitialAronType()); + } } void SkillsMemory::onConnectComponent() { + statechartListener = createStatechartListener(p.statechartTransitionsTopicName); } void SkillsMemory::onDisconnectComponent() { + if (statechartListener) + { + getArmarXManager()->removeObjectBlocking(statechartListener->getName()); + } } @@ -73,7 +100,7 @@ namespace armarx // WRITING armem::data::AddSegmentsResult SkillsMemory::addSegments(const armem::data::AddSegmentsInput& input, const Ice::Current&) { - armem::data::AddSegmentsResult result = ComponentPluginUser::addSegments(input, addCoreSegmentOnUsage); + armem::data::AddSegmentsResult result = ComponentPluginUser::addSegments({input}, p.core.addOnUsage); return result; } @@ -88,4 +115,90 @@ namespace armarx // READING // Inherited from Plugin + + IceInternal::Handle<StatechartListener> + SkillsMemory::createStatechartListener(const std::string& topicName, const std::string& name) + { + const std::string name_ = name.empty() ? topicName + ".Listener" : name; + ARMARX_DEBUG << "Registering StatechartListener '" << name_ << "' listening to topic '" << topicName << "'."; + + IceInternal::Handle<armarx::StatechartListener> listener = Component::create<armarx::StatechartListener>(); + listener->setName(name_); + listener->setTopicName(topicName); + + // Callback for the transition listener + listener->registerCallback( + [this](const std::vector<StatechartListener::Transition>& transitions, + armarx::StatechartListener & source) + { + this->reportTransitions(transitions); + }); + + try + { + getArmarXManager()->addObject(listener); + } + catch (const Ice::AlreadyRegisteredException& e) + { + ARMARX_ERROR << "The name '" << name_ << "' is already used. Please choose another one.\n" + << "Reason: " << e.what(); + getArmarXManager()->removeObjectBlocking(name_); + } + listener->getObjectScheduler()->waitForObjectState(armarx::ManagedIceObjectState::eManagedIceObjectStarted); + + return listener; + } + + void + SkillsMemory::reportTransitions(const std::vector<StatechartListener::Transition>& transitions) + { + for (const StatechartListener::Transition& t : transitions) + { + const std::string& entityName = getStatechartName(t.targetStateIdentifier); + IceUtil::Time transitionTime = IceUtil::Time::microSeconds(t.timestamp); + + armem::EntityUpdate update; + update.entityID = armem::MemoryID() + .withMemoryName(p.memoryName) + .withCoreSegmentName(p.statechartCoreSegmentName) + .withProviderSegmentName(p.statechartTransitionsProviderSegmentName) + .withEntityName(entityName); + + update.timeCreated = transitionTime; + armem::arondto::Statechart::Transition data; + armem::toAron(data, t); + update.instancesData.push_back(data.toAron()); + + try + { + workingMemory.update(update); + } + catch (const armem::error::ArMemError& e) + { + ARMARX_WARNING << e.what(); + } + } + } + + std::string SkillsMemory::getStatechartName(std::string stateName) + { + const std::string delimiter = "->"; + const int maxLevels = 2; + + size_t pos; + int levels = 0; + std::string statechartName; + while ((pos = stateName.find(delimiter)) != std::string::npos && levels < maxLevels) + { + if (levels != 0) + { + statechartName += delimiter; + } + statechartName += stateName.substr(0, pos); + stateName.erase(0, pos + delimiter.length()); + levels++; + } + + return statechartName; + } } diff --git a/source/RobotAPI/components/armem/server/SkillsMemory/SkillsMemory.h b/source/RobotAPI/components/armem/server/SkillsMemory/SkillsMemory.h index 6201ffb07640bf4c75473d0a0e29876f4fdbf265..ebf0b02c48f90e31b5f93321343b12a66a2723c9 100644 --- a/source/RobotAPI/components/armem/server/SkillsMemory/SkillsMemory.h +++ b/source/RobotAPI/components/armem/server/SkillsMemory/SkillsMemory.h @@ -24,12 +24,14 @@ #include <ArmarXCore/core/Component.h> - #include <ArmarXCore/interface/observers/ObserverInterface.h> + #include <ArmarXGui/libraries/ArmarXGuiComponentPlugins/LightweightRemoteGuiComponentPlugin.h> -#include <RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.h> +#include <RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.h> #include <RobotAPI/libraries/armem/server/ComponentPlugin.h> +#include <RobotAPI/libraries/armem_skills/aron/Statechart.aron.generated.h> +#include <RobotAPI/libraries/armem_skills/StatechartListener.h> namespace armarx @@ -80,7 +82,33 @@ namespace armarx private: - std::string memoryName = "SkillsMemory"; - bool addCoreSegmentOnUsage = true; + DebugObserverInterfacePrx debugObserver; + + struct Properties + { + std::string memoryName = "Skills"; + + // Statechart transition logging + std::string statechartCoreSegmentName = "Statechart"; + std::string statechartTransitionsProviderSegmentName = "Transitions"; + std::string statechartTransitionsTopicName = "StateReportingTopic"; + + struct CoreSegments + { + bool addOnUsage = false; + }; + CoreSegments core; + }; + Properties p; + + + + IceInternal::Handle<StatechartListener> createStatechartListener(const std::string& topicName, + const std::string& name = ""); + IceInternal::Handle<armarx::StatechartListener> statechartListener; + void reportTransitions(const std::vector<StatechartListener::Transition>& transitions); + + // Gets the statechart name from a state name (takes first two levels of the hierarchy) + static std::string getStatechartName(std::string stateName); }; } diff --git a/source/RobotAPI/libraries/CMakeLists.txt b/source/RobotAPI/libraries/CMakeLists.txt index ace5dff8c0498522fd979a2b6a371c8dd160ecd9..5df6b028f0272c51a0538392375c27421d19dc06 100644 --- a/source/RobotAPI/libraries/CMakeLists.txt +++ b/source/RobotAPI/libraries/CMakeLists.txt @@ -23,6 +23,7 @@ add_subdirectory(armem_objects) add_subdirectory(armem_robot) add_subdirectory(armem_robot_state) add_subdirectory(armem_robot_mapping) +add_subdirectory(armem_skills) add_subdirectory(aron) add_subdirectory(NJointControllerGuiPluginUtility) diff --git a/source/RobotAPI/libraries/armem_skills/CMakeLists.txt b/source/RobotAPI/libraries/armem_skills/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..bb6968ecb11991511f67f464843683a5bbacc8ef --- /dev/null +++ b/source/RobotAPI/libraries/armem_skills/CMakeLists.txt @@ -0,0 +1,31 @@ +set(LIB_NAME armem_skills) + +armarx_component_set_name("${LIB_NAME}") +armarx_set_target("Library: ${LIB_NAME}") + +armarx_add_library( + LIBS + ArmarXCoreInterfaces + ArmarXCore + ArmarXCoreObservers + + RobotAPI::Core + RobotAPI::armem + SOURCES + ./aron_conversions.cpp + ./StatechartListener.cpp + HEADERS + ./aron_conversions.h + ./StatechartListener.h +) + + +armarx_enable_aron_file_generation_for_target( + TARGET_NAME + "${LIB_NAME}" + ARON_FILES + aron/Statechart.xml +) + + +add_library(RobotAPI::armem_skills ALIAS armem_skills) diff --git a/source/RobotAPI/libraries/armem_skills/StatechartListener.cpp b/source/RobotAPI/libraries/armem_skills/StatechartListener.cpp new file mode 100644 index 0000000000000000000000000000000000000000..82d3369f3a18f88ec384a5f04677eb6deaea6d95 --- /dev/null +++ b/source/RobotAPI/libraries/armem_skills/StatechartListener.cpp @@ -0,0 +1,63 @@ +#include "StatechartListener.h" + + +namespace armarx +{ + void StatechartListener::setName(const std::string& name) + { + armarx::Component::setName(name); + } + + void StatechartListener::setTopicName(const std::string& name) + { + this->topicName = name; + } + + std::string StatechartListener::getTopicName() const + { + return topicName; + } + + StatechartListener::~StatechartListener() = default; + + std::string StatechartListener::getDefaultName() const + { + return "StatechartListener"; + } + + void StatechartListener::onInitComponent() + { + ARMARX_INFO << getName() << "::" << __FUNCTION__ << "()"; + usingTopic(topicName); + } + void StatechartListener::onConnectComponent() + { + ARMARX_INFO << getName() << "::" << __FUNCTION__ << "()"; + } + + void StatechartListener::registerCallback(const StatechartListener::Callback& callback) + { + callbacks.push_back(callback); + } + + void StatechartListener::publish(const std::vector<Transition>& message) + { + for (Callback& callback : callbacks) + { + callback(message, *this); + } + } + + void + StatechartListener::reportStatechartTransitionWithParameters(const ProfilerStatechartTransitionWithParameters& transition, + const Ice::Current&) + { + publish({transition}); + } + + void StatechartListener::reportStatechartTransitionWithParametersList( + const ProfilerStatechartTransitionWithParametersList& transitions, const Ice::Current&) + { + publish(transitions); + } +} diff --git a/source/RobotAPI/libraries/armem_skills/StatechartListener.h b/source/RobotAPI/libraries/armem_skills/StatechartListener.h new file mode 100644 index 0000000000000000000000000000000000000000..a0308773c3de18f0cced7f23325bab208e081898 --- /dev/null +++ b/source/RobotAPI/libraries/armem_skills/StatechartListener.h @@ -0,0 +1,65 @@ +#pragma once + + +#include <ArmarXCore/core/Component.h> + +#include <ArmarXCore/interface/core/Profiler.h> +#include <ArmarXCore/observers/ObserverObjectFactories.h> + + +namespace armarx +{ + class StatechartListener : + virtual public armarx::Component + , virtual public armarx::ProfilerListener + { + public: + using Transition = armarx::ProfilerStatechartTransitionWithParameters; + using Callback = std::function<void(const std::vector<StatechartListener::Transition>& transitions, StatechartListener& source)>; + + public: + ~StatechartListener() override; + + void setTopicName(const std::string& topicName); + std::string getTopicName() const; + + void setName(const std::string& name); + void registerCallback(const Callback& callback); + + /// @see armarx::ManagedIceObject::getDefaultName() + std::string getDefaultName() const override; + + protected: + void onInitComponent() override; + void onConnectComponent() override; + + // ProfilerListener interface + public: + void reportStatechartTransitionWithParameters(const ProfilerStatechartTransitionWithParameters&, const Ice::Current&) override; + void reportStatechartTransitionWithParametersList(const ProfilerStatechartTransitionWithParametersList&, const Ice::Current&) override; + + void reportNetworkTraffic(const std::string&, const std::string&, Ice::Int, Ice::Int, const Ice::Current&) override {} + void reportEvent(const ProfilerEvent&, const Ice::Current&) override {} + void reportStatechartTransition(const ProfilerStatechartTransition& event, const Ice::Current&) override {} + void reportStatechartInputParameters(const ProfilerStatechartParameters& event, const Ice::Current&) override {} + void reportStatechartLocalParameters(const ProfilerStatechartParameters& event, const Ice::Current&) override {} + void reportStatechartOutputParameters(const ProfilerStatechartParameters&, const Ice::Current&) override {} + void reportProcessCpuUsage(const ProfilerProcessCpuUsage&, const Ice::Current&) override {} + void reportProcessMemoryUsage(const ProfilerProcessMemoryUsage&, const Ice::Current&) override {} + + void reportEventList(const ProfilerEventList& events, const Ice::Current&) override {} + void reportStatechartTransitionList(const ProfilerStatechartTransitionList&, const Ice::Current&) override {} + void reportStatechartInputParametersList(const ProfilerStatechartParametersList& data, const Ice::Current&) override {} + void reportStatechartLocalParametersList(const ProfilerStatechartParametersList&, const Ice::Current&) override {} + void reportStatechartOutputParametersList(const ProfilerStatechartParametersList&, const Ice::Current&) override {} + void reportProcessCpuUsageList(const ProfilerProcessCpuUsageList&, const Ice::Current&) override {} + void reportProcessMemoryUsageList(const ProfilerProcessMemoryUsageList&, const Ice::Current&) override {} + + + private: + std::string topicName; + + std::vector<Callback> callbacks; + void publish(const std::vector<Transition>& message); + }; +} diff --git a/source/RobotAPI/libraries/armem_skills/aron/Statechart.xml b/source/RobotAPI/libraries/armem_skills/aron/Statechart.xml new file mode 100644 index 0000000000000000000000000000000000000000..c4b132e1a9867369e47ac3b6aad0c019c0f1f062 --- /dev/null +++ b/source/RobotAPI/libraries/armem_skills/aron/Statechart.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<AronTypeDefinition> + <CodeIncludes> + </CodeIncludes> + + <GenerateTypes> + <IntEnum name="armarx::armem::arondto::Statechart::StateType"> + <EnumValue key="NORMAL" value="0" /> + <EnumValue key="FINAL" value="1" /> + <EnumValue key="REMOTE" value="2" /> + <EnumValue key="DYNAMIC_REMOTE" value="3" /> + <EnumValue key="UNDEFINED" value="4" /> + </IntEnum> + + <Object name='armarx::armem::arondto::Statechart::ParameterMap'> + <ObjectChild key='parameters'> + <dict> + <String /> + </dict> + </ObjectChild> + </Object> + + <Object name='armarx::armem::arondto::Statechart::Transition'> + <ObjectChild key='processId'> + <int /> + </ObjectChild> + + <ObjectChild key="sourceStateIdentifier"> + <String /> + </ObjectChild> + + <ObjectChild key="targetStateIdentifier"> + <String /> + </ObjectChild> + + <ObjectChild key="eventName"> + <String /> + </ObjectChild> + + <ObjectChild key="targetStateType"> + <armarx::armem::arondto::Statechart::StateType /> + </ObjectChild> + + <ObjectChild key="inputParameters"> + <armarx::armem::arondto::Statechart::ParameterMap /> + </ObjectChild> + + <ObjectChild key="localParameters"> + <armarx::armem::arondto::Statechart::ParameterMap /> + </ObjectChild> + + <ObjectChild key="outputParameters"> + <armarx::armem::arondto::Statechart::ParameterMap /> + </ObjectChild> + </Object> + </GenerateTypes> +</AronTypeDefinition> diff --git a/source/RobotAPI/libraries/armem_skills/aron_conversions.cpp b/source/RobotAPI/libraries/armem_skills/aron_conversions.cpp new file mode 100644 index 0000000000000000000000000000000000000000..db18f5ac2a93db5a20b5103aff547e607ff6c29d --- /dev/null +++ b/source/RobotAPI/libraries/armem_skills/aron_conversions.cpp @@ -0,0 +1,88 @@ +#include "aron_conversions.h" + +namespace armarx::armem +{ + std::map<armarx::eStateType, armarx::armem::arondto::Statechart::StateType> toAronStateTypeMap = + { + {eNormalState, armarx::armem::arondto::Statechart::StateType::NORMAL}, + {eFinalState, armarx::armem::arondto::Statechart::StateType::FINAL}, + {eRemoteState, armarx::armem::arondto::Statechart::StateType::REMOTE}, + {eDynamicRemoteState, armarx::armem::arondto::Statechart::StateType::DYNAMIC_REMOTE}, + {eUndefined, armarx::armem::arondto::Statechart::StateType::UNDEFINED}, + }; + + std::map<armarx::armem::arondto::Statechart::StateType, armarx::eStateType> fromAronStateTypeMap = + { + {armarx::armem::arondto::Statechart::StateType::NORMAL, eNormalState}, + {armarx::armem::arondto::Statechart::StateType::FINAL, eFinalState}, + {armarx::armem::arondto::Statechart::StateType::REMOTE, eRemoteState}, + {armarx::armem::arondto::Statechart::StateType::DYNAMIC_REMOTE, eDynamicRemoteState}, + {armarx::armem::arondto::Statechart::StateType::UNDEFINED, eUndefined}, + }; + + void fromAron(const arondto::Statechart::StateType& dto, eStateType& bo) + { + if (fromAronStateTypeMap.find(dto) != fromAronStateTypeMap.end()) + { + bo = fromAronStateTypeMap[dto]; + } + else + { + bo = eStateType::eUndefined; + } + } + + void toAron(arondto::Statechart::StateType& dto, const eStateType& bo) + { + if (toAronStateTypeMap.find(bo) != toAronStateTypeMap.end()) + { + dto.value = toAronStateTypeMap[bo].value; + } + else + { + dto.value = arondto::Statechart::StateType::UNDEFINED; + } + } + + void fromAron(const arondto::Statechart::ParameterMap& dto, StateParameterMap& bo) + { + // todo: implement + // for (auto const& [key, val] : dto.parameters) + // { + // fromAron(val, ...) + // bo.insert(key, val); + // } + } + + void toAron(arondto::Statechart::ParameterMap& dto, const StateParameterMap& bo) + { + for (auto const& [key, val] : bo) + { + dto.parameters[key] = val->value->toString(); + } + } + + void fromAron(const arondto::Statechart::Transition& dto, ProfilerStatechartTransitionWithParameters& bo) + { + bo.processId = dto.processId; + bo.sourceStateIdentifier = dto.sourceStateIdentifier; + bo.targetStateIdentifier = dto.targetStateIdentifier; + bo.eventName = dto.eventName; + fromAron(dto.targetStateType, bo.targetStateType); + fromAron(dto.inputParameters, bo.inputParameters); + fromAron(dto.localParameters, bo.localParameters); + fromAron(dto.outputParameters, bo.outputParameters); + } + + void toAron(arondto::Statechart::Transition& dto, const ProfilerStatechartTransitionWithParameters& bo) + { + dto.processId = bo.processId; + dto.sourceStateIdentifier = bo.sourceStateIdentifier; + dto.targetStateIdentifier = bo.targetStateIdentifier; + dto.eventName = bo.eventName; + toAron(dto.targetStateType, bo.targetStateType); + toAron(dto.inputParameters, bo.inputParameters); + toAron(dto.localParameters, bo.localParameters); + toAron(dto.outputParameters, bo.outputParameters); + } +} \ No newline at end of file diff --git a/source/RobotAPI/libraries/armem_skills/aron_conversions.h b/source/RobotAPI/libraries/armem_skills/aron_conversions.h new file mode 100644 index 0000000000000000000000000000000000000000..bc6314b4613d8ed0d1fa0f49188a51aad47518ca --- /dev/null +++ b/source/RobotAPI/libraries/armem_skills/aron_conversions.h @@ -0,0 +1,18 @@ +#pragma once + +#include <ArmarXCore/interface/core/Profiler.h> +#include <ArmarXCore/observers/ObserverObjectFactories.h> + +#include <RobotAPI/libraries/armem_skills/aron/Statechart.aron.generated.h> + +namespace armarx::armem +{ + void fromAron(const armarx::armem::arondto::Statechart::StateType& dto, armarx::eStateType& bo); + void toAron(armarx::armem::arondto::Statechart::StateType& dto, const armarx::eStateType& bo); + + void fromAron(const armarx::armem::arondto::Statechart::ParameterMap& dto, armarx::StateParameterMap& bo); + void toAron(armarx::armem::arondto::Statechart::ParameterMap& dto, const armarx::StateParameterMap& bo); + + void fromAron(const armarx::armem::arondto::Statechart::Transition& dto, armarx::ProfilerStatechartTransitionWithParameters& bo); + void toAron(armarx::armem::arondto::Statechart::Transition& dto, const armarx::ProfilerStatechartTransitionWithParameters& bo); +}