$search
00001 /**************************************************************** 00002 * 00003 * Copyright (c) 2010 00004 * 00005 * Fraunhofer Institute for Manufacturing Engineering 00006 * and Automation (IPA) 00007 * 00008 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00009 * 00010 * Project name: care-o-bot 00011 * ROS stack name: cob_environment_perception_intern 00012 * ROS package name: cob_3d_mapping_common 00013 * Description: 00014 * 00015 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00016 * 00017 * Author: Author: Waqas Tanveer, email:Waqas.Tanveer@ipa.fhg.de 00018 * Supervised by: Georg Arbeiter, email:georg.arbeiter@ipa.fhg.de 00019 * 00020 * Date of creation: 04/2012 00021 * ToDo: 00022 * 00023 * 00024 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00025 * 00026 * Redistribution and use in source and binary forms, with or without 00027 * modification, are permitted provided that the following conditions are met: 00028 * 00029 * * Redistributions of source code must retain the above copyright 00030 * notice, this list of conditions and the following disclaimer. 00031 * * Redistributions in binary form must reproduce the above copyright 00032 * notice, this list of conditions and the following disclaimer in the 00033 * documentation and/or other materials provided with the distribution. 00034 * * Neither the name of the Fraunhofer Institute for Manufacturing 00035 * Engineering and Automation (IPA) nor the names of its 00036 * contributors may be used to endorse or promote products derived from 00037 * this software without specific prior written permission. 00038 * 00039 * This program is free software: you can redistribute it and/or modify 00040 * it under the terms of the GNU Lesser General Public License LGPL as 00041 * published by the Free Software Foundation, either version 3 of the 00042 * License, or (at your option) any later version. 00043 * 00044 * This program is distributed in the hope that it will be useful, 00045 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00046 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00047 * GNU Lesser General Public License LGPL for more details. 00048 * 00049 * You should have received a copy of the GNU Lesser General Public 00050 * License LGPL along with this program. 00051 * If not, see <http://www.gnu.org/licenses/>. 00052 * 00053 ****************************************************************/ 00054 00055 #ifndef SHAPE_VISUALIZATION_H_ 00056 #define SHAPE_VISUALIZATION_H_ 00057 00058 //################## 00059 //#### includes #### 00060 // standard includes 00061 #include <stdio.h> 00062 #include <sstream> 00063 00064 // ROS includes 00065 #include <ros/ros.h> 00066 //#include <sensor_msgs/PointCloud2.h> 00067 #include <visualization_msgs/Marker.h> 00068 #include <visualization_msgs/MarkerArray.h> 00069 #include <visualization_msgs/InteractiveMarker.h> 00070 #include <visualization_msgs/InteractiveMarkerControl.h> 00071 #include <interactive_markers/interactive_marker_server.h> 00072 #include <interactive_markers/menu_handler.h> 00073 #include <cob_3d_mapping_msgs/ModifyMap.h> 00074 #include <cob_3d_visualization/shape_marker.h> 00075 //#include <cob_3d_visualization/table_marker.h> 00076 #include <cob_3d_mapping_msgs/GetTables.h> 00077 #include <cob_3d_mapping_msgs/GetObjectsOfClass.h> 00078 #include <tf/transform_listener.h> 00079 00080 00081 00082 00083 #include <boost/shared_ptr.hpp> 00084 00085 00086 class ShapeVisualization 00087 { 00088 public: 00089 // Constructor 00090 ShapeVisualization () ; 00091 // Destructor 00092 ~ShapeVisualization () 00093 { 00095 } 00101 void shapeArrayCallback (const cob_3d_mapping_msgs::ShapeArrayPtr& sa) ; 00106 void setShapePosition(const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback); 00110 void moreOptions(); 00116 void displayAllNormals(const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback); 00122 void displayAllCentroids (const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback) ; 00128 void displayAllContours (const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback); 00133 void resetAll(const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback) ; 00138 void applyModifications (const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback) ; 00142 void optionMenu() ; 00143 // void findTables(const visualization_msgs::InteractiveMarkerFeedbackConstPtr& feedback); 00144 00145 protected: 00146 00147 ros::NodeHandle nh_; 00148 // ros::Publisher shape_pub_ ; 00149 ros::Subscriber shape_array_sub_; // sub for shape array msgs 00150 ros::Subscriber feedback_sub_ ; 00151 ros::Publisher marker_pub_; 00152 std::vector<boost::shared_ptr<ShapeMarker> > v_sm_; 00153 cob_3d_mapping_msgs::ShapeArray sha ; 00154 interactive_markers::MenuHandler menu_handler_for_text_; 00155 00156 int ctr_for_shape_indexes; 00157 std::vector<unsigned int> moved_shapes_indices_; 00158 std::vector<unsigned int> interacted_shapes_; 00159 std::vector<unsigned int> deleted_markers_indices_; 00160 cob_3d_mapping_msgs::ShapeArray modified_shapes_; 00161 // unsigned int deleted_ ; 00162 00163 00164 Eigen::Quaternionf quatInit ; 00165 Eigen::Vector3f oldCentroid ; 00166 Eigen::Matrix4f transInit; 00167 Eigen::Affine3f affineInit; 00168 Eigen::Matrix4f transInitInv; 00169 // cob_3d_mapping_msgs::ModifyMap::Request req ; 00170 // cob_3d_mapping_msgs::ModifyMap::Response res; 00171 00172 00173 00174 boost::shared_ptr<interactive_markers::InteractiveMarkerServer> im_server_; // server for interactive markers 00175 00176 }; 00177 00178 00179 #endif /* SHAPE_VISUALIZATION_H_ */