VertexDataWidget.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 <QWidget>
25 
26 #include <Eigen/Core>
27 
29 
30 
31 class QLineEdit;
32 class QDoubleSpinBox;
33 class QPushButton;
34 class QRadioButton;
35 class QComboBox;
36 
38 {
39  class Connection;
40 }
41 
43 {
44  class Connection;
45 }
46 
48 {
49 
50  class VertexDataWidget : public QWidget
51  {
52  Q_OBJECT
53  using This = VertexDataWidget;
54 
55 
56  public:
58 
59 
60  std::optional<GuiGraph::Vertex> vertex();
61  void setVertex(GuiGraph::Vertex vertex);
62  void clearVertex();
63 
64  Eigen::Vector3d xyz() const;
65  Eigen::Vector3d rpyDeg() const;
66  Eigen::Vector3d rpyRad() const;
67  core::Pose_d pose() const;
68 
69 
70  void setRobotConnection(robotvisu::Connection* connection);
72 
73 
74  signals:
75 
76  void vertexDataChanged();
77 
78 
79  private slots:
80 
81  void _updateAngleUnit();
82  void _updateVertexAttribs();
83  void _updateVertexAgent();
84  void _updateVertexFrame();
85  void _removeInstance();
86 
87 
88  private:
89  void _setFromVertex(const GuiGraph::Vertex& vertex);
90  void _getToVertex(GuiGraph::Vertex& vertex);
91 
92  std::vector<QDoubleSpinBox*> _positionSpinBoxes();
93  std::vector<QDoubleSpinBox*> _angleSpinBoxes();
94  std::vector<QDoubleSpinBox*> _allSpinBoxes();
95 
96  void _setPose(const core::Pose_d& pose);
97  void _setXyz(const Eigen::Vector3d& xyz);
98 
99  Eigen::Vector3d _rpyRaw() const;
100  void _setRpyRaw(const Eigen::Vector3d& rpy) const;
101  void _setRpyDeg(const Eigen::Vector3d& rpyDeg) const;
102  void _setRpyRad(const Eigen::Vector3d& rpyRad) const;
103 
104  void _setFromCurrentRobotPose();
105 
106  void _loadFramedPoseFromVertex(const GuiGraph::Vertex& vertex);
107  void _updateAgentMenu();
108  void _updateFrameMenu();
109 
110  void _framedPoseCoordinateConversion();
111 
112 
113  private:
114  std::optional<GuiGraph::Vertex> _vertex;
115 
116 
117  QLineEdit* name = nullptr;
118  QLineEdit* locationID = nullptr;
119  QComboBox* agent = nullptr;
120  QComboBox* frame = nullptr;
121  QPushButton* removeInstanceButton = nullptr;
122 
123  QDoubleSpinBox* x = nullptr;
124  QDoubleSpinBox* y = nullptr;
125  QDoubleSpinBox* z = nullptr;
126 
127  QDoubleSpinBox* roll = nullptr;
128  QDoubleSpinBox* pitch = nullptr;
129  QDoubleSpinBox* yaw = nullptr;
130 
131  QRadioButton* angleUnitDeg = nullptr;
132  QRadioButton* angleUnitRad = nullptr;
133 
134 
135  robotvisu::Connection* _robotConnection = nullptr;
136  QPushButton* _useCurrentRobotPose = nullptr;
137 
138  objectposes::Connection* _objectPosesConnection = nullptr;
139  };
140 
141 } // namespace armarx::navigation::qt_plugins::location_graph_editor
armarx::navigation::qt_plugins::location_graph_editor::objectposes::Connection
Definition: ObjectPoseClientWidget.h:57
armarx::navigation::qt_plugins::location_graph_editor::robotvisu::Connection
Definition: RobotVisuWidget.h:92
armarx::navigation::qt_plugins::location_graph_editor::VertexDataWidget::rpyDeg
Eigen::Vector3d rpyDeg() const
Definition: VertexDataWidget.cpp:186
armarx::navigation::core::Pose_d
Eigen::Isometry3d Pose_d
Definition: basic_types.h:32
armarx::navigation::qt_plugins::location_graph_editor::VertexDataWidget::setRobotConnection
void setRobotConnection(robotvisu::Connection *connection)
Definition: VertexDataWidget.cpp:220
armarx::navigation::qt_plugins::location_graph_editor::VertexDataWidget::clearVertex
void clearVertex()
Definition: VertexDataWidget.cpp:173
armarx::navigation::qt_plugins::location_graph_editor::VertexDataWidget::setVertex
void setVertex(GuiGraph::Vertex vertex)
Definition: VertexDataWidget.cpp:163
armarx::navigation::qt_plugins::location_graph_editor::VertexDataWidget::vertexDataChanged
void vertexDataChanged()
armarx::navigation::qt_plugins::location_graph_editor::VertexDataWidget::xyz
Eigen::Vector3d xyz() const
Definition: VertexDataWidget.cpp:180
armarx::navigation::qt_plugins::location_graph_editor
Definition: GuiGraph.cpp:29
armarx::navigation::qt_plugins::location_graph_editor::VertexDataWidget::vertex
std::optional< GuiGraph::Vertex > vertex()
Definition: VertexDataWidget.cpp:157
armarx::navigation::qt_plugins::location_graph_editor::VertexDataWidget::setObjectPoseConnection
void setObjectPoseConnection(objectposes::Connection *connection)
Definition: VertexDataWidget.cpp:227
armarx::navigation::qt_plugins::location_graph_editor::VertexDataWidget::pose
core::Pose_d pose() const
Definition: VertexDataWidget.cpp:214
GuiGraph.h
armarx::navigation::qt_plugins::location_graph_editor::VertexDataWidget::VertexDataWidget
VertexDataWidget()
Definition: VertexDataWidget.cpp:55
armarx::navigation::qt_plugins::location_graph_editor::VertexDataWidget
Definition: VertexDataWidget.h:50
armarx::navigation::qt_plugins::location_graph_editor::VertexDataWidget::rpyRad
Eigen::Vector3d rpyRad() const
Definition: VertexDataWidget.cpp:200
armarx::navigation::qt_plugins::location_graph_editor::robotvisu
Definition: RobotVisuWidget.h:65
armarx::navigation::qt_plugins::location_graph_editor::objectposes
Definition: ObjectPoseClientWidget.h:54