SkillManagerComponentPlugin.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <exception>
4 #include <mutex>
5 #include <optional>
6 
9 
10 #include <RobotAPI/interface/skills/SkillManagerInterface.h>
16 
17 namespace armarx
18 {
19  class SkillManagerComponentPluginUser; // forward declaration
20 }
21 
22 namespace armarx::plugins
23 {
25  {
26  public:
27  using ComponentPlugin::ComponentPlugin;
28 
29  void preOnInitComponent() override;
30 
31  void preOnConnectComponent() override;
32 
33  void postCreatePropertyDefinitions(PropertyDefinitionsPtr& properties) override;
34 
35  void addProvider(const skills::ProviderInfo& info);
36 
37  void removeProvider(const skills::ProviderID& id);
38 
40 
42 
44  const aron::data::DictPtr& data);
45 
46  bool abortSkill(const skills::SkillExecutionID& id);
47 
49 
50  std::optional<skills::SkillDescription> getSkillDescription(const skills::SkillID& id);
51 
52  std::map<skills::SkillID, skills::SkillDescription> getSkillDescriptions();
53 
54  std::optional<skills::SkillStatusUpdate>
56 
57  std::map<skills::SkillExecutionID, skills::SkillStatusUpdate> getSkillExecutionStatuses();
58 
59  protected:
61 
62  private:
63  [[ noreturn ]] void handleExceptionNonLockingThrow(const char* funcName, const std::exception& e, skills::ProviderID providerId,
64  bool eraseSkillProvider = true);
65 
66  std::optional<std::map<skills::ProviderID, skills::provider::dti::SkillProviderInterfacePrx>::iterator>
67  handleExceptionNonLocking(const char* funcName, const std::exception& e, skills::ProviderID providerId,
68  bool eraseSkillProvider = true);
69 
70  skills::manager::dti::SkillManagerInterfacePrx myPrx;
71 
72  std::mutex skillProviderMapMutex;
73  std::map<skills::ProviderID, skills::provider::dti::SkillProviderInterfacePrx>
74  skillProviderMap;
75 
77  };
78 } // namespace armarx::plugins
79 
80 namespace armarx
81 {
83  virtual public ManagedIceObject,
84  virtual public skills::manager::dti::SkillManagerInterface
85  {
86  public:
88 
89  void addProvider(const skills::manager::dto::ProviderInfo& providerInfo,
90  const Ice::Current& current) override;
91  void removeProvider(const skills::manager::dto::ProviderID& provider,
92  const Ice::Current& current) override;
93 
94  skills::manager::dto::SkillStatusUpdate
95  executeSkill(const skills::manager::dto::SkillExecutionRequest& info,
96  const Ice::Current& current) override;
97 
98  skills::manager::dto::SkillExecutionID
99  executeSkillAsync(const skills::manager::dto::SkillExecutionRequest& skillExecutionRequest,
100  const Ice::Current& current) override;
101 
102  skills::provider::dto::ParameterUpdateResult
103  updateSkillParameters(const skills::manager::dto::SkillExecutionID& executionId,
104  const aron::data::dto::DictPtr& params,
105  const Ice::Current& current) override;
106 
107  void updateStatusForSkill(const skills::provider::dto::SkillStatusUpdate& update,
108  const skills::callback::dto::ProviderID& id,
109  const Ice::Current& current) override;
110 
111  skills::provider::dto::AbortSkillResult
112  abortSkill(const skills::manager::dto::SkillExecutionID& id,
113  const Ice::Current& current) override;
114 
115  skills::provider::dto::AbortSkillResult
116  abortSkillAsync(const skills::manager::dto::SkillExecutionID& id,
117  const Ice::Current& current) override;
118 
119 
120  skills::manager::dto::SkillDescriptionMap
121  getSkillDescriptions(const Ice::Current& current) override;
122 
123  IceUtil::Optional<skills::manager::dto::SkillDescription>
124  getSkillDescription(const skills::manager::dto::SkillID& id,
125  const Ice::Current& current) override;
126 
127  IceUtil::Optional<skills::manager::dto::SkillStatusUpdate>
128  getSkillExecutionStatus(const skills::manager::dto::SkillExecutionID& executionId,
129  const Ice::Current& current) override;
130 
131  skills::manager::dto::SkillStatusUpdateMap
132  getSkillExecutionStatuses(const Ice::Current& current) override;
133 
134  private:
136  };
137 } // namespace armarx
armarx::skills::SkillExecutionID
Definition: SkillExecutionID.h:19
ProviderID.h
Exception.h
SkillStatusUpdate.h
armarx::SkillManagerComponentPluginUser::getSkillExecutionStatus
IceUtil::Optional< skills::manager::dto::SkillStatusUpdate > getSkillExecutionStatus(const skills::manager::dto::SkillExecutionID &executionId, const Ice::Current &current) override
Definition: SkillManagerComponentPlugin.cpp:700
armarx::SkillManagerComponentPluginUser::executeSkill
skills::manager::dto::SkillStatusUpdate executeSkill(const skills::manager::dto::SkillExecutionRequest &info, const Ice::Current &current) override
Definition: SkillManagerComponentPlugin.cpp:609
armarx::plugins::SkillManagerComponentPlugin::getSkillDescription
std::optional< skills::SkillDescription > getSkillDescription(const skills::SkillID &id)
Definition: SkillManagerComponentPlugin.cpp:352
armarx::SkillManagerComponentPluginUser::getSkillDescriptions
skills::manager::dto::SkillDescriptionMap getSkillDescriptions(const Ice::Current &current) override
Definition: SkillManagerComponentPlugin.cpp:672
armarx::plugins::SkillManagerComponentPlugin::getSkillDescriptions
std::map< skills::SkillID, skills::SkillDescription > getSkillDescriptions()
Definition: SkillManagerComponentPlugin.cpp:405
armarx::plugins::SkillManagerComponentPlugin::abortSkill
bool abortSkill(const skills::SkillExecutionID &id)
Definition: SkillManagerComponentPlugin.cpp:268
armarx::SkillManagerComponentPluginUser::executeSkillAsync
skills::manager::dto::SkillExecutionID executeSkillAsync(const skills::manager::dto::SkillExecutionRequest &skillExecutionRequest, const Ice::Current &current) override
Definition: SkillManagerComponentPlugin.cpp:618
armarx::SkillManagerComponentPluginUser::getSkillExecutionStatuses
skills::manager::dto::SkillStatusUpdateMap getSkillExecutionStatuses(const Ice::Current &current) override
Definition: SkillManagerComponentPlugin.cpp:714
armarx::plugins::SkillManagerComponentPlugin::executeSkill
skills::SkillStatusUpdate executeSkill(const skills::SkillExecutionRequest &req)
Definition: SkillManagerComponentPlugin.cpp:85
armarx::skills::SkillExecutionRequest
Definition: SkillExecutionRequest.h:21
armarx::plugins::SkillManagerComponentPlugin::removeProvider
void removeProvider(const skills::ProviderID &id)
Definition: SkillManagerComponentPlugin.cpp:69
armarx::skills::SkillStatusUpdate
Definition: SkillStatusUpdate.h:139
armarx::SkillManagerComponentPluginUser::getSkillDescription
IceUtil::Optional< skills::manager::dto::SkillDescription > getSkillDescription(const skills::manager::dto::SkillID &id, const Ice::Current &current) override
Definition: SkillManagerComponentPlugin.cpp:687
armarx::skills::ProviderID
Definition: ProviderID.h:15
ManagedIceObject.h
armarx::SkillManagerComponentPluginUser::abortSkill
skills::provider::dto::AbortSkillResult abortSkill(const skills::manager::dto::SkillExecutionID &id, const Ice::Current &current) override
Definition: SkillManagerComponentPlugin.cpp:640
armarx::plugins
This file is part of ArmarX.
Definition: DebugObserverComponentPlugin.cpp:28
armarx::ComponentPlugin
Definition: ComponentPlugin.h:38
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::plugins::SkillManagerComponentPlugin::preOnConnectComponent
void preOnConnectComponent() override
Definition: SkillManagerComponentPlugin.cpp:19
armarx::plugins::SkillManagerComponentPlugin::updateSkillParameters
bool updateSkillParameters(const skills::SkillExecutionID &id, const aron::data::DictPtr &data)
Definition: SkillManagerComponentPlugin.cpp:221
armarx::SkillManagerComponentPluginUser
Definition: SkillManagerComponentPlugin.h:82
armarx::SkillManagerComponentPluginUser::removeProvider
void removeProvider(const skills::manager::dto::ProviderID &provider, const Ice::Current &current) override
Definition: SkillManagerComponentPlugin.cpp:600
SkillExecutionRequest.h
armarx::plugins::SkillManagerComponentPlugin
Definition: SkillManagerComponentPlugin.h:24
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:67
armarx::plugins::SkillManagerComponentPlugin::getSkillExecutionStatus
std::optional< skills::SkillStatusUpdate > getSkillExecutionStatus(const skills::SkillExecutionID &id)
Definition: SkillManagerComponentPlugin.cpp:448
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition: Dict.h:41
armarx::ManagedIceObject
The ManagedIceObject is the base class for all ArmarX objects.
Definition: ManagedIceObject.h:163
armarx::SkillManagerComponentPluginUser::updateStatusForSkill
void updateStatusForSkill(const skills::provider::dto::SkillStatusUpdate &update, const skills::callback::dto::ProviderID &id, const Ice::Current &current) override
Definition: SkillManagerComponentPlugin.cpp:661
armarx::SkillManagerComponentPluginUser::addProvider
void addProvider(const skills::manager::dto::ProviderInfo &providerInfo, const Ice::Current &current) override
Definition: SkillManagerComponentPlugin.cpp:592
ProviderInfo.h
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::plugins::SkillManagerComponentPlugin::preOnInitComponent
void preOnInitComponent() override
Definition: SkillManagerComponentPlugin.cpp:14
armarx::plugins::SkillManagerComponentPlugin::abortSkillAsync
bool abortSkillAsync(const skills::SkillExecutionID &id)
Definition: SkillManagerComponentPlugin.cpp:313
armarx::plugins::SkillManagerComponentPlugin::postCreatePropertyDefinitions
void postCreatePropertyDefinitions(PropertyDefinitionsPtr &properties) override
Definition: SkillManagerComponentPlugin.cpp:26
ComponentPlugin.h
armarx::plugins::SkillManagerComponentPlugin::addProvider
void addProvider(const skills::ProviderInfo &info)
Definition: SkillManagerComponentPlugin.cpp:49
armarx::skills::ProviderInfo
Definition: ProviderInfo.h:19
armarx::plugins::SkillManagerComponentPlugin::executeSkillAsync
skills::SkillExecutionID executeSkillAsync(const skills::SkillExecutionRequest &req)
Definition: SkillManagerComponentPlugin.cpp:152
armarx::SkillManagerComponentPluginUser::updateSkillParameters
skills::provider::dto::ParameterUpdateResult updateSkillParameters(const skills::manager::dto::SkillExecutionID &executionId, const aron::data::dto::DictPtr &params, const Ice::Current &current) override
Definition: SkillManagerComponentPlugin.cpp:627
armarx::skills::SkillID
Definition: SkillID.h:17
armarx::plugins::SkillManagerComponentPlugin::getFirstProviderNameThatHasSkill
skills::ProviderID getFirstProviderNameThatHasSkill(const skills::SkillID &skillid)
Definition: SkillManagerComponentPlugin.cpp:31
armarx::SkillManagerComponentPluginUser::abortSkillAsync
skills::provider::dto::AbortSkillResult abortSkillAsync(const skills::manager::dto::SkillExecutionID &id, const Ice::Current &current) override
Definition: SkillManagerComponentPlugin.cpp:650
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::plugins::SkillManagerComponentPlugin::getSkillExecutionStatuses
std::map< skills::SkillExecutionID, skills::SkillStatusUpdate > getSkillExecutionStatuses()
Definition: SkillManagerComponentPlugin.cpp:504
armarx::SkillManagerComponentPluginUser::SkillManagerComponentPluginUser
SkillManagerComponentPluginUser()
Definition: SkillManagerComponentPlugin.cpp:586