nav_grid_display.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2020, Locus Robotics
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef ROBOT_NAV_RVIZ_PLUGINS_NAV_GRID_DISPLAY_H
36 #define ROBOT_NAV_RVIZ_PLUGINS_NAV_GRID_DISPLAY_H
37 
38 #ifndef Q_MOC_RUN
39 #include <OgreTexture.h>
40 #include <OgreMaterial.h>
41 #include <OgreSharedPtr.h>
42 #endif
43 
49 #include <rviz/display.h>
50 
52 
55 #include <pluginlib/class_loader.h>
56 
57 #include <string>
58 #include <vector>
59 
61 {
72 {
73 Q_OBJECT
74 public:
84  explicit NavGridDisplay(const std::string& data_type, bool include_ignore_property = false);
85  virtual ~NavGridDisplay();
86 
91  void reset() override;
92  void setTopic(const QString &topic, const QString &datatype) override;
93  void update(float wall_dt, float ros_dt) override;
98 Q_SIGNALS:
102  void mapUpdated(const nav_core2::UIntBounds& updated_bounds);
103 
104 protected Q_SLOTS:
109  void updateAlpha();
110  void updateTopic();
111  void updatePalette();
112  void showMap(const nav_core2::UIntBounds& updated_bounds);
113  virtual void updateIgnoreType();
114  virtual void updateIgnore() {}
119 protected:
120  enum struct IgnoreType {NONE, VALUE, LIMIT};
122 
127  void onInitialize() override;
128  void fixedFrameChanged() override;
129  void onEnable() override;
130  void onDisable() override;
140  void subscribe();
141 
146  virtual void onSubscribe(const std::string& topic) {}
147 
153  void unsubscribe();
154 
158  virtual void onUnsubscribe() {}
159 
163  void clear();
164 
168  void transformMap();
169 
170  // The Actual Display Object
171  // Note it has to be a pointer for lazy initialization
173 
174  // Data
177 
178  // Non-editiable properties
182 
183  // Editable Properties
189 
190  // Properties only used by some subclasses (see constructor)
193 
194  // Color Scheme Management
195  std::vector<std::string> color_scheme_names_;
197 };
198 
199 } // namespace robot_nav_rviz_plugins
200 
201 #endif // ROBOT_NAV_RVIZ_PLUGINS_NAV_GRID_DISPLAY_H
robot_nav_rviz_plugins::NavGridDisplay::color_scheme_property_
rviz::EnumProperty * color_scheme_property_
Definition: nav_grid_display.h:188
rviz::EnumProperty::getOptionInt
virtual int getOptionInt()
rviz::RosTopicProperty
robot_nav_rviz_plugins
Several reusable pieces for displaying polygons.
Definition: nav_grid_display.h:60
class_loader.h
robot_nav_rviz_plugins::NavGridDisplay::palette_loader_
pluginlib::ClassLoader< NavGridPalette > palette_loader_
Definition: nav_grid_display.h:196
robot_nav_rviz_plugins::NavGridDisplay::onUnsubscribe
virtual void onUnsubscribe()
Actual unsubscription logic, called by unsubscribe.
Definition: nav_grid_display.h:158
robot_nav_rviz_plugins::NavGridDisplay::unsubscribe
void unsubscribe()
Called to trigger unsubscribing.
Definition: nav_grid_display.cpp:286
robot_nav_rviz_plugins::OgrePanel::Ptr
std::shared_ptr< OgrePanel > Ptr
Definition: ogre_panel.h:113
rviz::BoolProperty
int_property.h
robot_nav_rviz_plugins::NavGridDisplay::update
void update(float wall_dt, float ros_dt) override
Definition: nav_grid_display.cpp:159
robot_nav_rviz_plugins::NavGridDisplay::mapUpdated
void mapUpdated(const nav_core2::UIntBounds &updated_bounds)
Custom signal emitted when new map data is received.
robot_nav_rviz_plugins::NavGridDisplay::alpha_property_
rviz::FloatProperty * alpha_property_
Definition: nav_grid_display.h:185
enum_property.h
robot_nav_rviz_plugins::NavGridDisplay
Displays a nav_grid (of unspecified type) along the XY plane.
Definition: nav_grid_display.h:71
robot_nav_rviz_plugins::NavGridDisplay::updateTopic
void updateTopic()
Definition: nav_grid_display.cpp:179
display.h
robot_nav_rviz_plugins::NavGridDisplay::onEnable
void onEnable() override
Definition: nav_grid_display.cpp:135
robot_nav_rviz_plugins::NavGridDisplay::onInitialize
void onInitialize() override
Definition: nav_grid_display.cpp:115
robot_nav_rviz_plugins::NavGridDisplay::width_property_
rviz::IntProperty * width_property_
Definition: nav_grid_display.h:180
robot_nav_rviz_plugins::NavGridDisplay::color_scheme_names_
std::vector< std::string > color_scheme_names_
Definition: nav_grid_display.h:195
float_property.h
ogre_panel.h
robot_nav_rviz_plugins::NavGridDisplay::onSubscribe
virtual void onSubscribe(const std::string &topic)
Actual subscription logic, called by subscribe.
Definition: nav_grid_display.h:146
robot_nav_rviz_plugins::NavGridDisplay::IgnoreType::VALUE
@ VALUE
robot_nav_rviz_plugins::NavGridDisplay::NavGridDisplay
NavGridDisplay(const std::string &data_type, bool include_ignore_property=false)
Constructor for the display.
Definition: nav_grid_display.cpp:53
rviz::Display
robot_nav_rviz_plugins::NavGridDisplay::updatePalette
void updatePalette()
Definition: nav_grid_display.cpp:186
rviz::EnumProperty
rviz::FloatProperty
robot_nav_rviz_plugins::NavGridDisplay::cached_info_
nav_grid::NavGridInfo cached_info_
Definition: nav_grid_display.h:176
robot_nav_rviz_plugins::NavGridDisplay::~NavGridDisplay
virtual ~NavGridDisplay()
Definition: nav_grid_display.cpp:106
vector_nav_grid.h
robot_nav_rviz_plugins::NavGridDisplay::IgnoreType
IgnoreType
Definition: nav_grid_display.h:120
robot_nav_rviz_plugins::NavGridDisplay::updateIgnoreType
virtual void updateIgnoreType()
Definition: nav_grid_display.cpp:243
bool_property.h
robot_nav_rviz_plugins::NavGridDisplay::updateAlpha
void updateAlpha()
Definition: nav_grid_display.cpp:174
robot_nav_rviz_plugins::NavGridDisplay::panel_data_
nav_grid::VectorNavGrid< unsigned char > panel_data_
Definition: nav_grid_display.h:175
robot_nav_rviz_plugins::NavGridDisplay::unreliable_property_
rviz::BoolProperty * unreliable_property_
Definition: nav_grid_display.h:186
robot_nav_rviz_plugins::NavGridDisplay::ignore_property_
rviz::FloatProperty * ignore_property_
Definition: nav_grid_display.h:192
robot_nav_rviz_plugins::NavGridDisplay::subscribe
void subscribe()
Called to trigger subscription, handles empty topics setting status.
Definition: nav_grid_display.cpp:262
pluginlib::ClassLoader
robot_nav_rviz_plugins::NavGridDisplay::panel_display_
OgrePanel::Ptr panel_display_
Definition: nav_grid_display.h:172
nav_grid::NavGridInfo
robot_nav_rviz_plugins::NavGridDisplay::showMap
void showMap(const nav_core2::UIntBounds &updated_bounds)
Definition: nav_grid_display.cpp:193
robot_nav_rviz_plugins::NavGridDisplay::transformMap
void transformMap()
Put the map in its proper place.
Definition: nav_grid_display.cpp:297
robot_nav_rviz_plugins::NavGridDisplay::draw_behind_property_
rviz::BoolProperty * draw_behind_property_
Definition: nav_grid_display.h:187
robot_nav_rviz_plugins::NavGridDisplay::clear
void clear()
Clear the data and remove the objects from the screen.
Definition: nav_grid_display.cpp:291
robot_nav_rviz_plugins::NavGridDisplay::IgnoreType::LIMIT
@ LIMIT
robot_nav_rviz_plugins::NavGridDisplay::IgnoreType::NONE
@ NONE
datatype
const char * datatype()
robot_nav_rviz_plugins::NavGridDisplay::reset
void reset() override
Definition: nav_grid_display.cpp:146
robot_nav_rviz_plugins::NavGridDisplay::getIgnoreType
IgnoreType getIgnoreType() const
Definition: nav_grid_display.h:121
robot_nav_rviz_plugins::NavGridDisplay::height_property_
rviz::IntProperty * height_property_
Definition: nav_grid_display.h:181
robot_nav_rviz_plugins::NavGridDisplay::onDisable
void onDisable() override
Definition: nav_grid_display.cpp:140
robot_nav_rviz_plugins::NavGridDisplay::topic_property_
rviz::RosTopicProperty * topic_property_
Definition: nav_grid_display.h:184
robot_nav_rviz_plugins::NavGridDisplay::fixedFrameChanged
void fixedFrameChanged() override
Definition: nav_grid_display.cpp:165
robot_nav_rviz_plugins::NavGridDisplay::resolution_property_
rviz::FloatProperty * resolution_property_
Definition: nav_grid_display.h:179
robot_nav_rviz_plugins::NavGridDisplay::updateIgnore
virtual void updateIgnore()
Definition: nav_grid_display.h:114
nav_core2::UIntBounds
nav_grid_palette.h
ros_topic_property.h
nav_grid::VectorNavGrid< unsigned char >
robot_nav_rviz_plugins::NavGridDisplay::ignore_type_property_
rviz::EnumProperty * ignore_type_property_
Definition: nav_grid_display.h:191
robot_nav_rviz_plugins::NavGridDisplay::setTopic
void setTopic(const QString &topic, const QString &datatype) override
Definition: nav_grid_display.cpp:154
rviz::IntProperty


robot_nav_rviz_plugins
Author(s):
autogenerated on Sun May 18 2025 02:47:50