LaserScannerPluginWidgetController.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::LaserScannerPluginWidgetController
17 * @author Fabian Paus ( fabian dot paus at kit dot edu )
18 * @date 2017
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
25#include <mutex>
26
27// Qt includes
28#include <QGraphicsScene>
29
31
35
36#include <RobotAPI/interface/units/LaserScannerUnit.h>
37
38// C++ includes
39#include <memory>
40
41// ui_LaserScannerPluginWidget.h is included by the .cpp, not here: moc textually inlines every
42// #include it can resolve, and parsing the uic-generated header alongside this one
43// makes moc mis-qualify this class as Ui::armarx::*.
44namespace Ui
45{
46 class LaserScannerPluginWidget;
47}
48
49namespace armarx
50{
51 /**
52 \page RobotAPI-GuiPlugins-LaserScannerPlugin LaserScannerPlugin
53 \brief The LaserScannerPlugin allows visualizing the raw sensor data captured from multiple laser scanners.
54
55 API Documentation \ref LaserScannerPluginWidgetController
56
57 \see LaserScannerPluginGuiPlugin
58 */
59
60 /**
61 * \class LaserScannerPluginWidgetController
62 * \brief LaserScannerPluginWidgetController brief one line description
63 *
64 * Detailed description
65 */
67 public ArmarXComponentWidgetControllerTemplate<LaserScannerPluginWidgetController>,
68 public armarx::LaserScannerUnitListener
69 {
70 Q_OBJECT
71
72 public:
73 /**
74 * Controller Constructor
75 */
77
78 /**
79 * Controller destructor
80 */
82
83 /**
84 * @see ArmarXWidgetController::loadSettings()
85 */
86 void loadSettings(QSettings* settings) override;
87
88 /**
89 * @see ArmarXWidgetController::saveSettings()
90 */
91 void saveSettings(QSettings* settings) override;
92
93 /**
94 * Returns the Widget name displayed in the ArmarXGui to create an
95 * instance of this class.
96 */
97 static QString
99 {
100 return "RobotControl.LaserScannerGUI";
101 }
102
103 /**
104 * \see armarx::Component::onInitComponent()
105 */
106 void onInitComponent() override;
107
108 /**
109 * \see armarx::Component::onConnectComponent()
110 */
111 void onConnectComponent() override;
112
113 QPointer<QDialog> getConfigDialog(QWidget* parent) override;
114
115 void configured() override;
116
117 void reportSensorValues(const std::string& device,
118 const std::string& name,
119 const LaserScan& scan,
120 const TimestampBasePtr& timestamp,
121 const Ice::Current& c) override;
122 public slots:
123 void onNewSensorValuesReported();
124 void onDeviceSelected(int index);
125
126 signals:
128
129 private:
130 /**
131 * Widget Form
132 */
133 std::unique_ptr<Ui::LaserScannerPluginWidget> widget;
134 QPointer<SimpleConfigDialog> dialog;
135
136 std::string laserScannerUnitName;
137 LaserScannerUnitInterfacePrx laserScannerUnit;
138 LaserScannerInfoSeq laserScanners;
139
140 std::mutex scanMutex;
141 std::unordered_map<std::string, LaserScan> scans;
142 std::unordered_map<std::string, std::deque<int>> numberOfRingsHistory;
143
144 std::unique_ptr<QGraphicsScene> scene;
145 };
146} // namespace armarx
std::string timestamp()
uint8_t index
#define ARMARXCOMPONENT_IMPORT_EXPORT
constexpr T c
static QString GetWidgetName()
Returns the Widget name displayed in the ArmarXGui to create an instance of this class.
ArmarX Headers.
This file offers overloads of toIce() and fromIce() functions for STL container types.