Gazebo Gui

API Reference

8.5.0
Teleop.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 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_PLUGINS_TELEOP_HH_
19 #define GZ_GUI_PLUGINS_TELEOP_HH_
20 
21 #include <memory>
22 
23 #include <gz/transport/Node.hh>
24 
25 #include <gz/gui/Plugin.hh>
26 #include <gz/gui/qt.h>
27 
28 #ifndef _WIN32
29 # define Teleop_EXPORTS_API
30 #else
31 # if (defined(Teleop_EXPORTS))
32 # define Teleop_EXPORTS_API __declspec(dllexport)
33 # else
34 # define Teleop_EXPORTS_API __declspec(dllimport)
35 # endif
36 #endif
37 
38 namespace gz::gui::plugins
39 {
40  class TeleopPrivate;
41 
51  class Teleop_EXPORTS_API Teleop : public Plugin
52  {
53  Q_OBJECT
54 
56  Q_PROPERTY(
57  QString topic
58  READ Topic
59  WRITE SetTopic
60  NOTIFY TopicChanged
61  )
62 
63 
64  Q_PROPERTY(
65  double maxForwardVel
66  READ MaxForwardVel
67  WRITE SetMaxForwardVel
68  NOTIFY MaxForwardVelChanged
69  )
70 
71 
72  Q_PROPERTY(
73  double maxVerticalVel
74  READ MaxVerticalVel
75  WRITE SetMaxVerticalVel
76  NOTIFY MaxVerticalVelChanged
77  )
78 
79 
80  Q_PROPERTY(
81  double maxYawVel
82  READ MaxYawVel
83  WRITE SetMaxYawVel
84  NOTIFY MaxYawVelChanged
85  )
86 
87 
88  public: Teleop();
89 
91  public: virtual ~Teleop();
92 
93  // Documentation inherited.
94  public: virtual void LoadConfig(const tinyxml2::XMLElement *) override;
95 
97  protected: bool eventFilter(QObject *_obj, QEvent *_event) override;
98 
103  public slots: void OnTeleopTwist(double _forwardVel, double _verticalVel,
104  double _angVel);
105 
109  public: Q_INVOKABLE QString Topic() const;
110 
114  public slots: void SetTopic(const QString &_topic);
115 
117  signals: void TopicChanged();
118 
121  public: Q_INVOKABLE double MaxForwardVel() const;
122 
125  public slots: void SetMaxForwardVel(double _velocity);
126 
128  signals: void MaxForwardVelChanged();
129 
132  public: Q_INVOKABLE double MaxVerticalVel() const;
133 
136  public slots: void SetMaxVerticalVel(double _velocity);
137 
139  signals: void MaxVerticalVelChanged();
140 
143  public: Q_INVOKABLE double MaxYawVel() const;
144 
147  public slots: void SetMaxYawVel(double _velocity);
148 
150  signals: void MaxYawVelChanged();
151 
154  public slots: void OnKeySwitch(bool _checked);
155 
157  public: void SetKeyScale();
158 
161  private: std::unique_ptr<TeleopPrivate> dataPtr;
162 
163  };
164 } // namespace gz::gui::plugins
165 
166 #endif // GZ_GUI_PLUGINS_TELEOP_HH_