MapCloudDisplay.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef MAP_CLOUD_DISPLAY_H
29 #define MAP_CLOUD_DISPLAY_H
30 
31 #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
32 
33 #include <deque>
34 #include <queue>
35 #include <vector>
36 
37 #include <rtabmap_ros/MapData.h>
38 #include <rtabmap/core/Transform.h>
39 
40 #include <pluginlib/class_loader.h>
41 #include <sensor_msgs/PointCloud2.h>
42 
46 
47 #endif
48 
49 namespace rviz {
50 class IntProperty;
51 class BoolProperty;
52 class EnumProperty;
53 class FloatProperty;
56 typedef std::vector<std::string> V_string;
57 }
58 
59 using namespace rviz;
60 
61 namespace rtabmap_ros
62 {
63 
64 class PointCloudCommon;
65 
74 class MapCloudDisplay: public rviz::MessageFilterDisplay<rtabmap_ros::MapData>
75 {
76 Q_OBJECT
77 public:
78  struct CloudInfo
79  {
80  CloudInfo();
81  ~CloudInfo();
82 
83  // clear the point cloud, but keep selection handler around
84  void clear();
85 
86  Ogre::SceneManager *manager_;
87 
88  sensor_msgs::PointCloud2ConstPtr message_;
90  int id_;
91 
92  Ogre::SceneNode *scene_node_;
94 
95  std::vector<rviz::PointCloud::Point> transformed_points_;
96  };
98 
100  virtual ~MapCloudDisplay();
101 
102  virtual void reset();
103  virtual void update( float wall_dt, float ros_dt );
104 
121 
122 public Q_SLOTS:
123  void causeRetransform();
124 
125 private Q_SLOTS:
126  void updateStyle();
127  void updateBillboardSize();
128  void updateAlpha();
129  void updateXyzTransformer();
130  void updateColorTransformer();
131  void setXyzTransformerOptions( EnumProperty* prop );
132  void setColorTransformerOptions( EnumProperty* prop );
133  void updateCloudParameters();
134  void downloadMap();
135  void downloadGraph();
136 
137 protected:
139  virtual void onInitialize();
140 
142  virtual void processMessage( const rtabmap_ros::MapDataConstPtr& cloud );
143 
144 private:
145  void processMapData(const rtabmap_ros::MapData& map);
146 
150  bool transformCloud(const CloudInfoPtr& cloud, bool fully_update_transformers);
151 
152  rviz::PointCloudTransformerPtr getXYZTransformer(const sensor_msgs::PointCloud2ConstPtr& cloud);
153  rviz::PointCloudTransformerPtr getColorTransformer(const sensor_msgs::PointCloud2ConstPtr& cloud);
154  void updateTransformers( const sensor_msgs::PointCloud2ConstPtr& cloud );
155  void retransform();
156 
157  void loadTransformers();
158 
159  void setPropertiesHidden( const QList<Property*>& props, bool hide );
160  void fillTransformerOptions( rviz::EnumProperty* prop, uint32_t mask );
161 
162 private:
165 
166  std::map<int, CloudInfoPtr> cloud_infos_;
167 
168  std::map<int, CloudInfoPtr> new_cloud_infos_;
169  boost::mutex new_clouds_mutex_;
170 
171  std::map<int, rtabmap::Transform> current_map_;
172  boost::mutex current_map_mutex_;
173 
175  {
177  QList<Property*> xyz_props;
178  QList<Property*> color_props;
179 
180  std::string readable_name;
181  std::string lookup_name;
182  };
183  typedef std::map<std::string, TransformerInfo> M_TransformerInfo;
184 
185  boost::recursive_mutex transformers_mutex_;
186  M_TransformerInfo transformers_;
190 
192 };
193 
194 } // namespace rtabmap_ros
195 
196 #endif
GLM_FUNC_DECL genIType mask(genIType const &count)
rviz::EnumProperty * style_property_
pluginlib::ClassLoader< rviz::PointCloudTransformer > * transformer_class_loader_
Displays point clouds from rtabmap::MapData.
rviz::FloatProperty * cloud_voxel_size_
rviz::FloatProperty * cloud_max_depth_
std::map< std::string, TransformerInfo > M_TransformerInfo
bool update(const T &new_val, T &my_val)
rviz::IntProperty * cloud_decimation_
rviz::EnumProperty * xyz_transformer_property_
rviz::FloatProperty * cloud_filter_ceiling_height_
rviz::FloatProperty * alpha_property_
std::map< int, CloudInfoPtr > cloud_infos_
rviz::FloatProperty * point_pixel_size_property_
M_TransformerInfo transformers_
rviz::FloatProperty * node_filtering_radius_
std::map< int, rtabmap::Transform > current_map_
rviz::BoolProperty * download_map_
boost::shared_ptr< PointCloudTransformer > PointCloudTransformerPtr
rviz::PointCloudTransformerPtr transformer
sensor_msgs::PointCloud2ConstPtr message_
rviz::FloatProperty * node_filtering_angle_
rviz::FloatProperty * point_world_size_property_
boost::recursive_mutex transformers_mutex_
rviz::FloatProperty * cloud_min_depth_
std::map< int, CloudInfoPtr > new_cloud_infos_
boost::shared_ptr< rviz::PointCloud > cloud_
std::vector< std::string > V_string
detail::uint32 uint32_t
rviz::FloatProperty * cloud_filter_floor_height_
boost::shared_ptr< CloudInfo > CloudInfoPtr
rviz::EnumProperty * color_transformer_property_
std::vector< rviz::PointCloud::Point > transformed_points_
rviz::BoolProperty * download_graph_


rtabmap_ros
Author(s): Mathieu Labbe
autogenerated on Fri Jun 7 2019 21:55:03