SkillsMemory.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package RobotAPI::ArmarXObjects::SkillsMemory
17  * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18  * @date 2020
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 // Base Class
26 #include <vector>
28 
29 // ArmarX
30 #include <ArmarXCore/interface/core/Profiler.h>
32 
34 #include <RobotAPI/interface/skills/SkillMemoryInterface.h>
36 #include <RobotAPI/libraries/armem_skills/aron/Statechart.aron.generated.h>
43 #include <RobotAPI/libraries/skills/core/aron/FluxioSkill.aron.generated.h>
45 
46 namespace armarx
47 {
48  /**
49  * @defgroup Component-SkillsMemory SkillsMemory
50  * @ingroup RobotAPI-Components
51  * A description of the component SkillsMemory.
52  *
53  * @class SkillsMemory
54  * @ingroup Component-SkillsMemory
55  * @brief Brief description of class SkillsMemory.
56  *
57  * Detailed description of class SkillsMemory.
58  */
59  class SkillsMemory :
60  virtual public armarx::Component,
61  virtual public skills::dti::SkillMemoryInterface,
62 
65  virtual public SkillManagerComponentPluginUser
66  {
67  public:
68  SkillsMemory();
69 
70  /// @see armarx::ManagedIceObject::getDefaultName()
71  std::string getDefaultName() const override;
72 
73  // Override StatechartListener
74  void
75  reportStatechartTransitionWithParameters(const ProfilerStatechartTransitionWithParameters&,
76  const Ice::Current&) override;
78  const ProfilerStatechartTransitionWithParametersList&,
79  const Ice::Current&) override;
80 
81  // Override SkillManager to add memory functions
82  void addProvider(const skills::manager::dto::ProviderInfo& info,
83  const Ice::Current& current) override;
84 
85  void removeProvider(const skills::manager::dto::ProviderID& provider,
86  const Ice::Current& current) override;
87 
88  skills::manager::dto::SkillStatusUpdate
89  executeSkill(const skills::manager::dto::SkillExecutionRequest& info,
90  const Ice::Current& current) override;
91 
92 
93  skills::manager::dto::SkillExecutionID
94  executeSkillAsync(const skills::manager::dto::SkillExecutionRequest& info,
95  const Ice::Current& current) override;
96 
97  void updateStatusForSkill(const skills::provider::dto::SkillStatusUpdate& update,
98  const skills::callback::dto::ProviderID& id,
99  const Ice::Current& current) override;
100 
101  IceUtil::Optional<skills::manager::dto::SkillStatusUpdate>
102  getSkillExecutionStatus(const skills::manager::dto::SkillExecutionID& executionId,
103  const Ice::Current& current) override;
104 
105  skills::manager::dto::SkillStatusUpdateMap
106  getSkillExecutionStatuses(const Ice::Current& current) override;
107 
108  // WritingInterface interface
109  armem::data::CommitResult commit(const armem::data::Commit& commit,
110  const Ice::Current&) override;
111 
112  //****************************//
113  //** Fluxio related methods **//
114  //****************************//
115 
116  void saveSkill(const skills::manager::arondto::FluxioSkill& skillt) override;
117  std::optional<std::vector<skills::manager::arondto::FluxioSkill>> loadCompositeSkills() override;
118  std::optional<std::vector<skills::manager::arondto::FluxioSkill>> loadCompositeSkillsOfProvider(const std::string& providerId) override;
119 
120  void addProfile(const skills::manager::arondto::FluxioProfile& profile) override;
121  std::optional<std::vector<skills::manager::arondto::FluxioProfile>> loadProfiles() override;
122 
123  protected:
124  /// @see armarx::ManagedIceObject::onInitComponent()
125  void onInitComponent() override;
126 
127  /// @see armarx::ManagedIceObject::onConnectComponent()
128  void onConnectComponent() override;
129 
130  /// @see armarx::ManagedIceObject::onDisconnectComponent()
131  void onDisconnectComponent() override;
132 
133  /// @see armarx::ManagedIceObject::onExitComponent()
134  void onExitComponent() override;
135 
136  /// @see PropertyUser::createPropertyDefinitions()
138 
139 
140  private:
141  static constexpr const char* MemoryName = "Skill";
142 
143  struct Properties
144  {
145  };
146 
147  Properties p;
148 
149  skills::segment::StatechartListenerProviderSegment statechartListenerProviderSegment;
150  skills::segment::ExecutableSkillLibraryCoreSegment executableSkillCoreSegment;
151  skills::segment::ComposedSkillLibraryCoreSegment composedSkillCoreSegment;
153  skills::segment::SkillEventCoreSegment skillEventCoreSegment;
154  skills::segment::SkillExecutionRequestCoreSegment skillExecutionRequestCoreSegment;
155  };
156 } // namespace armarx
armarx::skills::segment::StatechartListenerProviderSegment
Definition: StatechartListenerSegment.h:13
armarx::SkillsMemory::saveSkill
void saveSkill(const skills::manager::arondto::FluxioSkill &skillt) override
Definition: SkillsMemory.cpp:240
armarx::SkillsMemory::removeProvider
void removeProvider(const skills::manager::dto::ProviderID &provider, const Ice::Current &current) override
Definition: SkillsMemory.cpp:153
armarx::skills::segment::SkillExecutionRequestCoreSegment
Definition: SkillExecutionRequestSegment.h:17
armarx::SkillsMemory::onExitComponent
void onExitComponent() override
Definition: SkillsMemory.cpp:107
armarx::skills::segment::SkillEventCoreSegment
Definition: SkillEventSegment.h:16
armarx::SkillsMemory::addProvider
void addProvider(const skills::manager::dto::ProviderInfo &info, const Ice::Current &current) override
Definition: SkillsMemory.cpp:141
armarx::SkillsMemory::getSkillExecutionStatus
IceUtil::Optional< skills::manager::dto::SkillStatusUpdate > getSkillExecutionStatus(const skills::manager::dto::SkillExecutionID &executionId, const Ice::Current &current) override
Definition: SkillsMemory.cpp:193
armarx::SkillsMemory::onDisconnectComponent
void onDisconnectComponent() override
Definition: SkillsMemory.cpp:102
armarx::SkillsMemory::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: SkillsMemory.cpp:62
ReadWritePluginUser.h
armarx::SkillsMemory::getDefaultName
std::string getDefaultName() const override
Definition: SkillsMemory.cpp:80
armarx::SkillsMemory::onConnectComponent
void onConnectComponent() override
Definition: SkillsMemory.cpp:97
ExecutableSkillLibrarySegment.h
armarx::SkillsMemory::loadProfiles
std::optional< std::vector< skills::manager::arondto::FluxioProfile > > loadProfiles() override
Definition: SkillsMemory.cpp:260
armarx::SkillsMemory::reportStatechartTransitionWithParametersList
void reportStatechartTransitionWithParametersList(const ProfilerStatechartTransitionWithParametersList &, const Ice::Current &) override
Definition: SkillsMemory.cpp:229
StatechartListenerComponentPlugin.h
armarx::SkillsMemory::commit
armem::data::CommitResult commit(const armem::data::Commit &commit, const Ice::Current &) override
Definition: SkillsMemory.cpp:112
ProfileLibrarySegment.h
armarx::skills::segment::ExecutableSkillLibraryCoreSegment
Definition: ExecutableSkillLibrarySegment.h:18
ComposedSkillLibrarySegment.h
SkillManagerComponentPlugin.h
ObserverObjectFactories.h
armarx::SkillsMemory::reportStatechartTransitionWithParameters
void reportStatechartTransitionWithParameters(const ProfilerStatechartTransitionWithParameters &, const Ice::Current &) override
Definition: SkillsMemory.cpp:221
armarx::SkillsMemory::updateStatusForSkill
void updateStatusForSkill(const skills::provider::dto::SkillStatusUpdate &update, const skills::callback::dto::ProviderID &id, const Ice::Current &current) override
Definition: SkillsMemory.cpp:183
armarx::armem::server::plugins::ReadWritePluginUser
Base class of memory server components.
Definition: ReadWritePluginUser.h:20
armarx::SkillsMemory::loadCompositeSkillsOfProvider
std::optional< std::vector< skills::manager::arondto::FluxioSkill > > loadCompositeSkillsOfProvider(const std::string &providerId) override
Definition: SkillsMemory.cpp:250
armarx::SkillsMemory::addProfile
void addProfile(const skills::manager::arondto::FluxioProfile &profile) override
Definition: SkillsMemory.cpp:255
armarx::SkillsMemory::executeSkillAsync
skills::manager::dto::SkillExecutionID executeSkillAsync(const skills::manager::dto::SkillExecutionRequest &info, const Ice::Current &current) override
Definition: SkillsMemory.cpp:173
armarx::SkillsMemory::SkillsMemory
SkillsMemory()
Definition: SkillsMemory.cpp:48
armarx::SkillManagerComponentPluginUser
Definition: SkillManagerComponentPluginUser.h:21
armarx::SkillsMemory::onInitComponent
void onInitComponent() override
Definition: SkillsMemory.cpp:86
armarx::SkillsMemory
Brief description of class SkillsMemory.
Definition: SkillsMemory.h:59
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:68
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:91
armarx::SkillsMemory::loadCompositeSkills
std::optional< std::vector< skills::manager::arondto::FluxioSkill > > loadCompositeSkills() override
Definition: SkillsMemory.cpp:245
SkillExecutionRequestSegment.h
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::skills::segment::ComposedSkillLibraryCoreSegment
Definition: ComposedSkillLibrarySegment.h:20
armarx::StatechartListenerComponentPluginUser
Definition: StatechartListenerComponentPlugin.h:25
StatechartListenerSegment.h
armarx::SkillsMemory::getSkillExecutionStatuses
skills::manager::dto::SkillStatusUpdateMap getSkillExecutionStatuses(const Ice::Current &current) override
Definition: SkillsMemory.cpp:206
SkillEventSegment.h
armarx::skills::segment::ProfileLibraryCoreSegment
Definition: ProfileLibrarySegment.h:21
armarx::SkillsMemory::executeSkill
skills::manager::dto::SkillStatusUpdate executeSkill(const skills::manager::dto::SkillExecutionRequest &info, const Ice::Current &current) override
Definition: SkillsMemory.cpp:163
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27