35 #ifndef NAV_GRID_PUB_SUB_COST_INTERPRETATION_H 36 #define NAV_GRID_PUB_SUB_COST_INTERPRETATION_H 49 template<
typename NumericType,
typename IntegralType>
51 const std::vector<NumericType>& cost_interpretation_table)
53 unsigned int index =
static_cast<unsigned int>(original_value);
54 if (index < cost_interpretation_table.size())
56 return cost_interpretation_table[index];
60 return original_value;
67 template<
typename IntegralType>
69 const std::vector<IntegralType>& cost_interpretation_table)
87 template<
typename NumericType>
88 inline unsigned char interpretValue(
const NumericType value,
const NumericType min_value,
89 const NumericType denominator,
const NumericType unknown_value)
91 if (value == unknown_value)
97 double ratio = (value - min_value) / denominator;
98 return static_cast<unsigned char>(ratio * 100.0);
104 #endif // NAV_GRID_PUB_SUB_COST_INTERPRETATION_H virtual void setValue(const unsigned int x, const unsigned int y, const T &value)=0
NumericType interpretCost(IntegralType original_value, const std::vector< NumericType > &cost_interpretation_table)
return cost_interpretation_table[original_value] (or original_value if not a valid index) ...
unsigned char interpretValue(const NumericType value, const NumericType min_value, const NumericType denominator, const NumericType unknown_value)
Scale the given value to fit within [0, 100] (unless its ignore_value, then its -1) ...
void applyInterpretation(nav_grid::NavGrid< IntegralType > &grid, const std::vector< IntegralType > &cost_interpretation_table)
Apply a given interpretation to the provided nav grid.
NavGridInfo getInfo() const