RobotVisuWidget.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 * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
17 * @date 2021
18 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19 * GNU General Public License
20 */
21
22#pragma once
23
24#include <map>
25#include <memory>
26#include <optional>
27#include <string>
28
29#include <QWidget>
30#include <qobjectdefs.h>
31#include <qwidget.h>
32
33#include <Eigen/Core>
34
35#include <VirtualRobot/VirtualRobot.h>
36
38
39
40class QCheckBox;
41class QLabel;
42class QPushButton;
43
44namespace VirtualRobot
45{
46 using RobotPtr = std::shared_ptr<class Robot>;
47}
48
49namespace IceInternal
50{
51 template <typename T>
52 class ProxyHandle;
53}
54
55namespace IceProxy::armarx
56{
57 class RobotStateComponentInterface;
58}
59
60namespace armarx
61{
62 class ManagedIceObject;
65} // namespace armarx
66
67namespace armarx::viz
68{
69 class Robot;
70}
71
73{
74
75 class SettingsWidget : public QWidget
76 {
77 Q_OBJECT
78 using This = SettingsWidget;
79
80 public:
81 SettingsWidget(QWidget* parent = nullptr);
82
83
84 bool isEnabled() const;
85 bool useCollisionModel() const;
86
87
88 signals:
89
90 void changed();
91
92
93 private:
94 QCheckBox* _enabled = nullptr;
95 QCheckBox* _collisionModel = nullptr;
96 };
97
99 {
100 public:
102 robotvisu::SettingsWidget* settings);
103 ~Connection();
104
105
107 std::string getConnectedName() const;
108
109
110 core::Pose getGlobalPose(bool synchronize = true);
111 std::map<std::string, float> getJointValues(bool synchronize = true);
112
113 viz::Robot vizRobot(const std::string& id, bool synchronize = true);
114
115
116 private:
117 void _synchronize(bool synchronize);
118
119 std::unique_ptr<RobotStateComponentInterfacePrx> _robotStateComponent;
120 robotvisu::SettingsWidget* _settings = nullptr;
121
122 std::string _filename;
124 };
125
126} // namespace armarx::navigation::qt_plugins::location_graph_editor::robotvisu
127
129{
130
131 class RobotVisuWidget : public QWidget
132 {
133 Q_OBJECT
134 using This = RobotVisuWidget;
135
136 public:
137 RobotVisuWidget(ManagedIceObject& component, QWidget* parent = nullptr);
138
139
140 /// Indicates whether the connection is established and visu is enabled.
141 bool isEnabled() const;
142
143 bool isConnected() const;
145
146
147 signals:
148
149 void connected();
151
152
153 public slots:
154
155 void connectToRobot();
156
157
158 private:
159 ManagedIceObject& _component;
160 std::optional<robotvisu::Connection> _connection;
161
162 QLabel* _statusLabel = nullptr;
163 QPushButton* _connectButton = nullptr;
164 robotvisu::SettingsWidget* _settings = nullptr;
165 };
166
167} // namespace armarx::navigation::qt_plugins::location_graph_editor
The ManagedIceObject is the base class for all ArmarX objects.
RobotVisuWidget(ManagedIceObject &component, QWidget *parent=nullptr)
bool isEnabled() const
Indicates whether the connection is established and visu is enabled.
Connection(RobotStateComponentInterfacePrx robotStateComponent, robotvisu::SettingsWidget *settings)
std::map< std::string, float > getJointValues(bool synchronize=true)
viz::Robot vizRobot(const std::string &id, bool synchronize=true)
This file is part of ArmarX.
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
Eigen::Isometry3f Pose
Definition basic_types.h:31
This file is part of ArmarX.
This file offers overloads of toIce() and fromIce() functions for STL container types.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx