Skip to content

Commit

Permalink
simplify costmap2dROS conversion table mechanics
Browse files Browse the repository at this point in the history
  • Loading branch information
stonier committed Jan 17, 2017
1 parent 56fa782 commit a58c882
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions grid_map_ros/include/grid_map_ros/Costmap2DConverter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,19 @@ class Costmap2DDefaultTranslationTable : public Costmap2DDirectTranslationTable
template<>
class Costmap2DDefaultTranslationTable<float> : public Costmap2DCenturyTranslationTable {};

/*!
* Converter.
/*****************************************************************************
** Converter
*****************************************************************************/

/**
* @brief Convert Costmap2DRos objects into cost or grid maps.
*
* @tparam MapType : either grid_map::GridMap or cost_map::CostMap
* @tparam TranslationTable : class that creates a cost -> new type conversion table
*
* @sa Costmap2DDirectTranslationTable, Costmap2DCenturyTranslationTable
*/
template<typename MapType>
template<typename MapType, typename TranslationTable=Costmap2DDefaultTranslationTable<typename MapType::DataType>>
class Costmap2DConverter
{
public:
Expand All @@ -91,17 +100,7 @@ class Costmap2DConverter
*/
Costmap2DConverter()
{
initializeCostTranslationTable(Costmap2DDefaultTranslationTable<typename MapType::DataType>());
}

/*!
* Initialise the cost translation table with the user specified translation table functor.
* @param translationTable the specified translation table.
*/
template <typename TranslationTable>
Costmap2DConverter(const TranslationTable& translationTable)
{
initializeCostTranslationTable(translationTable);
TranslationTable::create(costTranslationTable_);
}

virtual ~Costmap2DConverter()
Expand Down Expand Up @@ -302,11 +301,6 @@ class Costmap2DConverter
}

private:
template <typename TranslationTable>
void initializeCostTranslationTable(const TranslationTable& translation_table) {
translation_table.apply(costTranslationTable_);
}

std::vector<typename MapType::DataType> costTranslationTable_;
};

Expand Down

0 comments on commit a58c882

Please sign in to comment.