26 template <
typename TCELL>
    53         static const double LOGODD_K = 16;
    54         static const double LOGODD_K_INV = 1.0 / LOGODD_K;
    58         for (
int i = traits_t::CELLTYPE_MIN; i <= traits_t::CELLTYPE_MAX; i++)
    60             float f = 1.0f / (1.0f + std::exp(-i * LOGODD_K_INV));
    61             unsigned int idx = -traits_t::CELLTYPE_MIN + i;
    67         p2lTable.resize(traits_t::P2LTABLE_SIZE + 1);
    68         const double K = 1.0 / traits_t::P2LTABLE_SIZE;
    69         for (
int j = 0; j <= traits_t::P2LTABLE_SIZE; j++)
    71             const double p = std::min(1.0 - 1e-14, std::max(1e-14, j * K));
    72             const double logodd = log(p) - log(1 - p);
    73             int L = 
round(logodd * LOGODD_K);
    74             if (L > traits_t::CELLTYPE_MAX)
    75                 L = traits_t::CELLTYPE_MAX;
    76             else if (L < traits_t::CELLTYPE_MIN)
    77                 L = traits_t::CELLTYPE_MIN;
    87         if (l < traits_t::CELLTYPE_MIN)
    99         if (l < traits_t::CELLTYPE_MIN)
   111         return p2lTable[
static_cast<unsigned int>(p * traits_t::P2LTABLE_SIZE)];
 
cell_t cell_t
The type of. 
 
std::vector< uint8_t > logoddsTable_255
A lookup table to compute occupancy probabilities in the range [0,255] from integer log-odds values i...
 
cell_t p2l(const float p)
Scales a real valued probability in [0,1] to an integer representation of: log(p)-log(1-p) in the val...
 
CLogOddsGridMapLUT()
Constructor: computes all the required stuff. 
 
std::vector< cell_t > p2lTable
A lookup table for passing from float to log-odds as cell_t. 
 
std::vector< float > logoddsTable
A lookup table to compute occupancy probabilities in [0,1] from integer log-odds values in the cells...
 
uint8_t l2p_255(const cell_t l)
Scales an integer representation of the log-odd into a linear scale [0,255], using p=exp(l)/(1+exp(l)...
 
float l2p(const cell_t l)
Scales an integer representation of the log-odd into a real valued probability in [0...
 
One static instance of this struct should exist in any class implementing CLogOddsGridMap2D to hold t...
 
int round(const T value)
Returns the closer integer (int) to x.