Gazebo Gui

API Reference

3.12.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 ignition
39 {
40 namespace gui
41 {
42 namespace plugins
43 {
44  class TeleopPrivate;
45 
53  {
54  Q_OBJECT
55 
57  Q_PROPERTY(
58  QString topic
59  READ Topic
60  WRITE SetTopic
61  NOTIFY TopicChanged
62  )
63 
64 
65  Q_PROPERTY(
66  double maxForwardVel
67  READ MaxForwardVel
68  WRITE SetMaxForwardVel
69  NOTIFY MaxForwardVelChanged
70  )
71 
73  Q_PROPERTY(
74  double maxVerticalVel
75  READ MaxVerticalVel
76  WRITE SetMaxVerticalVel
77  NOTIFY MaxVerticalVelChanged
78  )
79 
81  Q_PROPERTY(
82  double maxYawVel
83  READ MaxYawVel
84  WRITE SetMaxYawVel
85  NOTIFY MaxYawVelChanged
86  )
87 
89  public: Teleop();
90 
92  public: virtual ~Teleop();
93 
94  // Documentation inherited.
95  public: virtual void LoadConfig(const tinyxml2::XMLElement *) override;
96 
98  protected: bool eventFilter(QObject *_obj, QEvent *_event) override;
99 
104  public slots: void OnTeleopTwist(double _forwardVel, double _verticalVel,
105  double _angVel);
106 
110  public: Q_INVOKABLE QString Topic() const;
111 
115  public slots: void SetTopic(const QString &_topic);
116 
118  signals: void TopicChanged();
119 
122  public: Q_INVOKABLE double MaxForwardVel() const;
123 
126  public slots: void SetMaxForwardVel(double _velocity);
127 
129  signals: void MaxForwardVelChanged();
130 
133  public: Q_INVOKABLE double MaxVerticalVel() const;
134 
137  public slots: void SetMaxVerticalVel(double _velocity);
138 
140  signals: void MaxVerticalVelChanged();
141 
144  public: Q_INVOKABLE double MaxYawVel() const;
145 
148  public slots: void SetMaxYawVel(double _velocity);
149 
151  signals: void MaxYawVelChanged();
152 
155  public slots: void OnKeySwitch(bool _checked);
156 
158  public: void SetKeyScale();
159 
162  private: std::unique_ptr<TeleopPrivate> dataPtr;
163 
164  };
165 }
166 }
167 }
168 
169 #endif
#define Teleop_EXPORTS_API
Definition: Teleop.hh:29
Publish teleop stokes to a user selected topic, or to '/cmd_vel' if no topic is selected....
Definition: Teleop.hh:52
Base class for Gazebo GUI plugins.
Definition: gz/gui/Plugin.hh:54
STL namespace.
Definition: gz/gui/Application.hh:35