00001 /************************************************************************************************** 00002 Software License Agreement (BSD License) 00003 00004 Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without modification, are permitted 00008 provided that the following conditions are met: 00009 00010 *Redistributions of source code must retain the above copyright notice, this list of 00011 conditions and the following disclaimer. 00012 *Redistributions in binary form must reproduce the above copyright notice, this list of 00013 conditions and the following disclaimer in the documentation and/or other materials provided 00014 with the distribution. 00015 *Neither the name of the University of Aveiro nor the names of its contributors may be used to 00016 endorse or promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00021 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00024 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00025 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 ***************************************************************************************************/ 00027 #ifndef _REPRESENTATION_RVIZ_H_ 00028 #define _REPRESENTATION_RVIZ_H_ 00029 00030 #include <navigability_map/navigability_map.h> 00031 00032 00048 class Markers 00049 { 00050 public: 00051 void update(visualization_msgs::Marker& marker) 00052 { 00053 for(uint i=0;i<markers.size();++i) 00054 if(markers[i].ns==marker.ns && markers[i].id==marker.id)//Marker found 00055 { 00056 markers.erase(markers.begin()+i); 00057 break; 00058 } 00059 00060 markers.push_back(marker); 00061 } 00062 00063 void decrement(void) 00064 { 00065 for(uint i=0;i<markers.size();++i) 00066 { 00067 switch(markers[i].action) 00068 { 00069 case visualization_msgs::Marker::ADD: 00070 markers[i].action = visualization_msgs::Marker::DELETE; 00071 break; 00072 case visualization_msgs::Marker::DELETE: 00073 markers[i].action = -1; 00074 break; 00075 } 00076 } 00077 } 00078 00079 void clean(void) 00080 { 00081 vector<visualization_msgs::Marker> new_markers; 00082 00083 for(uint i=0;i<markers.size();++i) 00084 if(markers[i].action!=-1) 00085 new_markers.push_back(markers[i]); 00086 00087 markers=new_markers; 00088 } 00089 00090 vector<visualization_msgs::Marker> getOutgoingMarkers(void) 00091 { 00092 vector<visualization_msgs::Marker> m_out(markers); 00093 return markers; 00094 } 00095 00096 private: 00097 00098 vector<visualization_msgs::Marker> markers; 00099 }; 00100 00109 vector<visualization_msgs::Marker> create_Markers_ElavationMap(Navigability_Map& nav_map, std::string grid_frame); 00110 00119 visualization_msgs::Marker create_Markers_Normals(Navigability_Map& nav_map, std::string grid_frame); 00120 00129 vector<visualization_msgs::Marker> create_Markers_AccessibilityMap(Navigability_Map& nav_map, std::string grid_frame); 00130 00135 visualization_msgs::Marker create_Markers_Polygon(Navigability_Map& nav_map, std::string grid_frame); 00136 visualization_msgs::Marker create_Markers_Obstacle(Navigability_Map& nav_map, std::string grid_frame); 00137 00138 00139 #endif