ApplyWrenchDialog.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2016 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 
24 #include "gazebo/gui/qt.h"
25 #include "gazebo/math/Vector3.hh"
27 
28 namespace gazebo
29 {
30  namespace gui
31  {
32  class ApplyWrenchDialogPrivate;
33 
36 
39  class GZ_GUI_VISIBLE ApplyWrenchDialog : public QDialog
40  {
41  Q_OBJECT
42 
45  public: enum Mode
46  {
48  NONE = 0,
50  FORCE = 1,
52  TORQUE = 2
53  };
54 
57  public: ApplyWrenchDialog(QWidget *_parent = 0);
58 
60  public: ~ApplyWrenchDialog();
61 
67  public: void Init(const std::string &_modelName,
68  const std::string &_linkName);
69 
71  public: void Fini();
72 
75  public: Mode GetMode() const;
76 
80  private: bool SetModel(const std::string &_modelName);
81 
85  private: bool SetLink(const std::string &_linkName);
86 
89  private slots: void SetLink(const QString _linkName);
90 
92  private slots: void OnApplyAll();
93 
95  private slots: void OnApplyForce();
96 
98  private slots: void OnApplyTorque();
99 
101  private slots: void OnCancel();
102 
105  private slots: void ToggleComRadio(bool _checked);
106 
109  private slots: void OnForcePosChanged(double _value);
110 
113  private slots: void OnForceMagChanged(double _magnitude);
114 
117  private slots: void OnForceChanged(double _value);
118 
120  private slots: void OnForceClear();
121 
124  private slots: void OnTorqueMagChanged(double _magnitude);
125 
128  private slots: void OnTorqueChanged(double _value);
129 
131  private slots: void OnTorqueClear();
132 
134  private slots: void OnManipulation();
135 
140  private slots: bool eventFilter(QObject *_object, QEvent *_event);
141 
144  private slots: void changeEvent(QEvent *_event);
145 
150  private: void SetSpinValue(QDoubleSpinBox *_spin, double _value);
151 
154  private: void SetForcePos(const math::Vector3 &_forcePos);
155 
159  private: void SetForce(const math::Vector3 &_force,
160  const bool _rotatedByMouse = false);
161 
165  private: void SetTorque(const math::Vector3 &_torque,
166  const bool _rotatedByMouse = false);
167 
170  private: void OnPreRender();
171 
173  private: void AttachVisuals();
174 
177  private: void SetCoM(const math::Vector3 &_com);
178 
182  private: bool OnMousePress(const common::MouseEvent &_event);
183 
187  private: bool OnMouseRelease(const common::MouseEvent &_event);
188 
192  private: bool OnMouseMove(const common::MouseEvent &_event);
193 
196  private: void SetMode(Mode _mode);
197 
201  private: void NewForceDirection(const math::Vector3 &_dir);
202 
206  private: void NewTorqueDirection(const math::Vector3 &_dir);
207 
211  private: void SetActive(bool _active);
212 
214  private: void ActivateWindow();
215 
218  private: ApplyWrenchDialogPrivate *dataPtr;
219  };
221  }
222 }
223 
224 #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:45
Dialog for applying force and torque to a model.
Definition: ApplyWrenchDialog.hh:39
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.