Ignition Gui

API Reference

7.0.0~pre1
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 IGNITION_GUI_PLUGINS_TELEOP_HH_
19 #define IGNITION_GUI_PLUGINS_TELEOP_HH_
20 
21 #include <memory>
22 
24 
25 #include <ignition/gui/Plugin.hh>
26 #include <ignition/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 
52  class Teleop_EXPORTS_API Teleop : public Plugin
53  {
54  Q_OBJECT
55 
57  Q_PROPERTY(
58  int linearDir
59  READ LinearDirection
60  WRITE setLinearDirection
61  NOTIFY LinearDirectionChanged
62  )
63 
64 
65  Q_PROPERTY(
66  int angularDir
67  READ AngularDirection
68  WRITE setAngularDirection
69  NOTIFY AngularDirectionChanged
70  )
71 
73  public: Teleop();
74 
76  public: virtual ~Teleop();
77 
78  // Documentation inherited.
79  public: virtual void LoadConfig(const tinyxml2::XMLElement *) override;
80 
82  protected: bool eventFilter(QObject *_obj, QEvent *_event) override;
83 
85  public slots: void OnTeleopTwist();
86 
91  public: Q_INVOKABLE int LinearDirection() const;
92 
96  public: Q_INVOKABLE void setLinearDirection(int _linearDir);
97 
99  signals: void LinearDirectionChanged();
100 
105  public: Q_INVOKABLE int AngularDirection() const;
106 
110  public: Q_INVOKABLE void setAngularDirection(int _angularDir);
111 
113  signals: void AngularDirectionChanged();
114 
118  public slots: void OnTopicSelection(const QString &_topic);
119 
122  public slots: void OnLinearVelSelection(double _velocity);
123 
126  public slots: void OnAngularVelSelection(double _velocity);
127 
130  public slots: void OnKeySwitch(bool _checked);
131 
134  public slots: void OnSlidersSwitch(bool _checked);
135 
137  public: void SetKeyDirection();
138 
141  private: std::unique_ptr<TeleopPrivate> dataPtr;
142 
143  };
144 }
145 }
146 }
147 
148 #endif
#define Teleop_EXPORTS_API
Definition: Teleop.hh:29
STL namespace.
Definition: Application.hh:35
Base class for Ignition GUI plugins.
Definition: Plugin.hh:54