ApplyWrenchDialog.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef _GAZEBO_APPLY_WRENCH_DIALOG_HH_
19 #define _GAZEBO_APPLY_WRENCH_DIALOG_HH_
20 
21 #include <string>
22 
23 #ifndef Q_MOC_RUN
25 #include "gazebo/gui/qt.h"
26 #include "gazebo/math/Vector3.hh"
28 #endif
29 
30 namespace gazebo
31 {
32  namespace gui
33  {
34  class ApplyWrenchDialogPrivate;
35 
38 
41  class GZ_GUI_VISIBLE ApplyWrenchDialog : public QDialog
42  {
43  Q_OBJECT
44 
47  public: enum Mode
48  {
50  NONE = 0,
52  FORCE = 1,
54  TORQUE = 2
55  };
56 
59  public: ApplyWrenchDialog(QWidget *_parent = 0);
60 
62  public: ~ApplyWrenchDialog();
63 
69  public: void Init(const std::string &_modelName,
70  const std::string &_linkName);
71 
73  public: void Fini();
74 
77  public: Mode GetMode() const;
78 
82  private: bool SetModel(const std::string &_modelName);
83 
87  private: bool SetLink(const std::string &_linkName);
88 
91  private slots: void SetLink(const QString _linkName);
92 
94  private slots: void OnApplyAll();
95 
97  private slots: void OnApplyForce();
98 
100  private slots: void OnApplyTorque();
101 
103  private slots: void OnCancel();
104 
107  private slots: void ToggleComRadio(bool _checked);
108 
111  private slots: void OnForcePosChanged(double _value);
112 
115  private slots: void OnForceMagChanged(double _magnitude);
116 
119  private slots: void OnForceChanged(double _value);
120 
122  private slots: void OnForceClear();
123 
126  private slots: void OnTorqueMagChanged(double _magnitude);
127 
130  private slots: void OnTorqueChanged(double _value);
131 
133  private slots: void OnTorqueClear();
134 
136  private slots: void OnManipulation();
137 
142  private slots: bool eventFilter(QObject *_object, QEvent *_event);
143 
146  private slots: void changeEvent(QEvent *_event);
147 
152  private: void SetSpinValue(QDoubleSpinBox *_spin, double _value);
153 
156  private: void SetForcePos(const math::Vector3 &_forcePos);
157 
161  private: void SetForce(const math::Vector3 &_force,
162  const bool _rotatedByMouse = false);
163 
167  private: void SetTorque(const math::Vector3 &_torque,
168  const bool _rotatedByMouse = false);
169 
172  private: void OnPreRender();
173 
175  private: void AttachVisuals();
176 
179  private: void SetCoM(const math::Vector3 &_com);
180 
184  private: bool OnMousePress(const common::MouseEvent &_event);
185 
189  private: bool OnMouseRelease(const common::MouseEvent &_event);
190 
194  private: bool OnMouseMove(const common::MouseEvent &_event);
195 
198  private: void SetMode(Mode _mode);
199 
203  private: void NewForceDirection(const math::Vector3 &_dir);
204 
208  private: void NewTorqueDirection(const math::Vector3 &_dir);
209 
213  private: void SetActive(bool _active);
214 
216  private: void ActivateWindow();
217 
220  private: ApplyWrenchDialogPrivate *dataPtr;
221  };
223  }
224 }
225 
226 #endif
Generic description of a mouse event.
Definition: MouseEvent.hh:35
Forward declarations for the common classes.
Definition: Animation.hh:33
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
Forward declarations for transport.
Mode
Definition: ApplyWrenchDialog.hh:47
Dialog for applying force and torque to a model.
Definition: ApplyWrenchDialog.hh:41
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.