Gazebo Gui

API Reference

9.0.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/gui/Plugin.hh>
24#include <gz/gui/qt.h>
25#include <gz/transport/Node.hh>
26#include <gz/utils/ImplPtr.hh>
27
28#ifndef _WIN32
29# define Teleop_EXPORTS_API __attribute__ ((visibility ("default")))
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
38namespace gz::gui::plugins
39{
46 class Teleop_EXPORTS_API Teleop : public Plugin
47 {
48 Q_OBJECT
49
51 Q_PROPERTY(
52 QString topic
53 READ Topic
54 WRITE SetTopic
55 NOTIFY TopicChanged
56 )
57
58
59 Q_PROPERTY(
60 double maxForwardVel
61 READ MaxForwardVel
62 WRITE SetMaxForwardVel
63 NOTIFY MaxForwardVelChanged
64 )
65
67 Q_PROPERTY(
68 double maxVerticalVel
69 READ MaxVerticalVel
70 WRITE SetMaxVerticalVel
71 NOTIFY MaxVerticalVelChanged
72 )
73
75 Q_PROPERTY(
76 double maxYawVel
77 READ MaxYawVel
78 WRITE SetMaxYawVel
79 NOTIFY MaxYawVelChanged
80 )
81
83 public: Teleop();
84
86 public: ~Teleop() override;
87
88 // Documentation inherited.
89 public: void LoadConfig(const tinyxml2::XMLElement *) override;
90
92 protected: bool eventFilter(QObject *_obj, QEvent *_event) override;
93
98 public slots: void OnTeleopTwist(double _forwardVel, double _verticalVel,
99 double _angVel);
100
104 public: Q_INVOKABLE QString Topic() const;
105
109 public slots: void SetTopic(const QString &_topic);
110
112 signals: void TopicChanged();
113
116 public: Q_INVOKABLE double MaxForwardVel() const;
117
120 public slots: void SetMaxForwardVel(double _velocity);
121
123 signals: void MaxForwardVelChanged();
124
127 public: Q_INVOKABLE double MaxVerticalVel() const;
128
131 public slots: void SetMaxVerticalVel(double _velocity);
132
134 signals: void MaxVerticalVelChanged();
135
138 public: Q_INVOKABLE double MaxYawVel() const;
139
142 public slots: void SetMaxYawVel(double _velocity);
143
145 signals: void MaxYawVelChanged();
146
149 public slots: void OnKeySwitch(bool _checked);
150
152 public: void SetKeyScale();
153
156 GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
157 };
158} // namespace gz::gui::plugins
159
160#endif // GZ_GUI_PLUGINS_TELEOP_HH_