GridMapSimpleCount.h
Go to the documentation of this file.
00001 //=================================================================================================
00002 // Copyright (c) 2011, Stefan Kohlbrecher, TU Darmstadt
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 //     * Redistributions of source code must retain the above copyright
00008 //       notice, this list of conditions and the following disclaimer.
00009 //     * Redistributions in binary form must reproduce the above copyright
00010 //       notice, this list of conditions and the following disclaimer in the
00011 //       documentation and/or other materials provided with the distribution.
00012 //     * Neither the name of the Simulation, Systems Optimization and Robotics
00013 //       group, TU Darmstadt nor the names of its contributors may be used to
00014 //       endorse or promote products derived from this software without
00015 //       specific prior written permission.
00016 
00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00018 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00019 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00020 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
00021 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 //=================================================================================================
00028 
00029 #ifndef __GridMapSimpleCount_h_
00030 #define __GridMapSimpleCount_h_
00031 
00032 
00036 class SimpleCountCell
00037 {
00038 public:
00039 
00044   void set(float val)
00045   {
00046     simpleOccVal = val;
00047   }
00048 
00053   float getValue() const
00054   {
00055     return simpleOccVal;
00056   }
00057 
00062   bool isOccupied() const
00063   {
00064     return (simpleOccVal > 0.5f);
00065   }
00066 
00067   bool isFree() const
00068   {
00069     return (simpleOccVal < 0.5f);
00070   }
00071 
00075   void resetGridCell()
00076   {
00077     simpleOccVal = 0.5f;
00078     updateIndex = -1;
00079   }
00080 
00081 //protected:
00082 
00083 public:
00084 
00085   float simpleOccVal; 
00086   int updateIndex;
00087 
00088 
00089 };
00090 
00094 class GridMapSimpleCountFunctions
00095 {
00096 public:
00097 
00101   GridMapSimpleCountFunctions()
00102   {
00103     updateFreeVal = -0.10f;
00104     updateOccVal  =  0.15f;
00105 
00106     updateFreeLimit = -updateFreeVal + updateFreeVal/100.0f;
00107     updateOccLimit  = 1.0f - (updateOccVal + updateOccVal/100.0f);
00108   }
00109 
00114   void updateSetOccupied(SimpleCountCell& cell) const
00115   {
00116     if (cell.simpleOccVal < updateOccLimit){
00117       cell.simpleOccVal += updateOccVal;
00118     }
00119   }
00120 
00125   void updateSetFree(SimpleCountCell& cell) const
00126   {
00127     if (cell.simpleOccVal > updateFreeLimit){
00128       cell.simpleOccVal += updateFreeVal;
00129     }
00130   }
00131 
00132   void updateUnsetFree(SimpleCountCell& cell) const
00133   {
00134     cell.simpleOccVal -= updateFreeVal;
00135   }
00136 
00142   float getGridProbability(const SimpleCountCell& cell) const
00143   {
00144     return cell.simpleOccVal;
00145   }
00146 
00147 protected:
00148 
00149   float updateFreeVal;
00150   float updateOccVal;
00151 
00152   float updateFreeLimit;
00153   float updateOccLimit;
00154 
00155 
00156 };
00157 
00158 
00159 #endif


hector_mapping
Author(s): Stefan Kohlbrecher
autogenerated on Mon Oct 6 2014 00:33:51