Ignition Gazebo

API Reference

7.0.0~pre1
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 
25 #include "ignition/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 
40  class VisualizeLidar : public ignition::gazebo::GuiSystem
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 QStringList TopicList() const;
96 
100  public: Q_INVOKABLE void SetTopicList(const QStringList &_topicList);
101 
103  signals: void TopicListChanged();
104 
107  public: Q_INVOKABLE void OnTopic(const QString &_topicName);
108 
111  public: Q_INVOKABLE void UpdateNonHitting(bool _value);
112 
115  public: Q_INVOKABLE void DisplayVisual(bool _value);
116 
118  public: Q_INVOKABLE void OnRefresh();
119 
121  signals: void MinRangeChanged();
122 
124  signals: void MaxRangeChanged();
125 
128  public: Q_INVOKABLE QString MaxRange() const;
129 
132  public: Q_INVOKABLE QString MinRange() const;
133 
136  private: std::unique_ptr<VisualizeLidarPrivate> dataPtr;
137  };
138 }
139 }
140 }
141 #endif
Q_INVOKABLE QStringList TopicList() const
Get the topic list as a string.
bool eventFilter(QObject *_obj, QEvent *_event) override
Q_INVOKABLE void SetTopicList(const QStringList &_topicList)
Set the topic list from a string, for example &#39;ignition.msgs.StringMsg&#39;.
STL namespace.
Q_INVOKABLE void DisplayVisual(bool _value)
Set whether to display the lidar visual.
QStringList topicList
Topic list.
Definition: VisualizeLidar.hh:50
Q_INVOKABLE void OnTopic(const QString &_topicName)
Set topic to subscribe for LidarSensor data.
The EntityComponentManager constructs, deletes, and returns components and entities. A component can be of any class which inherits from components::BaseComponent.
Definition: EntityComponentManager.hh:66
Q_INVOKABLE QString MaxRange() const
Get the maximum range of the lidar sensor (in metres).
Q_INVOKABLE void UpdateType(int _type)
Set visual type of LidarVisual.
QString minRange
Min Range.
Definition: VisualizeLidar.hh:57
Q_INVOKABLE QString MinRange() const
Get the minimum range of the lidar sensor (in metres).
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 LoadConfig(const tinyxml2::XMLElement *_pluginElem) override
This library is part of the Ignition Robotics project.
Base class for a GUI System.
Definition: GuiSystem.hh:44
void OnScan(const msgs::LaserScan &_msg)
Callback function to get data from the message.
QString maxRange
Max Range.
Definition: VisualizeLidar.hh:64