Gazebo Gui

API Reference

7.2.2
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 
48  class Teleop_EXPORTS_API Teleop : public Plugin
49  {
50  Q_OBJECT
51 
53  Q_PROPERTY(
54  QString topic
55  READ Topic
56  WRITE SetTopic
57  NOTIFY TopicChanged
58  )
59 
60 
61  Q_PROPERTY(
62  double maxForwardVel
63  READ MaxForwardVel
64  WRITE SetMaxForwardVel
65  NOTIFY MaxForwardVelChanged
66  )
67 
69  Q_PROPERTY(
70  double maxVerticalVel
71  READ MaxVerticalVel
72  WRITE SetMaxVerticalVel
73  NOTIFY MaxVerticalVelChanged
74  )
75 
77  Q_PROPERTY(
78  double maxYawVel
79  READ MaxYawVel
80  WRITE SetMaxYawVel
81  NOTIFY MaxYawVelChanged
82  )
83 
85  public: Teleop();
86 
88  public: virtual ~Teleop();
89 
90  // Documentation inherited.
91  public: virtual void LoadConfig(const tinyxml2::XMLElement *) override;
92 
94  protected: bool eventFilter(QObject *_obj, QEvent *_event) override;
95 
100  public slots: void OnTeleopTwist(double _forwardVel, double _verticalVel,
101  double _angVel);
102 
106  public: Q_INVOKABLE QString Topic() const;
107 
111  public slots: void SetTopic(const QString &_topic);
112 
114  signals: void TopicChanged();
115 
118  public: Q_INVOKABLE double MaxForwardVel() const;
119 
122  public slots: void SetMaxForwardVel(double _velocity);
123 
125  signals: void MaxForwardVelChanged();
126 
129  public: Q_INVOKABLE double MaxVerticalVel() const;
130 
133  public slots: void SetMaxVerticalVel(double _velocity);
134 
136  signals: void MaxVerticalVelChanged();
137 
140  public: Q_INVOKABLE double MaxYawVel() const;
141 
144  public slots: void SetMaxYawVel(double _velocity);
145 
147  signals: void MaxYawVelChanged();
148 
151  public slots: void OnKeySwitch(bool _checked);
152 
154  public: void SetKeyScale();
155 
158  private: std::unique_ptr<TeleopPrivate> dataPtr;
159 
160  };
161 } // namespace gz::gui::plugins
162 
163 #endif // GZ_GUI_PLUGINS_TELEOP_HH_