Gazebo Sim

API Reference

9.0.0~pre1
gui/plugins/joint_position_controller/JointPositionController.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_SIM_GUI_JOINTPOSITIONCONTROLLER_HH_
19#define GZ_SIM_GUI_JOINTPOSITIONCONTROLLER_HH_
20
21#include <map>
22#include <memory>
23#include <string>
24
26#include <gz/sim/Types.hh>
27
28#ifndef _WIN32
29# define JointPositionController_EXPORTS_API \
30 __attribute__ ((visibility ("default")))
31#else
32# if (defined(JointPositionController_EXPORTS))
33# define JointPositionController_EXPORTS_API __declspec(dllexport)
34# else
35# define JointPositionController_EXPORTS_API __declspec(dllimport)
36# endif
37#endif
38
40
41namespace gz
42{
43namespace sim
44{
45namespace gui
46{
47 class JointPositionControllerPrivate;
48
50 class JointPositionController_EXPORTS_API JointsModel :
51 public QStandardItemModel
52 {
53 Q_OBJECT
54
56 public: explicit JointsModel();
57
59 public: ~JointsModel() override = default;
60
61 // Documentation inherited
62 public: QHash<int, QByteArray> roleNames() const override;
63
66 public: static QHash<int, QByteArray> RoleNames();
67
71 public slots: QStandardItem *AddJoint(Entity _entity);
72
75 public slots: void RemoveJoint(Entity _entity);
76
78 public slots: void Clear();
79
82 };
83
103 class JointPositionController_EXPORTS_API JointPositionController :
104 public sim::GuiSystem
105 {
106 Q_OBJECT
107
109 Q_PROPERTY(
110 Entity modelEntity
111 READ ModelEntity
112 WRITE SetModelEntity
113 NOTIFY ModelEntityChanged
114 )
115
116
117 Q_PROPERTY(
118 QString modelName
119 READ ModelName
120 WRITE SetModelName
121 NOTIFY ModelNameChanged
122 )
123
124
125 Q_PROPERTY(
126 bool locked
127 READ Locked
128 WRITE SetLocked
129 NOTIFY LockedChanged
130 )
131
132
133 public: JointPositionController();
134
136 public: ~JointPositionController() override;
137
138 // Documentation inherited
139 public: void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override;
140
141 // Documentation inherited
142 public: void Update(const UpdateInfo &, EntityComponentManager &) override;
143
147 public: Q_INVOKABLE void OnCommand(const QString &_jointName, double _pos);
148
150 public: Q_INVOKABLE void OnReset();
151
154 public: Q_INVOKABLE Entity ModelEntity() const;
155
158 public: Q_INVOKABLE void SetModelEntity(Entity _entity);
159
161 signals: void ModelEntityChanged();
162
165 public: Q_INVOKABLE QString ModelName() const;
166
169 public: Q_INVOKABLE void SetModelName(const QString &_name);
170
172 signals: void ModelNameChanged();
173
176 public: Q_INVOKABLE bool Locked() const;
177
180 public: Q_INVOKABLE void SetLocked(bool _locked);
181
183 signals: void LockedChanged();
184
185 // Documentation inherited
186 protected: bool eventFilter(QObject *_obj, QEvent *_event) override;
187
191 };
192}
193}
194}
195
196#endif