00001 /****************************************************************************** 00002 * \file 00003 * 00004 * $Id:$ 00005 * 00006 * Copyright (C) Brno University of Technology 00007 * 00008 * This file is part of software developed by dcgm-robotics@FIT group. 00009 * 00010 * Author: Vit Stancl (stancl@fit.vutbr.cz) 00011 * Supervised by: Michal Spanel (spanel@fit.vutbr.cz) 00012 * Date: dd/mm/2012 00013 * 00014 * This file is free software: you can redistribute it and/or modify 00015 * it under the terms of the GNU Lesser General Public License as published by 00016 * the Free Software Foundation, either version 3 of the License, or 00017 * (at your option) any later version. 00018 * 00019 * This file is distributed in the hope that it will be useful, 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 * GNU Lesser General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public License 00025 * along with this file. If not, see <http://www.gnu.org/licenses/>. 00026 */ 00027 #pragma once 00028 #ifndef IMarkersPlugin_H_included 00029 #define IMarkersPlugin_H_included 00030 00031 #include <srs_env_model/but_server/server_tools.h> 00032 #include <srs_env_model/AddPlanes.h> 00033 #include <srs_env_model_msgs/PlaneDesc.h> 00034 00035 #include <srs_interaction_primitives/plane.h> 00036 #include <srs_interaction_primitives/services_list.h> 00037 #include <srs_interaction_primitives/RemovePrimitive.h> 00038 #include <srs_interaction_primitives/AddPlane.h> 00039 00040 #include <message_filters/subscriber.h> 00041 #include <tf/message_filter.h> 00042 00043 namespace srs_env_model 00044 { 00045 00046 class CIMarkersPlugin : public CServerPluginBase 00047 { 00048 public: 00049 typedef boost::shared_ptr<interactive_markers::InteractiveMarkerServer> InteractiveMarkerServerPtr; 00050 00051 public: 00053 CIMarkersPlugin(const std::string & name); 00054 00056 virtual ~CIMarkersPlugin(); 00057 00059 virtual void init(ros::NodeHandle & node_handle); 00060 00061 00062 protected: 00068 bool insertPlaneCallback( srs_env_model::AddPlanes::Request & req, srs_env_model::AddPlanes::Response & res ); 00069 00075 void operatePlane( const srs_env_model_msgs::PlaneDesc & plane ); 00076 00082 void addPlaneSrvCall( const srs_env_model_msgs::PlaneDesc & plane, const std::string & name ); 00083 00089 void removePlaneSrvCall( const srs_env_model_msgs::PlaneDesc & plane, const std::string & name ); 00090 00094 std::string getUniqueName(); 00095 00097 virtual bool shouldPublish(){ return false; } 00098 00100 virtual void publishInternal( const ros::Time & timestamp ){} 00101 00102 protected: 00104 ros::ServiceServer m_serviceInsertPlanes; 00105 00107 ros::ServiceClient m_removeInteractiveMarkerService; 00108 00110 ros::ServiceClient m_addInteractivePlaneService; 00111 00113 std::string m_IMarkersFrameId; 00114 00116 srs_interaction_primitives::InteractiveMarkerServerPtr m_imServer; 00117 00118 // DETECTED ENTITIES 00120 typedef std::pair< std::string, srs_env_model_msgs::PlaneDesc > tNamedPlane; 00121 typedef std::map< int, tNamedPlane > tPlanesMap; 00122 tPlanesMap m_dataPlanes; 00123 00125 std::string m_planesFrameId; 00126 00128 std::string m_serverTopicName; 00129 00131 long int m_uniqueNameCounter; 00132 00134 bool m_bUseExternalServer; 00135 00136 00137 }; // class CIMarkersPlugin 00138 00139 00140 } // namespace srs_env_model 00141 00142 00143 00144 // namespace srs_env_model 00145 00146 00147 // IMarkersPlugin_H_included 00148 #endif 00149