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
33
35#include <RobotAPI/interface/skills/SkillMemoryInterface.h>
37#include <RobotAPI/libraries/armem_skills/aron/Statechart.aron.generated.h>
44#include <RobotAPI/libraries/skills/core/aron/FluxioSkill.aron.generated.h>
49
50namespace armarx
51{
52 /**
53 * @defgroup Component-SkillsMemory SkillsMemory
54 * @ingroup RobotAPI-Components
55 * A description of the component SkillsMemory.
56 *
57 * @class SkillsMemory
58 * @ingroup Component-SkillsMemory
59 * @brief Brief description of class SkillsMemory.
60 *
61 * Detailed description of class SkillsMemory.
62 */
64 virtual public armarx::Component,
65 virtual public skills::dti::SkillMemoryInterface,
66
69
72 {
73 public:
75
76 /// @see armarx::ManagedIceObject::getDefaultName()
77 std::string getDefaultName() const override;
78
79 // Override StatechartListener
80 void
81 reportStatechartTransitionWithParameters(const ProfilerStatechartTransitionWithParameters&,
82 const Ice::Current&) override;
84 const ProfilerStatechartTransitionWithParametersList&,
85 const Ice::Current&) override;
86
87 // Override SkillManager to add memory functions
88 void addProvider(const skills::manager::dto::ProviderInfo& info,
89 const Ice::Current& current) override;
90
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
99 skills::manager::dto::SkillExecutionID
100 executeSkillAsync(const skills::manager::dto::SkillExecutionRequest& info,
101 const Ice::Current& current) override;
102
103 void updateStatusForSkill(const skills::provider::dto::SkillStatusUpdate& update,
104 const skills::callback::dto::ProviderID& id,
105 const Ice::Current& current) override;
106
107 IceUtil::Optional<skills::manager::dto::SkillStatusUpdate>
108 getSkillExecutionStatus(const skills::manager::dto::SkillExecutionID& executionId,
109 const Ice::Current& current) override;
110
111 skills::manager::dto::SkillStatusUpdateMap
112 getSkillExecutionStatuses(const Ice::Current& current) override;
113
114 // WritingInterface interface
115 armem::data::CommitResult commit(const armem::data::Commit& commit,
116 const Ice::Current&) override;
117
118 //****************************//
119 //** Fluxio related methods **//
120 //****************************//
121
122 void saveSkill(const skills::manager::arondto::FluxioSkill& skillt) override;
123 std::optional<std::vector<skills::manager::arondto::FluxioSkill>> loadCompositeSkills() override;
124 std::optional<std::vector<skills::manager::arondto::FluxioSkill>> loadCompositeSkillsOfProvider(const std::string& providerId) override;
125
126 void addProfile(const skills::manager::arondto::FluxioProfile& profile) override;
127 std::optional<std::vector<skills::manager::arondto::FluxioProfile>> loadProfiles() override;
128
129 protected:
130 /// @see armarx::ManagedIceObject::onInitComponent()
131 void onInitComponent() override;
132
133 /// @see armarx::ManagedIceObject::onConnectComponent()
134 void onConnectComponent() override;
135
136 /// @see armarx::ManagedIceObject::onDisconnectComponent()
137 void onDisconnectComponent() override;
138
139 /// @see armarx::ManagedIceObject::onExitComponent()
140 void onExitComponent() override;
141
142 /// @see PropertyUser::createPropertyDefinitions()
144
145
146 private:
147 static constexpr const char* MemoryName = "Skill";
148
149 struct Properties
150 {
151 bool useDebugObserver = true;
152 };
153
154 Properties p;
155
156 skills::segment::StatechartListenerProviderSegment statechartListenerProviderSegment;
160 skills::segment::SkillEventCoreSegment skillEventCoreSegment;
161 skills::segment::SkillExecutionRequestCoreSegment skillExecutionRequestCoreSegment;
162
163 DebugObserverInterfacePrx debugObserver;
164
165 // RemoteGUI
166 void RemoteGui_update() override;
167 void createRemoteGuiTab();
168 void clearSkillEventsWorkingMemory();
169 void clearSkillExecutionRequestsWorkingMemory();
170
171 struct RemoteGuiTab : RemoteGui::Client::Tab
172 {
173 RemoteGui::Client::Button clearSkillEventsButton;
174 RemoteGui::Client::Button clearSkillExecutionRequestsButton;
175 };
176 RemoteGuiTab tab;
177
178 };
179} // namespace armarx
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
void onInitComponent() override
void addProvider(const skills::manager::dto::ProviderInfo &info, const Ice::Current &current) override
void removeProvider(const skills::manager::dto::ProviderID &provider, const Ice::Current &current) override
armem::data::CommitResult commit(const armem::data::Commit &commit, const Ice::Current &) override
skills::manager::dto::SkillStatusUpdateMap getSkillExecutionStatuses(const Ice::Current &current) override
std::optional< std::vector< skills::manager::arondto::FluxioProfile > > loadProfiles() override
std::optional< std::vector< skills::manager::arondto::FluxioSkill > > loadCompositeSkillsOfProvider(const std::string &providerId) override
void onDisconnectComponent() override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void updateStatusForSkill(const skills::provider::dto::SkillStatusUpdate &update, const skills::callback::dto::ProviderID &id, const Ice::Current &current) override
void reportStatechartTransitionWithParameters(const ProfilerStatechartTransitionWithParameters &, const Ice::Current &) override
void addProfile(const skills::manager::arondto::FluxioProfile &profile) override
skills::manager::dto::SkillStatusUpdate executeSkill(const skills::manager::dto::SkillExecutionRequest &info, const Ice::Current &current) override
void onConnectComponent() override
IceUtil::Optional< skills::manager::dto::SkillStatusUpdate > getSkillExecutionStatus(const skills::manager::dto::SkillExecutionID &executionId, const Ice::Current &current) override
void reportStatechartTransitionWithParametersList(const ProfilerStatechartTransitionWithParametersList &, const Ice::Current &) override
void onExitComponent() override
skills::manager::dto::SkillExecutionID executeSkillAsync(const skills::manager::dto::SkillExecutionRequest &info, const Ice::Current &current) override
std::optional< std::vector< skills::manager::arondto::FluxioSkill > > loadCompositeSkills() override
void saveSkill(const skills::manager::arondto::FluxioSkill &skillt) override
std::string getDefaultName() const override
Base class of memory server components.
This file offers overloads of toIce() and fromIce() functions for STL container types.
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface > DebugObserverInterfacePrx
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.