PredictionWidget.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::armem::gui
17  * @author phesch ( ulila at student dot kit dot edu )
18  * @date 2022
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <functional>
26 #include <map>
27 
28 #include <QWidget>
29 
33 
34 
35 class QComboBox;
36 class QHBoxLayout;
37 class QLineEdit;
38 class QPushButton;
39 class QSpinBox;
40 
41 
42 namespace armarx::armem::gui
43 {
44  class TimestampInput;
45 
46 
47  class PredictionWidget : public QWidget
48  {
49  Q_OBJECT // NOLINT
50 
51  public:
52  struct EntityInfo
53  {
55  std::vector<PredictionEngine> engines;
56  };
57  using GetEntityInfoFn = std::function<EntityInfo(const MemoryID&)>;
58 
59  public:
60  PredictionWidget(GetEntityInfoFn&& entityInfoRetriever);
61 
62  signals:
63  void makePrediction(const MemoryID& entityID,
64  const aron::type::ObjectPtr& entityType,
65  const armarx::DateTime& timestamp,
66  const std::string& engineID);
67 
68  private:
69  QLineEdit* memoryEntity;
70 
71  QComboBox* timestampInputSelector;
72  QHBoxLayout* timestampLayout;
73  QSpinBox* instanceSpinner;
74  QComboBox* predictionEngineSelector;
75  QPushButton* predictButton;
76 
77  std::map<QString, TimestampInput*> timestampInputs;
78 
79  GetEntityInfoFn entityInfoRetriever;
80 
81  // Type of currently entered entity and engine availability for it
82  aron::type::ObjectPtr currentType;
83  std::vector<PredictionEngine> currentEngines;
84 
85  void addTimestampInputMethod(const QString& key, TimestampInput* input);
86 
87  private slots: // NOLINT
88  void showTimestampInputMethod(const QString& key);
89 
90  void updateCurrentEntity();
91 
92  void startPrediction();
93 
94  };
95 } // namespace armarx::armem::gui
armarx::armem::gui::PredictionWidget::EntityInfo::type
aron::type::ObjectPtr type
Definition: PredictionWidget.h:54
MemoryID.h
Prediction.h
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::gui::TimestampInput
Definition: TimestampInput.h:39
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:19
armarx::armem::gui::PredictionWidget::EntityInfo
Definition: PredictionWidget.h:52
armarx::armem::gui::PredictionWidget::makePrediction
void makePrediction(const MemoryID &entityID, const aron::type::ObjectPtr &entityType, const armarx::DateTime &timestamp, const std::string &engineID)
armarx::armem::gui::PredictionWidget::EntityInfo::engines
std::vector< PredictionEngine > engines
Definition: PredictionWidget.h:55
forward_declarations.h
armarx::armem::gui::PredictionWidget::GetEntityInfoFn
std::function< EntityInfo(const MemoryID &)> GetEntityInfoFn
Definition: PredictionWidget.h:57
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::gui::PredictionWidget
Definition: PredictionWidget.h:47
armarx::armem::gui
Definition: ActionsMenuBuilder.cpp:6
armarx::armem::gui::PredictionWidget::PredictionWidget
PredictionWidget(GetEntityInfoFn &&entityInfoRetriever)
Definition: PredictionWidget.cpp:38
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36