JointControlWidget.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-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 #ifndef _GAZEBO_GUI_JOINTCONTROLWIDGET_HH_
18 #define _GAZEBO_GUI_JOINTCONTROLWIDGET_HH_
19 
20 #include <memory>
21 #include <string>
22 #include "gazebo/gui/qt.h"
23 #include "gazebo/util/system.hh"
24 
25 namespace gazebo
26 {
27  namespace msgs
28  {
29  class Model;
30  }
31 
32  namespace gui
33  {
34  class JointControlWidgetPrivate;
35  class JointForceControl;
36  class JointForceControlPrivate;
37  class JointPIDPosControl;
38  class JointPIDPosControlPrivate;
39  class JointPIDVelControl;
40  class JointPIDVelControlPrivate;
41 
46  class GZ_GUI_VISIBLE JointControlWidget : public QWidget
47  {
48  Q_OBJECT
49 
52  public: JointControlWidget(QWidget *_parent = 0);
53 
55  public: virtual ~JointControlWidget();
56 
59  public: void SetModelName(const std::string &_modelName);
60 
62  private slots: void OnReset();
63 
67  private slots: void OnForceChanged(double _value,
68  const std::string &_name);
69 
73  private slots: void OnPIDPosChanged(double _value,
74  const std::string &_name);
75 
79  private slots: void OnPPosGainChanged(double _value,
80  const std::string &_name);
81 
85  private slots: void OnDPosGainChanged(double _value,
86  const std::string &_name);
87 
91  private slots: void OnIPosGainChanged(double _value,
92  const std::string &_name);
93 
97  private slots: void OnPIDVelChanged(double _value,
98  const std::string &_name);
99 
103  private slots: void OnPVelGainChanged(double _value,
104  const std::string &_name);
105 
109  private slots: void OnDVelGainChanged(double _value,
110  const std::string &_name);
111 
115  private slots: void OnIVelGainChanged(double _value,
116  const std::string &_name);
117 
120  private slots: void OnPIDPosUnitsChanged(int _index);
121 
126  private: void AddScrollTab(QTabWidget *_tabPane,
127  QGridLayout *_tabLayout,
128  const QString &_name);
129 
132  private: void LayoutForceTab(msgs::Model &_modelMsg);
133 
136  private: void LayoutPositionTab(msgs::Model &_modelMsg);
137 
140  private: void LayoutVelocityTab(msgs::Model &_modelMsg);
141 
144  private: std::unique_ptr<JointControlWidgetPrivate> dataPtr;
145  };
146 
149  class GZ_GUI_VISIBLE JointForceControl : public QWidget
150  {
151  Q_OBJECT
152 
158  public: JointForceControl(const std::string &_name,
159  QGridLayout *_layout, QWidget *_parent, int _index);
160 
162  public: virtual ~JointForceControl();
163 
165  public: void Reset();
166 
169  public slots: void OnChanged(double _value);
170 
175  Q_SIGNALS: void changed(double _value, const std::string &_name);
176 
179  private: std::unique_ptr<JointForceControlPrivate> dataPtr;
180  };
181 
185  class GZ_GUI_VISIBLE JointPIDPosControl : public QWidget
186  {
187  Q_OBJECT
188 
194  public: JointPIDPosControl(const std::string &_name,
195  QGridLayout *_layout, QWidget *_parent, int _index);
196 
198  public: virtual ~JointPIDPosControl();
199 
201  public: void Reset();
202 
204  public: void SetToRadians();
205 
207  public: void SetToDegrees();
208 
211  public slots: void OnChanged(double _value);
212 
215  public slots: void OnPChanged(double _value);
216 
219  public slots: void OnIChanged(double _value);
220 
223  public slots: void OnDChanged(double _value);
224 
229  Q_SIGNALS: void changed(double _value, const std::string &_name);
230 
235  Q_SIGNALS: void pChanged(double _value, const std::string &_name);
236 
241  Q_SIGNALS: void dChanged(double _value, const std::string &_name);
242 
247  Q_SIGNALS: void iChanged(double _value, const std::string &_name);
248 
251  private: std::unique_ptr<JointPIDPosControlPrivate> dataPtr;
252  };
253 
257  class GZ_GUI_VISIBLE JointPIDVelControl : public QWidget
258  {
259  Q_OBJECT
260 
266  public: JointPIDVelControl(const std::string &_name,
267  QGridLayout *_layout, QWidget *_parent, int _index);
268 
270  public: virtual ~JointPIDVelControl();
271 
273  public: void Reset();
274 
277  public slots: void OnChanged(double _value);
278 
281  public slots: void OnPChanged(double _value);
282 
285  public slots: void OnIChanged(double _value);
286 
289  public slots: void OnDChanged(double _value);
290 
295  Q_SIGNALS: void changed(double _value, const std::string &_name);
296 
301  Q_SIGNALS: void pChanged(double _value, const std::string &_name);
302 
307  Q_SIGNALS: void dChanged(double _value, const std::string &_name);
308 
313  Q_SIGNALS: void iChanged(double _value, const std::string &_name);
314 
317  private: std::unique_ptr<JointPIDVelControlPrivate> dataPtr;
318  };
319  }
320 }
321 #endif
Forward declarations for the common classes.
Definition: Animation.hh:33
Widget to control joints via application of position PID controller.
Definition: JointControlWidget.hh:185
Widget to control joints via application of a velocity PID controller.
Definition: JointControlWidget.hh:257
Widget to control joints via application of force.
Definition: JointControlWidget.hh:149
gui/JointControlWidget.hh
Definition: JointControlWidget.hh:46