From aeb5acc6c911027a4a5b3304117c0930d2281a60 Mon Sep 17 00:00:00 2001 From: Fabian Peller <fabian.peller-konrad@kit.edu> Date: Thu, 15 Jun 2023 15:15:23 +0200 Subject: [PATCH] add skill profiles and update skill provider example --- .../SkillProviderTest/SkillProviderTest.scx | 4 + .../SkillProviderTest/config/ArVizStorage.cfg | 212 +++++++++++++++++ .../config/DebugObserver.cfg | 221 ++++++++++++++++++ .../config/MemoryNameSystem.cfg | 196 ++++++++++++++++ .../config/RemoteGuiProviderApp.cfg | 196 ++++++++++++++++ .../SkillProviderExample.cpp | 182 +++++++++------ .../SkillManagerMonitorWidgetController.cpp | 11 +- .../skills/SkillProviderInterface.ice | 49 ++-- .../libraries/armem_skills/aron/Skill.xml | 52 +++-- .../segment/ExecutableSkillLibrarySegment.cpp | 9 +- .../skills/provider/SkillDescription.cpp | 26 ++- .../skills/provider/SkillDescription.h | 29 ++- .../libraries/skills/provider/SkillProxy.cpp | 63 +++-- .../libraries/skills/provider/SkillProxy.h | 39 +++- 14 files changed, 1140 insertions(+), 149 deletions(-) create mode 100644 scenarios/SkillProviderTest/config/ArVizStorage.cfg create mode 100644 scenarios/SkillProviderTest/config/DebugObserver.cfg create mode 100644 scenarios/SkillProviderTest/config/MemoryNameSystem.cfg create mode 100644 scenarios/SkillProviderTest/config/RemoteGuiProviderApp.cfg diff --git a/scenarios/SkillProviderTest/SkillProviderTest.scx b/scenarios/SkillProviderTest/SkillProviderTest.scx index aa275e460..7e5aa06a7 100644 --- a/scenarios/SkillProviderTest/SkillProviderTest.scx +++ b/scenarios/SkillProviderTest/SkillProviderTest.scx @@ -2,5 +2,9 @@ <scenario name="SkillProviderTest" creation="2022-06-02.15:33:15" globalConfigName="./config/global.cfg" package="RobotAPI" deploymentType="local" nodeName="NodeMain"> <application name="SkillProviderExample" instance="" package="RobotAPI" 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"/> + <application name="RemoteGuiProviderApp" instance="" package="ArmarXGui" nodeName="" enabled="true" iceAutoRestart="false"/> + <application name="ArVizStorage" instance="" package="RobotAPI" nodeName="" enabled="true" iceAutoRestart="false"/> + <application name="DebugObserver" instance="" package="ArmarXCore" nodeName="" enabled="true" iceAutoRestart="false"/> </scenario> diff --git a/scenarios/SkillProviderTest/config/ArVizStorage.cfg b/scenarios/SkillProviderTest/config/ArVizStorage.cfg new file mode 100644 index 000000000..302ac28c3 --- /dev/null +++ b/scenarios/SkillProviderTest/config/ArVizStorage.cfg @@ -0,0 +1,212 @@ +# ================================================================== +# ArVizStorage 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.ArVizStorage.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.ArVizStorage.EnableProfiling = false + + +# ArmarX.ArVizStorage.HistoryPath: Destination path where the history is serialized to +# Attributes: +# - Default: RobotAPI/ArVizStorage +# - Case sensitivity: yes +# - Required: no +# ArmarX.ArVizStorage.HistoryPath = RobotAPI/ArVizStorage + + +# ArmarX.ArVizStorage.MaxHistorySize: How many layer updates are saved in the history until they are compressed +# Attributes: +# - Default: 1000 +# - Case sensitivity: yes +# - Required: no +# ArmarX.ArVizStorage.MaxHistorySize = 1000 + + +# ArmarX.ArVizStorage.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.ArVizStorage.MinimumLoggingLevel = Undefined + + +# ArmarX.ArVizStorage.ObjectName: Name of IceGrid well-known object +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.ArVizStorage.ObjectName = "" + + +# ArmarX.ArVizStorage.TopicName: Layer updates are sent over this topic. +# Attributes: +# - Default: ArVizTopic +# - Case sensitivity: yes +# - Required: no +# ArmarX.ArVizStorage.TopicName = ArVizTopic + + +# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_CONFIG_DIR is set, the cache path will be made relative to ARMARX_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${ARMARX_WORKSPACE}/armarx_config) +# 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.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/SkillProviderTest/config/DebugObserver.cfg b/scenarios/SkillProviderTest/config/DebugObserver.cfg new file mode 100644 index 000000000..8dc7ead26 --- /dev/null +++ b/scenarios/SkillProviderTest/config/DebugObserver.cfg @@ -0,0 +1,221 @@ +# ================================================================== +# DebugObserver 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_CONFIG_DIR is set, the cache path will be made relative to ARMARX_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${ARMARX_WORKSPACE}/armarx_config) +# 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.DebugObserver.CreateUpdateFrequenciesChannel: If true, an additional channel is created that shows the update frequency of every other channel in that observer. +# Attributes: +# - Default: false +# - Case sensitivity: yes +# - Required: no +# - Possible values: {0, 1, false, no, true, yes} +# ArmarX.DebugObserver.CreateUpdateFrequenciesChannel = false + + +# ArmarX.DebugObserver.DebugObserverTopicName: Name of the topic the DebugObserver listens on +# Attributes: +# - Default: DebugObserver +# - Case sensitivity: yes +# - Required: no +# ArmarX.DebugObserver.DebugObserverTopicName = DebugObserver + + +# ArmarX.DebugObserver.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.DebugObserver.EnableProfiling = false + + +# ArmarX.DebugObserver.MaxHistoryRecordFrequency: The Observer history is written with this maximum frequency. Everything faster is being skipped. +# Attributes: +# - Default: 50 +# - Case sensitivity: yes +# - Required: no +# ArmarX.DebugObserver.MaxHistoryRecordFrequency = 50 + + +# ArmarX.DebugObserver.MaxHistorySize: Maximum number of entries in the Observer history +# Attributes: +# - Default: 5000 +# - Case sensitivity: yes +# - Required: no +# ArmarX.DebugObserver.MaxHistorySize = 5000 + + +# ArmarX.DebugObserver.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.DebugObserver.MinimumLoggingLevel = Undefined + + +# ArmarX.DebugObserver.ObjectName: Name of IceGrid well-known object +# Attributes: +# - Default: "" +# - Case sensitivity: yes +# - Required: no +# ArmarX.DebugObserver.ObjectName = "" + + +# 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.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/SkillProviderTest/config/MemoryNameSystem.cfg b/scenarios/SkillProviderTest/config/MemoryNameSystem.cfg new file mode 100644 index 000000000..b8bc70a66 --- /dev/null +++ b/scenarios/SkillProviderTest/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_CONFIG_DIR is set, the cache path will be made relative to ARMARX_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${ARMARX_WORKSPACE}/armarx_config) +# 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/SkillProviderTest/config/RemoteGuiProviderApp.cfg b/scenarios/SkillProviderTest/config/RemoteGuiProviderApp.cfg new file mode 100644 index 000000000..4b6abea40 --- /dev/null +++ b/scenarios/SkillProviderTest/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_CONFIG_DIR is set, the cache path will be made relative to ARMARX_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${ARMARX_WORKSPACE}/armarx_config) +# 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/source/RobotAPI/components/skills/SkillProviderExample/SkillProviderExample.cpp b/source/RobotAPI/components/skills/SkillProviderExample/SkillProviderExample.cpp index 985ef8171..5e5fb58b7 100644 --- a/source/RobotAPI/components/skills/SkillProviderExample/SkillProviderExample.cpp +++ b/source/RobotAPI/components/skills/SkillProviderExample/SkillProviderExample.cpp @@ -10,54 +10,60 @@ namespace armarx::skills::provider { - HelloWorldSkill::HelloWorldSkill() : - Skill(GetSkillDescription()) - {} + HelloWorldSkill::HelloWorldSkill() : Skill(GetSkillDescription()) + { + } - SkillDescription HelloWorldSkill::GetSkillDescription() + SkillDescription + HelloWorldSkill::GetSkillDescription() { - armarx::skills::Example::HelloWorldAcceptedType default_params; - default_params.some_float = 5; - default_params.some_int = 42; - default_params.some_text = "YOLO"; - default_params.some_list_of_matrices.push_back(Eigen::Matrix3f::Zero()); + armarx::skills::Example::HelloWorldAcceptedType root_profile_params; + root_profile_params.some_float = 5; + root_profile_params.some_int = 42; + root_profile_params.some_text = "YOLO"; + root_profile_params.some_list_of_matrices.push_back(Eigen::Matrix3f::Zero()); //default_params.some_matrix = Eigen::Matrix3f::Zero(); - return SkillDescription{ - "HelloWorld", - "This skill logs a message on ARMARX_IMPORTANT", - {}, - armarx::core::time::Duration::MilliSeconds(1000), - armarx::skills::Example::HelloWorldAcceptedType::ToAronType(), - default_params.toAron() - }; + SkillProfile rootProfile{SkillProfile::ROOT_PROFILE_NAME, + SkillProfile::NO_PREDECESSOR, + root_profile_params.toAron()}; + + return SkillDescription{"HelloWorld", + "This skill logs a message on ARMARX_IMPORTANT", + {{rootProfile.profileName, rootProfile}}, + armarx::core::time::Duration::MilliSeconds(1000), + armarx::skills::Example::HelloWorldAcceptedType::ToAronType()}; } - Skill::MainResult HelloWorldSkill::main(const MainInput& in) + Skill::MainResult + HelloWorldSkill::main(const MainInput& in) { - ARMARX_IMPORTANT << "Hi, from the Hello World Skill.\n" << - "I received the following data: \n" << - aron::converter::AronNlohmannJSONConverter::ConvertToNlohmannJSON(in.params).dump(2) << "\n" << - "(executed at: " << IceUtil::Time::now() << ")"; + ARMARX_IMPORTANT << "Hi, from the Hello World Skill.\n" + << "I received the following data: \n" + << aron::data::converter::AronNlohmannJSONConverter::ConvertToNlohmannJSON( + in.params) + .dump(2) + << "\n" + << "(executed at: " << IceUtil::Time::now() << ")"; return {TerminatedSkillStatus::Succeeded, nullptr}; } - ChainingSkill::ChainingSkill() : - Skill(GetSkillDescription()) - {} + ChainingSkill::ChainingSkill() : Skill(GetSkillDescription()) + { + } - SkillDescription ChainingSkill::GetSkillDescription() + SkillDescription + ChainingSkill::GetSkillDescription() { - return SkillDescription{ - "ChainingSkill", - "This skill calls the HelloWorld skill three times.", - {}, - armarx::core::time::Duration::MilliSeconds(3000), - nullptr - }; + return SkillDescription{"ChainingSkill", + "This skill calls the HelloWorld skill three times.", + {}, + armarx::core::time::Duration::MilliSeconds(3000), + nullptr}; } - Skill::MainResult ChainingSkill::main(const MainInput& in) + Skill::MainResult + ChainingSkill::main(const MainInput& in) { armarx::skills::Example::HelloWorldAcceptedType exec1; armarx::skills::Example::HelloWorldAcceptedType exec2; @@ -78,20 +84,21 @@ namespace armarx::skills::provider TimeoutSkill::TimeoutSkill() : PeriodicSkill(GetSkillDescription(), armarx::core::time::Frequency::Hertz(5)) - {} + { + } - SkillDescription TimeoutSkill::GetSkillDescription() + SkillDescription + TimeoutSkill::GetSkillDescription() { - return SkillDescription{ - "Timeout", - "This fails with timeout reached", - {}, - armarx::core::time::Duration::MilliSeconds(1000), - nullptr - }; + return SkillDescription{"Timeout", + "This fails with timeout reached", + {}, + armarx::core::time::Duration::MilliSeconds(1000), + nullptr}; } - PeriodicSkill::StepResult TimeoutSkill::step(const MainInput& in) + PeriodicSkill::StepResult + TimeoutSkill::step(const MainInput& in) { // do heavy work std::this_thread::sleep_for(std::chrono::milliseconds(200)); @@ -99,22 +106,22 @@ namespace armarx::skills::provider return {ActiveOrTerminatedSkillStatus::Running, nullptr}; } - CallbackSkill::CallbackSkill() : - Skill(GetSkillDescription()) - {} + CallbackSkill::CallbackSkill() : Skill(GetSkillDescription()) + { + } - SkillDescription CallbackSkill::GetSkillDescription() + SkillDescription + CallbackSkill::GetSkillDescription() { - return SkillDescription{ - "ShowMeCallbacks", - "This skill does shows callbacks", - {}, - armarx::core::time::Duration::MilliSeconds(1000), - nullptr - }; + return SkillDescription{"ShowMeCallbacks", + "This skill does shows callbacks", + {}, + armarx::core::time::Duration::MilliSeconds(1000), + nullptr}; } - Skill::MainResult CallbackSkill::main(const MainInput& in) + Skill::MainResult + CallbackSkill::main(const MainInput& in) { ARMARX_IMPORTANT << "Logging three updates via the callback"; auto up1 = std::make_shared<aron::data::Dict>(); @@ -132,23 +139,26 @@ namespace armarx::skills::provider return {TerminatedSkillStatus::Succeeded, nullptr}; } + SkillProviderExample::SkillProviderExample() : SkillProviderComponentPluginUser() + { + } - SkillProviderExample::SkillProviderExample() : - SkillProviderComponentPluginUser() - {} - - armarx::PropertyDefinitionsPtr SkillProviderExample::createPropertyDefinitions() + armarx::PropertyDefinitionsPtr + SkillProviderExample::createPropertyDefinitions() { - armarx::PropertyDefinitionsPtr defs = new ComponentPropertyDefinitions(getConfigIdentifier()); + armarx::PropertyDefinitionsPtr defs = + new ComponentPropertyDefinitions(getConfigIdentifier()); return defs; } - std::string SkillProviderExample::getDefaultName() const + std::string + SkillProviderExample::getDefaultName() const { return "SkillProviderExample"; } - void SkillProviderExample::onInitComponent() + void + SkillProviderExample::onInitComponent() { // Add example skill addSkill(std::make_unique<HelloWorldSkill>()); @@ -160,10 +170,32 @@ namespace armarx::skills::provider fooDesc.description = "This skill does exactly nothing."; fooDesc.skillName = "Foo"; fooDesc.timeout = armarx::core::time::Duration::MilliSeconds(1000); - addSkill([](const std::string& clientId, const aron::data::DictPtr&){ - std::cout << "Hello from Foo. The skill was called from " << clientId << "." << std::endl; - return TerminatedSkillStatus::Succeeded; - }, fooDesc); + addSkill( + [](const std::string& clientId, const aron::data::DictPtr&) + { + std::cout << "Hello from Foo. The skill was called from " << clientId << "." + << std::endl; + return TerminatedSkillStatus::Succeeded; + }, + fooDesc); + } + + // Add another lambda example skill + { + skills::SkillDescription fooDesc; + fooDesc.acceptedType = nullptr; // accept everything + fooDesc.description = "This skill dies hard."; + fooDesc.skillName = "Die"; + fooDesc.timeout = armarx::core::time::Duration::MilliSeconds(1000); + addSkill( + [](const std::string& clientId, const aron::data::DictPtr&) + { + std::cout << "bye bye... segfaulting on purpose now!" << std::endl; + Skill* nullSkill = NULL; + nullSkill->getSkillId(); // DEAD! + return TerminatedSkillStatus::Succeeded; + }, + fooDesc); } // Add another example skill @@ -176,18 +208,18 @@ namespace armarx::skills::provider addSkill(std::make_unique<ChainingSkill>()); } - void SkillProviderExample::onConnectComponent() + void + SkillProviderExample::onConnectComponent() { - } - void SkillProviderExample::onDisconnectComponent() + void + SkillProviderExample::onDisconnectComponent() { - } - void SkillProviderExample::onExitComponent() + void + SkillProviderExample::onExitComponent() { - } -} +} // namespace armarx::skills::provider diff --git a/source/RobotAPI/gui-plugins/SkillManagerPlugin/SkillManagerMonitorWidgetController.cpp b/source/RobotAPI/gui-plugins/SkillManagerPlugin/SkillManagerMonitorWidgetController.cpp index edc9eebb6..28fa685ab 100644 --- a/source/RobotAPI/gui-plugins/SkillManagerPlugin/SkillManagerMonitorWidgetController.cpp +++ b/source/RobotAPI/gui-plugins/SkillManagerPlugin/SkillManagerMonitorWidgetController.cpp @@ -428,10 +428,10 @@ namespace armarx } { - auto it = new QTreeWidgetItem( - widget.treeWidgetSkillDetails, - {QString::fromStdString("Robot"), - QString::fromStdString(simox::alg::join(skillDesc.robots, ", "))}); + auto it = new QTreeWidgetItem(widget.treeWidgetSkillDetails, + {QString::fromStdString("Available profiles"), + QString::fromStdString(simox::alg::join( + simox::alg::get_keys(skillDesc.profiles), ", "))}); widget.treeWidgetSkillDetails->addTopLevelItem(it); } @@ -453,7 +453,8 @@ namespace armarx skillsArgumentsTreeWidgetItem = new QTreeWidgetItem(widget.treeWidgetSkillDetails, {QString::fromStdString("Arguments")}); auto aron_args = aron::type::Object::FromAronObjectDTO(skillDesc.acceptedType); - auto default_args = aron::data::Dict::FromAronDictDTO(skillDesc.defaultParams); + auto default_args = + nullptr; //aron::data::Dict::FromAronDictDTO(skillDesc.defaultParams); TODO! aronTreeWidgetController = std::make_shared<AronTreeWidgetController>( widget.treeWidgetSkillDetails, skillsArgumentsTreeWidgetItem, aron_args, default_args); diff --git a/source/RobotAPI/interface/skills/SkillProviderInterface.ice b/source/RobotAPI/interface/skills/SkillProviderInterface.ice index ed40611c8..b7aad029e 100644 --- a/source/RobotAPI/interface/skills/SkillProviderInterface.ice +++ b/source/RobotAPI/interface/skills/SkillProviderInterface.ice @@ -58,26 +58,41 @@ module armarx string skillName; }; + // A parameterization profile + struct SkillProfile + { + string profileName; + string predecessorProfileName; // may be empty + aron::data::dto::Dict parameterization; + }; + + // A list of parameterization profiles. Note that the first element is recognized as root. Following elements overwrite the previous. + dictionary<string, SkillProfile> SkillProfileDict; + // Description of a skill, independant of a provider // A skill is nothing but a executable thing, which can be executed on one or more 'robots' (empty means all) struct SkillDescription { - string skillName; // the name of the skill - string description; // a human readable description of what the skill does. Used in GUI - StringList robots; // the names of the robots that are able to execute that skill - long timeoutMs; // in milliseconds, can be set to -1 for infinite - aron::type::dto::AronObject acceptedType; // the name of the object is irrelevant and only used in GUI. nullptr if not set - aron::data::dto::Dict defaultParams; // the default parameterization used in GUI. nullptr if not set + string skillName; // the name of the skill + string + description; // a human readable description of what the skill does. Used in GUI + SkillProfileDict profiles; // a dict of profiles + long timeoutMs; // in milliseconds, can be set to -1 for infinite + aron::type::dto::AronObject + acceptedType; // the name of the object is irrelevant and only used in GUI. nullptr if not set }; + dictionary<string, SkillDescription> SkillDescriptionMap; // Input to a provider to execute a skill struct SkillExecutionRequest { string skillName; // the id of the skill - string executorName; // the name of the component/lib/skill that called the execution of the skill + string + executorName; // the name of the component/lib/skill that called the execution of the skill aron::data::dto::Dict params; // the used parameterization - callback::dti::SkillProviderCallbackInterface* callbackInterface; // use nullptr if you do not want to have callbacks + callback::dti::SkillProviderCallbackInterface* + callbackInterface; // use nullptr if you do not want to have callbacks }; // The status enum of a skill @@ -99,17 +114,20 @@ module armarx // Status updates of a skill struct SkillStatusUpdateHeader { - SkillID skillId; // the id of the skill - string executorName; // the name of the component/lib/skill that called the execution of the skill - aron::data::dto::Dict usedParams; // the used parameterization - callback::dti::SkillProviderCallbackInterface* usedCallbackInterface; // the used callback interface. Probably a prx to the manager - Execution::Status status; // the current status of the skill + SkillID skillId; // the id of the skill + string + executorName; // the name of the component/lib/skill that called the execution of the skill + aron::data::dto::Dict usedParams; // the used parameterization + callback::dti::SkillProviderCallbackInterface* + usedCallbackInterface; // the used callback interface. Probably a prx to the manager + Execution::Status status; // the current status of the skill }; struct SkillStatusUpdate { - SkillStatusUpdateHeader header; - aron::data::dto::Dict data; // data, attached to the status update. If send via a callback, this data may be used by the callback interface + SkillStatusUpdateHeader header; + aron::data::dto::Dict + data; // data, attached to the status update. If send via a callback, this data may be used by the callback interface }; dictionary<string, SkillStatusUpdate> SkillStatusUpdateMap; @@ -155,4 +173,3 @@ module armarx } } } - diff --git a/source/RobotAPI/libraries/armem_skills/aron/Skill.xml b/source/RobotAPI/libraries/armem_skills/aron/Skill.xml index abd89ebd8..a4f7400e9 100644 --- a/source/RobotAPI/libraries/armem_skills/aron/Skill.xml +++ b/source/RobotAPI/libraries/armem_skills/aron/Skill.xml @@ -11,21 +11,38 @@ The memory should look like the following: <?xml version="1.0" encoding="UTF-8" ?> <AronTypeDefinition> <GenerateTypes> - <Object name='armarx::skills::arondto::SkillDescription'> - <ObjectChild key='skillName'> + <Object name='armarx::skills::arondto::SkillProfile'> + + <ObjectChild key='profileName'> <String /> </ObjectChild> - <ObjectChild key='robots'> - <List> - <String /> - </List> + <ObjectChild key='predecessorProfileName'> + <String /> + </ObjectChild> + + <ObjectChild key='parameterization'> + <AnyObject shared_ptr="1" /> + </ObjectChild> + + </Object> + + + <Object name='armarx::skills::arondto::SkillDescription'> + <ObjectChild key='skillName'> + <String /> </ObjectChild> <ObjectChild key='description'> <String /> </ObjectChild> + <ObjectChild key='profiles'> + <Dict> + <armarx::skills::arondto::SkillProfile /> + </Dict> + </ObjectChild> + <ObjectChild key='iceInfo'> <String /> </ObjectChild> @@ -40,7 +57,7 @@ The memory should look like the following: </Object> - <Object name='armarx::skills::arondto::SkillExecutionRequest'> + <Object name='armarx::skills::arondto::SkillExecutionInfo'> <ObjectChild key='providerName'> <String /> </ObjectChild> @@ -49,33 +66,30 @@ The memory should look like the following: <String /> </ObjectChild> - <ObjectChild key='executorName'> - <String /> - </ObjectChild> - <ObjectChild key='params'> <AnyObject shared_ptr="1" /> </ObjectChild> - </Object> - <Object name='armarx::skills::arondto::SkillExecutionEvent'> + <Object name='armarx::skills::arondto::CompositeSkillExecutionParams'> <ObjectChild key='providerName'> - <String /> + <List> + <armarx::skills::arondto::SkillExecutionInfo /> + </List> </ObjectChild> + </Object> - <ObjectChild key='skillName'> + <Object name='armarx::skills::arondto::SkillExecutionRequest' extends="armarx::skills::arondto::SkillExecutionInfo"> + <ObjectChild key='executorName'> <String /> </ObjectChild> + </Object> + <Object name='armarx::skills::arondto::SkillExecutionEvent' extends="armarx::skills::arondto::SkillExecutionInfo"> <ObjectChild key='status'> <String /> </ObjectChild> - <ObjectChild key='params'> - <AnyObject shared_ptr="1" /> - </ObjectChild> - <ObjectChild key='data'> <AnyObject shared_ptr="1" /> </ObjectChild> diff --git a/source/RobotAPI/libraries/armem_skills/server/segment/ExecutableSkillLibrarySegment.cpp b/source/RobotAPI/libraries/armem_skills/server/segment/ExecutableSkillLibrarySegment.cpp index 1a342fe0c..068715f2f 100644 --- a/source/RobotAPI/libraries/armem_skills/server/segment/ExecutableSkillLibrarySegment.cpp +++ b/source/RobotAPI/libraries/armem_skills/server/segment/ExecutableSkillLibrarySegment.cpp @@ -38,7 +38,14 @@ namespace armarx::skills::segment skillDescription.skillName = desc.skillName; skillDescription.description = desc.description; skillDescription.iceInfo = info.provider->ice_toString(); - skillDescription.robots = desc.robots; + for (const auto& [key, p] : desc.profiles) + { + skillDescription.profiles[key] = {}; + skillDescription.profiles[key].profileName = p.profileName; + skillDescription.profiles[key].predecessorProfileName = p.predecessorProfileName; + skillDescription.profiles[key].parameterization = + aron::data::Dict::FromAronDictDTO(p.parameterization); + } skillDescription.timeoutMs = desc.timeoutMs; if (desc.acceptedType) diff --git a/source/RobotAPI/libraries/skills/provider/SkillDescription.cpp b/source/RobotAPI/libraries/skills/provider/SkillDescription.cpp index 4e195f39e..3fec65dd9 100644 --- a/source/RobotAPI/libraries/skills/provider/SkillDescription.cpp +++ b/source/RobotAPI/libraries/skills/provider/SkillDescription.cpp @@ -1,19 +1,35 @@ #include "SkillDescription.h" +#include <ArmarXCore/core/ice_conversions.h> + namespace armarx { namespace skills { - provider::dto::SkillDescription SkillDescription::toIce() const + + provider::dto::SkillProfile + SkillProfile::toIce() const + { + provider::dto::SkillProfile ret; + ret.profileName = profileName; + ret.predecessorProfileName = predecessorProfileName; + ret.parameterization = parameterization->toAronDictDTO(); + return ret; + } + + provider::dto::SkillDescription + SkillDescription::toIce() const { provider::dto::SkillDescription ret; ret.acceptedType = aron::type::Object::ToAronObjectDTO(acceptedType); ret.description = description; ret.skillName = skillName; - ret.robots = robots; + for (const auto& [key, p] : profiles) + { + ret.profiles[key] = p.toIce(); + } ret.timeoutMs = timeout.toMilliSeconds(); - ret.defaultParams = aron::data::Dict::ToAronDictDTO(defaultParams); return ret; } - } -} + } // namespace skills +} // namespace armarx diff --git a/source/RobotAPI/libraries/skills/provider/SkillDescription.h b/source/RobotAPI/libraries/skills/provider/SkillDescription.h index 57c3c93b1..42dbd46e8 100644 --- a/source/RobotAPI/libraries/skills/provider/SkillDescription.h +++ b/source/RobotAPI/libraries/skills/provider/SkillDescription.h @@ -13,16 +13,29 @@ namespace armarx { namespace skills { + struct SkillProfile + { + static const constexpr char* ROOT_PROFILE_NAME = "root"; + static const constexpr char* NO_PREDECESSOR = ""; + + std::string profileName = ROOT_PROFILE_NAME; + std::string predecessorProfileName = ""; + aron::data::DictPtr parameterization = nullptr; + + provider::dto::SkillProfile toIce() const; + }; + struct SkillDescription { - std::string skillName = "NOT INITIALIZED YET"; - std::string description = "NOT INITIALIZED YET"; - std::vector<std::string> robots = {}; - armarx::core::time::Duration timeout = armarx::core::time::Duration::MilliSeconds(-1); - aron::type::ObjectPtr acceptedType = nullptr; - aron::data::DictPtr defaultParams = nullptr; + static const constexpr char* SKILL_NOT_INITIALIZED = "NOT INITIALIZED YET"; + + std::string skillName = SKILL_NOT_INITIALIZED; + std::string description = SKILL_NOT_INITIALIZED; + std::map<std::string, SkillProfile> profiles = {}; + armarx::core::time::Duration timeout = armarx::core::time::Duration::MilliSeconds(-1); + aron::type::ObjectPtr acceptedType = nullptr; provider::dto::SkillDescription toIce() const; }; - } -} + } // namespace skills +} // namespace armarx diff --git a/source/RobotAPI/libraries/skills/provider/SkillProxy.cpp b/source/RobotAPI/libraries/skills/provider/SkillProxy.cpp index e0ebdb3b6..be2aa65cb 100644 --- a/source/RobotAPI/libraries/skills/provider/SkillProxy.cpp +++ b/source/RobotAPI/libraries/skills/provider/SkillProxy.cpp @@ -4,25 +4,29 @@ namespace armarx { namespace skills { - SkillProxy::SkillProxy(const manager::dti::SkillManagerInterfacePrx& manager, const SkillID& skillId) : - manager(manager), - skillId(skillId) + SkillProxy::SkillProxy(const manager::dti::SkillManagerInterfacePrx& manager, + const SkillID& skillId) : + manager(manager), skillId(skillId) { } - SkillProxy::SkillProxy(const manager::dti::SkillManagerInterfacePrx& manager, const std::string& skillProviderName, const std::string& skillName) : - manager(manager), - skillId(skillProviderName, skillName) + SkillProxy::SkillProxy(const manager::dti::SkillManagerInterfacePrx& manager, + const std::string& skillProviderName, + const std::string& skillName) : + manager(manager), skillId(skillProviderName, skillName) { } - SkillProxy::SkillProxy(const manager::dti::SkillManagerInterfacePrx& manager, const std::string& skillProviderName, const SkillDescription& skillDesc) : - manager(manager), - skillId(skillProviderName, skillDesc.skillName) + SkillProxy::SkillProxy(const manager::dti::SkillManagerInterfacePrx& manager, + const std::string& skillProviderName, + const SkillDescription& skillDesc) : + manager(manager), skillId(skillProviderName, skillDesc.skillName) { } - TerminatedSkillStatusUpdate SkillProxy::executeFullSkill(const std::string& executorName, const aron::data::DictPtr& params) + TerminatedSkillStatusUpdate + SkillProxy::executeFullSkill(const std::string& executorName, + const aron::data::DictPtr& params) { skills::manager::dto::SkillExecutionRequest req; req.executorName = executorName; @@ -33,7 +37,9 @@ namespace armarx return TerminatedSkillStatusUpdate::FromIce(terminatingUpdate); } - IceInternal::Handle<Ice::AsyncResult> SkillProxy::begin_executeFullSkill(const std::string& executorName, const aron::data::DictPtr& params) + IceInternal::Handle<Ice::AsyncResult> + SkillProxy::begin_executeFullSkill(const std::string& executorName, + const aron::data::DictPtr& params) { skills::manager::dto::SkillExecutionRequest req; req.executorName = executorName; @@ -43,5 +49,36 @@ namespace armarx auto future = manager->begin_executeSkill(req); return future; } - } -} + + void + SkillProxy::abortSkill(const std::string& executorName) + { + // TODO: This will be used in the future, do not remove it! + (void)executorName; + manager->abortSkill(skillId.providerName, skillId.skillName); + } + + aron::data::DictPtr + SkillProxy::getDefaultParameters(const std::string& profileName) + { + // fabian.peller TODO: + return nullptr; + } + + TerminatedSkillStatusUpdate + SkillProxy::executeFullSkillWithDefaultParams(const std::string& executorName, + const std::string& profileName, + const aron::data::DictPtr& params) + { + return executeFullSkill(executorName, params); + } + + IceInternal::Handle<Ice::AsyncResult> + SkillProxy::begin_executeFullSkillWithDefaultParams(const std::string& executorName, + const std::string& profileName, + const aron::data::DictPtr& params) + { + return begin_executeFullSkill(executorName, params); + } + } // namespace skills +} // namespace armarx diff --git a/source/RobotAPI/libraries/skills/provider/SkillProxy.h b/source/RobotAPI/libraries/skills/provider/SkillProxy.h index 6e8ddc5c7..1ea41ec69 100644 --- a/source/RobotAPI/libraries/skills/provider/SkillProxy.h +++ b/source/RobotAPI/libraries/skills/provider/SkillProxy.h @@ -10,17 +10,42 @@ namespace armarx class SkillProxy : public armarx::Logging { public: - SkillProxy(const manager::dti::SkillManagerInterfacePrx& manager, const SkillID& skillId); - SkillProxy(const manager::dti::SkillManagerInterfacePrx& manager, const std::string& skillProviderName, const std::string& skillName); - SkillProxy(const manager::dti::SkillManagerInterfacePrx& manager, const std::string& skillProviderName, const SkillDescription& skillDesc); + SkillProxy(const manager::dti::SkillManagerInterfacePrx& manager, + const SkillID& skillId); + SkillProxy(const manager::dti::SkillManagerInterfacePrx& manager, + const std::string& skillProviderName, + const std::string& skillName); + SkillProxy(const manager::dti::SkillManagerInterfacePrx& manager, + const std::string& skillProviderName, + const SkillDescription& skillDesc); + + // Provide a similar API as the skillprovider + TerminatedSkillStatusUpdate + executeFullSkill(const std::string& executorName, + const aron::data::DictPtr& params = nullptr); + IceInternal::Handle<Ice::AsyncResult> + begin_executeFullSkill(const std::string& executorName, + const aron::data::DictPtr& params = nullptr); + + void abortSkill(const std::string& executorName); + + // Utiliy methods + aron::data::DictPtr getDefaultParameters(const std::string& profileName); + + TerminatedSkillStatusUpdate + executeFullSkillWithDefaultParams(const std::string& executorName, + const std::string& profileName, + const aron::data::DictPtr& params = nullptr); + IceInternal::Handle<Ice::AsyncResult> + begin_executeFullSkillWithDefaultParams(const std::string& executorName, + const std::string& profileName, + const aron::data::DictPtr& params = nullptr); - TerminatedSkillStatusUpdate executeFullSkill(const std::string& executorName, const aron::data::DictPtr& params = nullptr); - IceInternal::Handle<Ice::AsyncResult> begin_executeFullSkill(const std::string& executorName, const aron::data::DictPtr& params = nullptr); private: const manager::dti::SkillManagerInterfacePrx& manager; const SkillID skillId; }; - } -} + } // namespace skills +} // namespace armarx -- GitLab