35 #ifndef NAV_GRID_PUB_SUB_COST_INTERPRETATION_H 36 #define NAV_GRID_PUB_SUB_COST_INTERPRETATION_H 48 const std::vector<unsigned char>& cost_interpretation_table)
50 if (original_value < cost_interpretation_table.size())
52 return cost_interpretation_table[original_value];
56 return original_value;
64 const std::vector<unsigned char>& cost_interpretation_table)
82 template<
typename NumericType>
83 inline unsigned char interpretValue(
const NumericType value,
const NumericType min_value,
84 const NumericType denominator,
const NumericType unknown_value)
86 if (value == unknown_value)
92 double ratio = (value - min_value) / denominator;
93 return static_cast<unsigned char>(ratio * 100.0);
99 #endif // NAV_GRID_PUB_SUB_COST_INTERPRETATION_H virtual void setValue(const unsigned int x, const unsigned int y, const T &value)=0
void applyInterpretation(nav_grid::NavGrid< unsigned char > &grid, const std::vector< unsigned char > &cost_interpretation_table)
Apply a given interpretation to the provided nav grid.
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) ...
unsigned char interpretCost(unsigned char original_value, const std::vector< unsigned char > &cost_interpretation_table)
return cost_interpretation_table[original_value] (or original_value if not a valid index) ...
NavGridInfo getInfo() const