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 MarkerArrayPlugin_H_included 00029 #define MarkerArrayPlugin_H_included 00030 00031 #include <srs_env_model/but_server/server_tools.h> 00032 00033 #include <visualization_msgs/MarkerArray.h> 00034 #include <message_filters/subscriber.h> 00035 #include <tf/message_filter.h> 00036 00037 namespace srs_env_model 00038 { 00039 00040 class CMarkerArrayPlugin : public CServerPluginBase, public COctomapCrawlerBase<tButServerOcTree::NodeType>, public CDataHolderBase< visualization_msgs::MarkerArray > 00041 { 00042 public: 00044 CMarkerArrayPlugin(const std::string & name); 00045 00047 virtual ~CMarkerArrayPlugin(); 00048 00050 void enable( bool enabled ){ m_publishMarkerArray = enabled; } 00051 00053 virtual void init(ros::NodeHandle & node_handle); 00054 00056 virtual void pause( bool bPause, ros::NodeHandle & node_handle ); 00057 00058 protected: 00060 virtual void publishInternal(const ros::Time & timestamp); 00061 00063 virtual void newMapDataCB( SMapWithParameters & par ); 00064 00066 virtual void handleNode(const tButServerOcTree::iterator& it, const SMapWithParameters & mp); 00067 00069 virtual void handlePostNodeTraversal(const SMapWithParameters & mp); 00070 00072 virtual bool shouldPublish(); 00073 00074 00076 std_msgs::ColorRGBA heightMapColor(double h) const; 00077 00078 public: 00079 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00080 00081 protected: 00083 bool m_publishMarkerArray; 00084 00086 std::string m_markerArrayPublisherName; 00087 00089 ros::Publisher m_markerArrayPublisher; 00090 00092 tf::TransformListener m_tfListener; 00093 00094 // 00095 bool m_latchedTopics; 00096 00098 std::string m_markerArrayFrameId; 00099 00101 std::string m_ocFrameId; 00102 00104 Eigen::Matrix3f m_ocToMarkerArrayRot; 00105 00107 Eigen::Vector3f m_ocToMarkerArrayTrans; 00108 00110 double m_minX, m_minY, m_minZ, m_maxX, m_maxY, m_maxZ; 00111 00113 bool m_bHeightMap; 00114 00116 bool m_bTransform; 00117 00119 float m_colorFactor; 00120 00122 std_msgs::ColorRGBA m_color; 00123 00124 }; // class CMarkerArrayPlugin 00125 00126 } // namespace srs_env_model 00127 00128 00129 00130 // namespace srs_env_model 00131 00132 00133 // MarkerArrayPlugin_H_included 00134 #endif