00001 /****************************************************************************** 00002 * * 00003 * octree_pa_node.h * 00004 * ================ * 00005 * * 00006 ******************************************************************************* 00007 * * 00008 * github repository * 00009 * https://github.com/TUC-ProAut/ros_octomap * 00010 * * 00011 * Chair of Automation Technology, Technische Universität Chemnitz * 00012 * https://www.tu-chemnitz.de/etit/proaut * 00013 * * 00014 ******************************************************************************* 00015 * * 00016 * New BSD License * 00017 * * 00018 * Copyright (c) 2015-2018, Peter Weissig, Technische Universität Chemnitz * 00019 * All rights reserved. * 00020 * * 00021 * Redistribution and use in source and binary forms, with or without * 00022 * modification, are permitted provided that the following conditions are met: * 00023 * * Redistributions of source code must retain the above copyright * 00024 * notice, this list of conditions and the following disclaimer. * 00025 * * Redistributions in binary form must reproduce the above copyright * 00026 * notice, this list of conditions and the following disclaimer in the * 00027 * documentation and/or other materials provided with the distribution. * 00028 * * Neither the name of the Technische Universität Chemnitz nor the * 00029 * names of its contributors may be used to endorse or promote products * 00030 * derived from this software without specific prior written permission. * 00031 * * 00032 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * 00033 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * 00034 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * 00035 * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * 00036 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * 00037 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * 00038 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * 00039 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * 00040 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * 00041 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * 00042 * DAMAGE. * 00043 * * 00044 ******************************************************************************/ 00045 00046 #ifndef __OCTREE_PA_NODE_H 00047 #define __OCTREE_PA_NODE_H 00048 00049 // local headers 00050 #include "octomap_pa/octree_pa_ros.h" 00051 #include "octomap_pa/octree_base_pa_node_parameter.h" 00052 #include "octomap_pa/addcloud_parameter.h" 00053 00054 #include "octomap_pa/OctomapPaFileName.h" 00055 #include "octomap_pa/OctomapPaGetSize.h" 00056 00057 // ros headers 00058 #include <ros/ros.h> 00059 00060 #include <geometry_msgs/Point.h> 00061 #include <sensor_msgs/PointCloud.h> 00062 #include <sensor_msgs/PointCloud2.h> 00063 #include <nav_msgs/Path.h> 00064 #include <std_srvs/Empty.h> 00065 00066 #include <tf/transform_listener.h> 00067 00068 #include <octomap_msgs/Octomap.h> 00069 00070 #include <parameter_pa/parameter_pa_ros.h> 00071 00072 // additional libraries 00073 #include <pcl/point_types.h> 00074 00075 #include <octomap/octomap.h> 00076 00077 // standard headers 00078 #include <string> 00079 #include <vector> 00080 00081 //**************************[cOctreePaNode]************************************ 00082 class cOctreePaNode : public cOctreePaRos { 00083 public: 00085 cOctreePaNode(); 00086 00088 ~cOctreePaNode(); 00089 00091 void publishOctomap(void); 00092 00093 protected: 00094 00096 cOctreeBasePaNodeParameter nodeparams_; 00097 cAddCloudParameter addparams_ ; 00098 00100 int count_cloud_; 00102 int count_cloud_old_; 00104 int count_laser_; 00105 00107 ros::NodeHandle nh_; 00108 00110 tf::TransformListener tf_listener_; 00111 00112 00114 ros::Subscriber sub_cloud_; 00116 void addPointcloudCallbackSub( 00117 const sensor_msgs::PointCloud2ConstPtr &msg); 00118 00120 ros::Subscriber sub_cloud_old_; 00122 void addPointcloudOldCallbackSub( 00123 const sensor_msgs::PointCloudConstPtr &msg); 00124 00126 ros::Subscriber sub_laser_; 00128 void addLaserCallbackSub(const sensor_msgs::LaserScanConstPtr &msg); 00129 00131 ros::Publisher pub_octomap_; 00133 ros::Publisher pub_octomap_full_; 00135 ros::Publisher pub_cloud_free_; 00137 ros::Publisher pub_cloud_occupied_; 00138 00139 00141 ros::ServiceServer srv_clear_; 00142 bool clearCallbackSrv(std_srvs::Empty::Request &req, 00143 std_srvs::Empty::Response &res); 00144 00146 ros::ServiceServer srv_getsize_; 00147 bool getSizeCallbackSrv( 00148 octomap_pa::OctomapPaGetSize::Request &req, 00149 octomap_pa::OctomapPaGetSize::Response &res); 00151 ros::ServiceServer srv_save_; 00152 bool saveCallbackSrv( 00153 octomap_pa::OctomapPaFileName::Request &req, 00154 octomap_pa::OctomapPaFileName::Response &res); 00156 ros::ServiceServer srv_load_; 00157 bool loadCallbackSrv( 00158 octomap_pa::OctomapPaFileName::Request &req, 00159 octomap_pa::OctomapPaFileName::Response &res); 00160 }; 00161 00162 #endif // __OCTREE_PA_NODE_H