SkillManagerMonitorWidgetController.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::gui-plugins::SkillManagerMonitorWidgetController
17  * @author Raphael Grimm ( raphael dot grimm 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 #pragma once
23 
24 #include <stack>
25 #include <vector>
26 #include <thread>
28 
32 
33 #include <RobotAPI/interface/skills/SkillMemoryInterface.h>
34 
35 #include <RobotAPI/gui-plugins/SkillManagerPlugin/ui_SkillManagerMonitorWidget.h>
36 
38 
42 
43 #include <QTimer>
44 
45 namespace armarx
46 {
49  public armarx::ArmarXComponentWidgetControllerTemplate < SkillManagerMonitorWidgetController >
50  {
51  Q_OBJECT
52 
53  public:
54 
59 
60  void loadSettings(QSettings* settings) override;
61  void saveSettings(QSettings* settings) override;
62  QPointer<QDialog> getConfigDialog(QWidget* parent) override;
63  void configured() override;
64 
69  static QString GetWidgetName()
70  {
71  return "Skills.Manager";
72  }
73 
74  void onInitComponent() override;
75  void onConnectComponent() override;
76  void onDisconnectComponent() override;
77 
78  private slots:
79  void skillSelectionChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
80 
81  void stopSkill();
82  void executeSkill();
83 
84  void updateTimerFrequency();
85  void refreshSkills();
86 
87  void copyCurrentConfig();
88  void pasteCurrentConfig();
89  void resetCurrentConfig();
90 
91  void onTreeWidgetItemDoubleClicked(QTreeWidgetItem * item, int column);
92 
93  private:
94  aron::data::DictPtr getConfigAsAron() const;
95 
96  private:
100  Ui::SkillManagerMonitorWidget widget;
101  QPointer<SimpleConfigDialog> dialog;
102 
103  std::string observerName = "SkillManager";
104  skills::manager::dti::SkillManagerInterfacePrx manager = nullptr;
105 
106  struct SelectedSkill
107  {
108  std::string providerName;
109  std::string skillName;
110  };
111 
112  // Data taken from observer (snapshot of it)
113  skills::manager::dto::SkillDescriptionMapMap skills = {};
114 
115  // User Input
116  SelectedSkill selectedSkill;
117 
118  // Helper to get the treeWidgetItem easily
119  QTreeWidgetItem* skillsArgumentsTreeWidgetItem = nullptr;
120  AronTreeWidgetControllerPtr aronTreeWidgetController = nullptr;
121 
122  // others
123  std::atomic_bool connected = false;
124  QTimer* refreshSkillsResultTimer;
125 
126  // skillExecutions
127  std::vector<std::thread> executions;
128  };
129 }
130 
131 
skills
This file is part of ArmarX.
VariantVisitor.h
armarx::SkillManagerMonitorWidgetController::GetWidgetName
static QString GetWidgetName()
Returns the Widget name displayed in the ArmarXGui to create an instance of this class.
Definition: SkillManagerMonitorWidgetController.h:69
All.h
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
SimpleConfigDialog.h
ArmarXGuiPlugin.h
ArmarXComponentWidgetController.h
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
All.h
armarx::SkillManagerMonitorWidgetController
Definition: SkillManagerMonitorWidgetController.h:47
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition: Dict.h:41
AronTreeWidgetController.h
armarx::AronTreeWidgetControllerPtr
std::shared_ptr< AronTreeWidgetController > AronTreeWidgetControllerPtr
Definition: AronTreeWidgetController.h:33
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
ImportExportComponent.h