Gazebo Sim

API Reference

8.7.0
VisualizeLidar.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 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_VISUALIZELIDAR_HH_
19 #define GZ_SIM_GUI_VISUALIZELIDAR_HH_
20 
21 #include <memory>
22 
23 #include "gz/msgs/laserscan.pb.h"
24 #include "gz/sim/gui/GuiSystem.hh"
25 #include "gz/gui/qt.h"
26 
27 namespace gz
28 {
29 namespace sim
30 {
31 // Inline bracket to help doxygen filtering.
32 inline namespace GZ_SIM_VERSION_NAMESPACE
33 {
34  class VisualizeLidarPrivate;
35 
41  {
42  Q_OBJECT
43 
45  Q_PROPERTY(
46  QStringList topicList
47  READ TopicList
48  WRITE SetTopicList
49  NOTIFY TopicListChanged
50  )
51 
52 
53  Q_PROPERTY(
54  QString minRange
55  READ MinRange
56  NOTIFY MinRangeChanged
57  )
58 
59 
60  Q_PROPERTY(
61  QString maxRange
62  READ MaxRange
63  NOTIFY MaxRangeChanged
64  )
65 
66 
67  public: VisualizeLidar();
68 
70  public: ~VisualizeLidar() override;
71 
72  // Documentation inherited
73  public: void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override;
74 
75  // Documentation Inherited
76  public: bool eventFilter(QObject *_obj, QEvent *_event) override;
77 
78  // Documentation inherited
79  public: void Update(const UpdateInfo &,
80  EntityComponentManager &_ecm) override;
81 
84  public: void OnScan(const msgs::LaserScan &_msg);
85 
87  public: void LoadLidar();
88 
91  public: Q_INVOKABLE void UpdateType(int _type);
92 
95  public: Q_INVOKABLE void UpdateSize(int _size);
96 
99  public: Q_INVOKABLE QStringList TopicList() const;
100 
104  public: Q_INVOKABLE void SetTopicList(const QStringList &_topicList);
105 
107  signals: void TopicListChanged();
108 
111  public: Q_INVOKABLE void OnTopic(const QString &_topicName);
112 
115  public: Q_INVOKABLE void UpdateNonHitting(bool _value);
116 
119  public: Q_INVOKABLE void DisplayVisual(bool _value);
120 
122  public: Q_INVOKABLE void OnRefresh();
123 
125  signals: void MinRangeChanged();
126 
128  signals: void MaxRangeChanged();
129 
132  public: Q_INVOKABLE QString MaxRange() const;
133 
136  public: Q_INVOKABLE QString MinRange() const;
137 
140  private: std::unique_ptr<VisualizeLidarPrivate> dataPtr;
141  };
142 }
143 }
144 }
145 #endif