$search
00001 /* 00002 * Copyright (c) 2008, Maxim Likhachev 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * * Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * * Neither the name of the University of Pennsylvania nor the names of its 00014 * contributors may be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00025 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00026 * POSSIBILITY OF SUCH DAMAGE. 00027 */ 00028 #ifndef __ENVIRONMENT_NAVXYTHETAMLEVLAT_H_ 00029 #define __ENVIRONMENT_NAVXYTHETAMLEVLAT_H_ 00030 00031 //these structures contain footprints for the additional levels 00032 //each of these structures corresponds to one of the EnvNAVXYTHETALATAction_t structures 00033 typedef struct{ 00034 char starttheta; //should be equal to the corresponding EnvNAVXYTHETALATAction_t structure 00035 char dX; //should be equal to the corresponding EnvNAVXYTHETALATAction_t structure 00036 char dY; //should be equal to the corresponding EnvNAVXYTHETALATAction_t structure 00037 char endtheta; //should be equal to the corresponding EnvNAVXYTHETALATAction_t structure 00038 vector<sbpl_2Dcell_t>* intersectingcellsV; //one footprint per additional level 00039 } EnvNAVXYTHETAMLEVLATAddInfoAction_t; 00040 00041 00049 class EnvironmentNAVXYTHETAMLEVLAT : public EnvironmentNAVXYTHETALAT 00050 { 00051 00052 public: 00053 00060 bool InitializeAdditionalLevels(int numofadditionalzlevs, const vector<sbpl_2Dpt_t>* perimeterptsV, 00061 unsigned char* cost_inscribed_thresh, 00062 unsigned char* cost_possibly_circumscribed_thresh); 00063 00070 bool Set2DMapforAddLev(const unsigned char* mapdata, int levind); 00071 00076 bool Set2DMapforAddLev(const unsigned char** NewGrid2D, int levind); 00077 00078 00082 bool UpdateCostinAddLev(int x, int y, unsigned char newcost, int zlev); 00083 00087 virtual void GetPredsofChangedEdges(vector<nav2dcell_t> const * changedcellsV, vector<int> *preds_of_changededgesIDV) 00088 { 00089 SBPL_ERROR("ERROR: GetPredsofChangedEdges function not supported\n"); 00090 throw new SBPL_Exception(); 00091 } 00092 00093 00097 virtual void GetSuccsofChangedEdges(vector<nav2dcell_t> const * changedcellsV, vector<int> *succs_of_changededgesIDV) 00098 { 00099 SBPL_ERROR("ERROR: GetSuccsofChangedEdges function not supported\n"); 00100 throw new SBPL_Exception(); 00101 } 00102 00106 bool IsValidCell(int X, int Y); 00107 00111 bool IsValidCell(int X, int Y, int levind); 00112 00113 00117 bool IsObstacle(int x, int y); 00118 00122 bool IsObstacle(int x, int y, int levind); 00123 00129 bool IsValidConfiguration(int X, int Y, int Theta); 00130 00134 unsigned char GetMapCost(int X, int Y); 00135 00139 unsigned char GetMapCost(int X, int Y, int levind); 00140 00141 00142 EnvironmentNAVXYTHETAMLEVLAT(); 00143 ~EnvironmentNAVXYTHETAMLEVLAT(); 00144 00145 protected: 00149 int numofadditionalzlevs; 00150 00151 00155 vector<sbpl_2Dpt_t>* AddLevelFootprintPolygonV; 00156 00163 EnvNAVXYTHETAMLEVLATAddInfoAction_t** AdditionalInfoinActionsV; 00164 00165 00170 unsigned char*** AddLevelGrid2D; 00171 00176 unsigned char* AddLevel_cost_inscribed_thresh; 00181 unsigned char* AddLevel_cost_possibly_circumscribed_thresh; 00182 00183 virtual int GetActionCost(int SourceX, int SourceY, int SourceTheta, EnvNAVXYTHETALATAction_t* action); 00184 00185 virtual int GetActionCostacrossAddLevels(int SourceX, int SourceY, int SourceTheta, EnvNAVXYTHETALATAction_t* action); 00186 00187 00188 }; 00189 00190 00191 00192 #endif 00193