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 std::vector<std::string>
74 getPathStructure(const ::Ice::Current& = ::Ice::Current()) override;
75
76 protected:
77 /**
78 * @see armarx::ManagedIceObject::onInitComponent()
79 */
80 void onInitComponent() override;
81
82 /**
83 * @see armarx::ManagedIceObject::onConnectComponent()
84 */
85 void onConnectComponent() override;
86
87 /**
88 * @see armarx::ManagedIceObject::onDisconnectComponent()
89 */
90 void onDisconnectComponent() override;
91
92 /**
93 * @see armarx::ManagedIceObject::onExitComponent()
94 */
95 void onExitComponent() override;
96
97 /**
98 * @see PropertyUser::createPropertyDefinitions()
99 */
101
102 private:
103 struct Properties
104 {
105 std::string shortcutPath;
106 };
107
108 private:
109 std::vector<std::string> shortcutOrder;
110
111 SkillShortcutList registeredShortcuts;
112 std::shared_mutex registeredShortcutsMutex;
113
114 std::map<std::string, armarx::core::time::Duration> shortcutNameToTimeouts;
115 std::shared_mutex shortcutNameToTimeoutsMutex;
116
117 Properties properties;
118 bool loadShortcuts(const std::string& filename);
119 armarx::core::time::Duration getTimeout(const std::string& skillId);
120 void updateTimeoutForShortcut(const SkillShortcut& shortcut);
121 std::string packageName;
122 std::string pathToDashboard;
123 std::string dahsboardName;
124 };
125
126} // 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 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.