Gazebo Gazebo

API Reference

6.16.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 IGNITION_GAZEBO_GUI_VISUALIZELIDAR_HH_
19 #define IGNITION_GAZEBO_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 ignition
28 {
29 namespace gazebo
30 {
31 // Inline bracket to help doxygen filtering.
32 inline namespace IGNITION_GAZEBO_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 
60  Q_PROPERTY(
61  QString maxRange
62  READ MaxRange
63  NOTIFY MaxRangeChanged
64  )
65 
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
Base class for a GUI System.
Definition: gz/sim/gui/GuiSystem.hh:44
void OnScan(const msgs::LaserScan &_msg)
Callback function to get data from the message.
void TopicListChanged()
Notify that topic list has changed.
bool eventFilter(QObject *_obj, QEvent *_event) override
This library is part of the Gazebo project.
The EntityComponentManager constructs, deletes, and returns components and entities....
Definition: gz/sim/EntityComponentManager.hh:66
Q_INVOKABLE void SetTopicList(const QStringList &_topicList)
Set the topic list from a string, for example 'ignition.msgs.StringMsg'.
QStringList topicList
Topic list.
Definition: VisualizeLidar.hh:50
Q_INVOKABLE QString MaxRange() const
Get the maximum range of the lidar sensor (in metres).
Q_INVOKABLE void OnTopic(const QString &_topicName)
Set topic to subscribe for LidarSensor data.
void MaxRangeChanged()
Notify that maximum range has changed.
Q_INVOKABLE void DisplayVisual(bool _value)
Set whether to display the lidar visual.
Information passed to systems on the update callback.
Definition: include/gz/sim/Types.hh:38
Q_INVOKABLE void UpdateType(int _type)
Set visual type of LidarVisual.
Q_INVOKABLE void OnRefresh()
Callback when refresh button is pressed.
QString minRange
Min Range.
Definition: VisualizeLidar.hh:57
void MinRangeChanged()
Notify that minimum range has changed.
Q_INVOKABLE void UpdateSize(int _size)
Set lidar visualization size.
Q_INVOKABLE void UpdateNonHitting(bool _value)
Set whether to display non-hitting rays.
void Update(const UpdateInfo &, EntityComponentManager &_ecm) override
Update callback called every time the system is stepped. This is called at an Ignition transport thre...
void LoadLidar()
Load the scene and attach LidarVisual to the scene.
Q_INVOKABLE QString MinRange() const
Get the minimum range of the lidar sensor (in metres).
Visualize the LaserScan message returned by the sensors. Use the checkbox to turn visualization of no...
Definition: VisualizeLidar.hh:40
STL namespace.
QString maxRange
Max Range.
Definition: VisualizeLidar.hh:64
Q_INVOKABLE QStringList TopicList() const
Get the topic list as a string.
void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override