GridMapSimpleCount.h
Go to the documentation of this file.
1 //=================================================================================================
2 // Copyright (c) 2011, Stefan Kohlbrecher, TU Darmstadt
3 // All rights reserved.
4 
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the
11 // documentation and/or other materials provided with the distribution.
12 // * Neither the name of the Simulation, Systems Optimization and Robotics
13 // group, TU Darmstadt nor the names of its contributors may be used to
14 // endorse or promote products derived from this software without
15 // specific prior written permission.
16 
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
21 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //=================================================================================================
28 
29 #ifndef __GridMapSimpleCount_h_
30 #define __GridMapSimpleCount_h_
31 
32 
37 {
38 public:
39 
44  void set(float val)
45  {
46  simpleOccVal = val;
47  }
48 
53  float getValue() const
54  {
55  return simpleOccVal;
56  }
57 
62  bool isOccupied() const
63  {
64  return (simpleOccVal > 0.5f);
65  }
66 
67  bool isFree() const
68  {
69  return (simpleOccVal < 0.5f);
70  }
71 
76  {
77  simpleOccVal = 0.5f;
78  updateIndex = -1;
79  }
80 
81 //protected:
82 
83 public:
84 
85  float simpleOccVal;
87 
88 
89 };
90 
95 {
96 public:
97 
102  {
103  updateFreeVal = -0.10f;
104  updateOccVal = 0.15f;
105 
106  updateFreeLimit = -updateFreeVal + updateFreeVal/100.0f;
107  updateOccLimit = 1.0f - (updateOccVal + updateOccVal/100.0f);
108  }
109 
115  {
116  if (cell.simpleOccVal < updateOccLimit){
117  cell.simpleOccVal += updateOccVal;
118  }
119  }
120 
125  void updateSetFree(SimpleCountCell& cell) const
126  {
127  if (cell.simpleOccVal > updateFreeLimit){
128  cell.simpleOccVal += updateFreeVal;
129  }
130  }
131 
133  {
134  cell.simpleOccVal -= updateFreeVal;
135  }
136 
142  float getGridProbability(const SimpleCountCell& cell) const
143  {
144  return cell.simpleOccVal;
145  }
146 
147 protected:
148 
151 
154 
155 
156 };
157 
158 
159 #endif
void updateUnsetFree(SimpleCountCell &cell) const
f
bool isFree() const
void updateSetOccupied(SimpleCountCell &cell) const
void updateSetFree(SimpleCountCell &cell) const
float getValue() const
float getGridProbability(const SimpleCountCell &cell) const
bool isOccupied() const
float simpleOccVal
The log odds representation of occupancy probability.


hector_mapping
Author(s): Stefan Kohlbrecher
autogenerated on Sun Nov 3 2019 03:18:33