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 namespace armarx::armem::gui
42 {
43  class TimestampInput;
44 
45  class PredictionWidget : public QWidget
46  {
47  Q_OBJECT // NOLINT
48 
49  public : struct EntityInfo
50  {
52  std::vector<PredictionEngine> engines;
53  };
54 
55  using GetEntityInfoFn = std::function<EntityInfo(const MemoryID&)>;
56 
57  public:
58  PredictionWidget(GetEntityInfoFn&& entityInfoRetriever);
59 
60  signals:
61  void makePrediction(const MemoryID& entityID,
62  const aron::type::ObjectPtr& entityType,
63  const armarx::DateTime& timestamp,
64  const std::string& engineID);
65 
66  private:
67  QLineEdit* memoryEntity;
68 
69  QComboBox* timestampInputSelector;
70  QHBoxLayout* timestampLayout;
71  QSpinBox* instanceSpinner;
72  QComboBox* predictionEngineSelector;
73  QPushButton* predictButton;
74 
75  std::map<QString, TimestampInput*> timestampInputs;
76 
77  GetEntityInfoFn entityInfoRetriever;
78 
79  // Type of currently entered entity and engine availability for it
80  aron::type::ObjectPtr currentType;
81  std::vector<PredictionEngine> currentEngines;
82 
83  void addTimestampInputMethod(const QString& key, TimestampInput* input);
84 
85  private slots: // NOLINT
86  void showTimestampInputMethod(const QString& key);
87 
88  void updateCurrentEntity();
89 
90  void startPrediction();
91  };
92 } // namespace armarx::armem::gui
armarx::armem::gui::PredictionWidget::EntityInfo::type
aron::type::ObjectPtr type
Definition: PredictionWidget.h:51
MemoryID.h
Prediction.h
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::gui::TimestampInput
Definition: TimestampInput.h:40
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:12
armarx::armem::gui::PredictionWidget::EntityInfo
Definition: PredictionWidget.h:49
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:52
forward_declarations.h
armarx::armem::gui::PredictionWidget::GetEntityInfoFn
std::function< EntityInfo(const MemoryID &)> GetEntityInfoFn
Definition: PredictionWidget.h:55
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::gui::PredictionWidget
Definition: PredictionWidget.h:45
armarx::armem::gui
Definition: ActionsMenuBuilder.cpp:5
armarx::armem::gui::PredictionWidget::PredictionWidget
PredictionWidget(GetEntityInfoFn &&entityInfoRetriever)
Definition: PredictionWidget.cpp:37
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36