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 
27 namespace armarx
28 {
29 
31  {
33  settings->value("ru", "Armar6Unit").toString().toStdString());
34  }
35 
37  {
38  settings->setValue("ru", QString::fromStdString(getRobotUnitComponentPlugin().getRobotUnitName()));
39  }
40 
42  {
43  if (!dialog)
44  {
45  dialog = new SimpleConfigDialog(parent);
46  dialog->addProxyFinder<RobotUnitInterfacePrx>("ru", "Robot Unit", "*Unit");
47  }
48  return qobject_cast<SimpleConfigDialog*>(dialog);
49  }
50 
52  {
53  getRobotUnitComponentPlugin().setRobotUnitName(dialog->get("ru"));
54  }
55 
57  {
58  widget.setupUi(getWidget());
59  startTimer(10);
60  }
61 
63  {
64  std::lock_guard f{mutex};
65  rec.clear();
66  }
67 
69  {
70  const std::size_t n = widget.spinBoxNumberOfStreams->value();
71  if (!getRobotUnit())
72  {
73  return;
74  }
75  if (rec.size() > n)
76  {
77  rec.resize(n);
78  }
79  std::lock_guard f{mutex};
80  RobotUnitDataStreaming::Config cfg;
81  if (widget.checkBoxStreamSens->isChecked())
82  {
83  cfg.loggingNames.emplace_back("sens");
84  }
85  if (widget.checkBoxStreamCtrl->isChecked())
86  {
87  cfg.loggingNames.emplace_back("ctrl");
88  }
89  while (rec.size() < n)
90  {
91  rec.emplace_back(getRobotUnitComponentPlugin()
92  .startDataStreaming(cfg));
93  ARMARX_INFO << rec.back()->getDataDescriptionString();
94  }
95  for (auto& r : rec)
96  {
97  r->getDataBuffer().clear();
98  }
99  }
100 }
armarx::DebugRobotUnitDataStreamingWidgetController::loadSettings
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
Definition: DebugRobotUnitDataStreamingWidgetController.cpp:30
armarx::DebugRobotUnitDataStreamingWidgetController::DebugRobotUnitDataStreamingWidgetController
DebugRobotUnitDataStreamingWidgetController()
Definition: DebugRobotUnitDataStreamingWidgetController.cpp:56
armarx::plugins::RobotUnitComponentPlugin::setRobotUnitName
void setRobotUnitName(const std::string &name)
Definition: RobotUnitComponentPlugin.cpp:118
armarx::DebugRobotUnitDataStreamingWidgetController::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: DebugRobotUnitDataStreamingWidgetController.cpp:36
armarx::DebugRobotUnitDataStreamingWidgetController::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: DebugRobotUnitDataStreamingWidgetController.cpp:62
armarx::DebugRobotUnitDataStreamingWidgetController::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: DebugRobotUnitDataStreamingWidgetController.cpp:41
DebugRobotUnitDataStreamingWidgetController.h
armarx::DebugRobotUnitDataStreamingWidgetController::configured
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
Definition: DebugRobotUnitDataStreamingWidgetController.cpp:51
armarx::DebugRobotUnitDataStreamingWidgetController::timerEvent
void timerEvent(QTimerEvent *event) override
Definition: DebugRobotUnitDataStreamingWidgetController.cpp:68
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
IceInternal::ProxyHandle<::IceProxy::armarx::RobotUnitInterface >
armarx::RobotUnitComponentPluginUser::getRobotUnitComponentPlugin
plugins::RobotUnitComponentPlugin & getRobotUnitComponentPlugin()
Definition: RobotUnitComponentPlugin.cpp:191
armarx::ArmarXWidgetController::getWidget
virtual QPointer< QWidget > getWidget()
getWidget returns a pointer to the a widget of this controller.
Definition: ArmarXWidgetController.cpp:54
armarx::RobotUnitComponentPluginUser::getRobotUnit
RobotUnitInterfacePrx getRobotUnit() const
Definition: RobotUnitComponentPlugin.cpp:185
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::SimpleConfigDialog
A config-dialog containing one (or multiple) proxy finders.
Definition: SimpleConfigDialog.h:84