occupancy_grid_display.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013, Willow Garage, Inc.
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  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  *
29  * Author: Julius Kammerl (jkammerl@willowgarage.com)
30  *
31  */
32 
33 #ifndef RVIZ_OCCUPANCY_GRID_DISPLAY_H
34 #define RVIZ_OCCUPANCY_GRID_DISPLAY_H
35 
36 #ifndef Q_MOC_RUN
37 #include <ros/ros.h>
38 
39 #include <boost/shared_ptr.hpp>
40 #include <boost/thread/mutex.hpp>
41 
43 
44 #include <octomap_msgs/Octomap.h>
45 
46 #include <octomap/OcTreeStamped.h>
47 #include <octomap/ColorOcTree.h>
48 
49 #include <rviz/display.h>
51 
52 #endif
53 
54 namespace rviz {
55 class RosTopicProperty;
56 class IntProperty;
57 class EnumProperty;
58 class FloatProperty;
59 }
60 
62 {
63 
65 {
66 Q_OBJECT
67 public:
69  virtual ~OccupancyGridDisplay();
70 
71  // Overrides from Display
72  virtual void onInitialize();
73  virtual void update(float wall_dt, float ros_dt);
74  virtual void reset();
75 
76 private Q_SLOTS:
77  void updateQueueSize();
78  void updateTopic();
79  void updateTreeDepth();
80  void updateOctreeRenderMode();
81  void updateOctreeColorMode();
82  void updateAlpha();
83  void updateMaxHeight();
84  void updateMinHeight();
85 
86 protected:
87  // overrides from Display
88  virtual void onEnable();
89  virtual void onDisable();
90 
91  void subscribe();
92  void unsubscribe();
93 
94  virtual void incomingMessageCallback(const octomap_msgs::OctomapConstPtr& msg) = 0;
95 
96  void setColor( double z_pos, double min_z, double max_z, double color_factor, rviz::PointCloud::Point& point);
97 
98  void clear();
99 
100  virtual bool updateFromTF();
101 
102  typedef std::vector<rviz::PointCloud::Point> VPoint;
103  typedef std::vector<VPoint> VVPoint;
104 
106 
107  boost::mutex mutex_;
108 
109  // point buffer
110  VVPoint new_points_;
111  VVPoint point_buf_;
113 
114  // Ogre-rviz point clouds
115  std::vector<rviz::PointCloud*> cloud_;
116  std::vector<double> box_size_;
117  std_msgs::Header header_;
118 
119  // Plugin properties
128 
129  u_int32_t queue_size_;
132 };
133 
134 template <typename OcTreeType>
136 protected:
137  void incomingMessageCallback(const octomap_msgs::OctomapConstPtr& msg);
138  void setVoxelColor(rviz::PointCloud::Point& newPoint, typename OcTreeType::NodeType& node, double minZ, double maxZ);
141  bool checkType(std::string type_id);
142 };
143 
144 } // namespace octomap_rviz_plugin
145 
146 #endif //RVIZ_OCCUPANCY_GRID_DISPLAY_H
std::vector< rviz::PointCloud * > cloud_
std::vector< rviz::PointCloud::Point > VPoint
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
boost::shared_ptr< message_filters::Subscriber< octomap_msgs::Octomap > > sub_
void subscribe()


octomap_rviz_plugins
Author(s): Julius Kammerl
autogenerated on Wed Jan 20 2021 03:10:00