SkillDashboard.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::ObjectPoseClientExample
17 * @author Leonie Leven ( leonie dot leven at student dot kit dot edu )
18 * @date 2024
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
25#include <list>
26#include <map>
27#include <shared_mutex>
28
32
33#include <RobotAPI/interface/components/SkillDashboardInterface.h>
34
35namespace armarx
36{
38 virtual public armarx::Component,
39 virtual public armarx::SkillDashboardInterface
40 {
41 public:
42 std::string
43 getDefaultName() const override
44 {
45 return "SkillDashboard";
46 }
47
48 SkillShortcutList getShortcuts(const ::Ice::Current& = ::Ice::Current()) override;
49 SkillShortcutWithTimeoutList
50 getShortcutsWithTimeout(const ::Ice::Current& = ::Ice::Current()) override;
51 SkillShortcut getShortcut(const std::string& name,
52 const ::Ice::Current& = ::Ice::Current()) override;
53 void addNewShortcut(const SkillShortcut& newShortcut,
54 const ::Ice::Current& = ::Ice::Current()) override;
55
56 void deleteShortcut(const std::string& name,
57 const ::Ice::Current& = ::Ice::Current()) override;
58
59 void exportShortcuts(const std::string& package,
60 const std::string& folder,
61 const std::string& name,
62 const ::Ice::Current& = ::Ice::Current()) override;
63
64 bool importShortcuts(const std::string& package,
65 const std::string& folder,
66 const std::string& name,
67 const ::Ice::Current& = ::Ice::Current()) override;
68
69
70 void saveShortcutOrder(const std::vector<std::string>& order,
71 const ::Ice::Current& = ::Ice::Current()) override;
72
73 void syncOrderedWithDefault(const ::Ice::Current&) override;
74
75 std::vector<std::string>
76 getPathStructure(const ::Ice::Current& = ::Ice::Current()) override;
77
78 protected:
79 /**
80 * @see armarx::ManagedIceObject::onInitComponent()
81 */
82 void onInitComponent() override;
83
84 /**
85 * @see armarx::ManagedIceObject::onConnectComponent()
86 */
87 void onConnectComponent() override;
88
89 /**
90 * @see armarx::ManagedIceObject::onDisconnectComponent()
91 */
92 void onDisconnectComponent() override;
93
94 /**
95 * @see armarx::ManagedIceObject::onExitComponent()
96 */
97 void onExitComponent() override;
98
99 /**
100 * @see PropertyUser::createPropertyDefinitions()
101 */
103
104 private:
105 struct Properties
106 {
107 std::string shortcutPath;
108 };
109
110 private:
111 std::vector<std::string> shortcutOrder;
112
113 SkillShortcutList registeredShortcuts;
114 std::shared_mutex registeredShortcutsMutex;
115
116 std::map<std::string, armarx::core::time::Duration> shortcutNameToTimeouts;
117 std::shared_mutex shortcutNameToTimeoutsMutex;
118
119 armarx::SkillDashboardCoverListenerPrx coverTopicPrx;
120 Properties properties;
121 bool loadShortcuts(const std::string& filename);
122 armarx::core::time::Duration getTimeout(const std::string& skillId);
123 void updateTimeoutForShortcut(const SkillShortcut& shortcut);
124 std::optional<SkillShortcut> getShortcutWithId(const std::string& id);
125 std::string packageName;
126 std::string pathToDashboard;
127 std::string dahsboardName;
128 };
129
130} // namespace armarx
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
SkillShortcutWithTimeoutList getShortcutsWithTimeout(const ::Ice::Current &=::Ice::Current()) override
void onInitComponent() override
bool importShortcuts(const std::string &package, const std::string &folder, const std::string &name, const ::Ice::Current &=::Ice::Current()) override
void deleteShortcut(const std::string &name, const ::Ice::Current &=::Ice::Current()) override
void syncOrderedWithDefault(const ::Ice::Current &) override
void addNewShortcut(const SkillShortcut &newShortcut, const ::Ice::Current &=::Ice::Current()) override
void onDisconnectComponent() override
SkillShortcut getShortcut(const std::string &name, const ::Ice::Current &=::Ice::Current()) override
SkillShortcutList getShortcuts(const ::Ice::Current &=::Ice::Current()) override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void saveShortcutOrder(const std::vector< std::string > &order, const ::Ice::Current &=::Ice::Current()) override
void exportShortcuts(const std::string &package, const std::string &folder, const std::string &name, const ::Ice::Current &=::Ice::Current()) override
void onConnectComponent() override
std::vector< std::string > getPathStructure(const ::Ice::Current &=::Ice::Current()) override
void onExitComponent() override
std::string getDefaultName() const override
Retrieve default name of component.
Represents a duration.
Definition Duration.h:17
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.