DebugRobotUnitDataStreamingWidgetController.cpp
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::DebugRobotUnitDataStreamingWidgetController
17 * \author Raphael Grimm ( raphael dot grimm at kit dot edu )
18 * \date 2021
19 * \copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
24
25#include <string>
26
27namespace armarx
28{
29
30 void
32 {
34 settings->value("ru", "Armar6Unit").toString().toStdString());
35 }
36
37 void
39 {
40 settings->setValue(
41 "ru", QString::fromStdString(getRobotUnitComponentPlugin().getRobotUnitName()));
42 }
43
44 QPointer<QDialog>
46 {
47 if (!dialog)
48 {
49 dialog = new SimpleConfigDialog(parent);
50 dialog->addProxyFinder<RobotUnitInterfacePrx>("ru", "Robot Unit", "*Unit");
51 }
52 return qobject_cast<SimpleConfigDialog*>(dialog);
53 }
54
55 void
60
66
67 void
69 {
70 std::lock_guard f{mutex};
71 rec.clear();
72 }
73
74 void
76 {
77 const std::size_t n = widget.spinBoxNumberOfStreams->value();
78 if (!getRobotUnit())
79 {
80 return;
81 }
82 if (rec.size() > n)
83 {
84 rec.resize(n);
85 }
86 std::lock_guard f{mutex};
87 RobotUnitDataStreaming::Config cfg;
88 if (widget.checkBoxStreamSens->isChecked())
89 {
90 cfg.loggingNames.emplace_back("sens");
91 }
92 if (widget.checkBoxStreamCtrl->isChecked())
93 {
94 cfg.loggingNames.emplace_back("ctrl");
95 }
96 while (rec.size() < n)
97 {
98 rec.emplace_back(getRobotUnitComponentPlugin().startDataStreaming(cfg));
99 ARMARX_INFO << rec.back()->getDataDescriptionString();
100 }
101 for (auto& r : rec)
102 {
103 r->getDataBuffer().clear();
104 }
105 }
106} // namespace armarx
virtual QPointer< QWidget > getWidget()
getWidget returns a pointer to the a widget of this controller.
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
plugins::RobotUnitComponentPlugin & getRobotUnitComponentPlugin()
A config-dialog containing one (or multiple) proxy finders.
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
This file offers overloads of toIce() and fromIce() functions for STL container types.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotUnitInterface > RobotUnitInterfacePrx