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
35class QComboBox;
36class QHBoxLayout;
37class QLineEdit;
38class QPushButton;
39class QSpinBox;
40
41namespace 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,
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
std::string timestamp()
PredictionWidget(GetEntityInfoFn &&entityInfoRetriever)
void makePrediction(const MemoryID &entityID, const aron::type::ObjectPtr &entityType, const armarx::DateTime &timestamp, const std::string &engineID)
std::function< EntityInfo(const MemoryID &)> GetEntityInfoFn
Represents a point in time.
Definition DateTime.h:25
std::shared_ptr< Object > ObjectPtr
Definition Object.h:36