Gazebo Sim

API Reference

7.7.0
ApplyForceTorque.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 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 GZ_GUI_APPLYFORCETORQUE_HH_
19 #define GZ_GUI_APPLYFORCETORQUE_HH_
20 
21 #include <memory>
22 
23 #include <QString>
24 #include <QStringList>
25 #include <QObject>
26 #include <QEvent>
27 #include <QVector3D>
28 
30 #include <gz/sim/gui/GuiSystem.hh>
31 
32 namespace gz
33 {
34 namespace sim
35 {
36  class ApplyForceTorquePrivate;
37 
44  {
45  Q_OBJECT
46 
48  Q_PROPERTY(
49  QString modelName
50  READ ModelName
51  NOTIFY ModelNameChanged
52  )
53 
54 
55  Q_PROPERTY(
56  QStringList linkNameList
57  READ LinkNameList
58  NOTIFY LinkNameListChanged
59  )
60 
62  Q_PROPERTY(
63  int linkIndex
64  READ LinkIndex
65  WRITE SetLinkIndex
66  NOTIFY LinkIndexChanged
67  )
68 
70  Q_PROPERTY(
71  QVector3D force
72  READ Force
73  WRITE SetForce
74  NOTIFY ForceChanged
75  )
76 
78  Q_PROPERTY(
79  double forceMag
80  READ ForceMag
81  WRITE SetForceMag
82  NOTIFY ForceMagChanged
83  )
84 
86  Q_PROPERTY(
87  QVector3D torque
88  READ Torque
89  WRITE SetTorque
90  NOTIFY TorqueChanged
91  )
92 
94  Q_PROPERTY(
95  double torqueMag
96  READ TorqueMag
97  WRITE SetTorqueMag
98  NOTIFY TorqueMagChanged
99  )
100 
102  public: ApplyForceTorque();
103 
105  public: ~ApplyForceTorque() override;
106 
107  // Documentation inherited
108  public: void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override;
109 
110  // Documentation inherited
111  protected: bool eventFilter(QObject *_obj, QEvent *_event) override;
112 
113  // Documentation inherited
114  public: void Update(const UpdateInfo &_info,
115  EntityComponentManager &_ecm) override;
116 
119  public: Q_INVOKABLE QString ModelName() const;
120 
122  signals: void ModelNameChanged();
123 
126  public: Q_INVOKABLE QStringList LinkNameList() const;
127 
129  signals: void LinkNameListChanged();
130 
133  public: Q_INVOKABLE int LinkIndex() const;
134 
136  signals: void LinkIndexChanged();
137 
140  public: Q_INVOKABLE void SetLinkIndex(int _linkIndex);
141 
144  public: Q_INVOKABLE QVector3D Force() const;
145 
147  signals: void ForceChanged();
148 
151  public: Q_INVOKABLE void SetForce(QVector3D _force);
152 
155  public: Q_INVOKABLE double ForceMag() const;
156 
158  signals: void ForceMagChanged();
159 
163  public: Q_INVOKABLE void SetForceMag(double _forceMag);
164 
167  public: Q_INVOKABLE QVector3D Torque() const;
168 
170  signals: void TorqueChanged();
171 
174  public: Q_INVOKABLE void SetTorque(QVector3D _torque);
175 
178  public: Q_INVOKABLE double TorqueMag() const;
179 
181  signals: void TorqueMagChanged();
182 
186  public: Q_INVOKABLE void SetTorqueMag(double _torqueMag);
187 
192  public: Q_INVOKABLE void UpdateOffset(double _x, double _y, double _z);
193 
195  public: Q_INVOKABLE void ApplyForce();
196 
198  public: Q_INVOKABLE void ApplyTorque();
199 
201  public: Q_INVOKABLE void ApplyAll();
202 
205  private: std::unique_ptr<ApplyForceTorquePrivate> dataPtr;
206  };
207 }
208 }
209 
210 #endif