Public Member Functions | Private Attributes | List of all members
grid_map::Costmap2DConverter< MapType, TranslationTable > Class Template Reference

Convert Costmap2DRos objects into cost or grid maps. More...

#include <Costmap2DConverter.hpp>

Public Member Functions

bool addLayerFromCostmap2D (const costmap_2d::Costmap2D &costmap2d, const std::string &layer, MapType &outputMap)
 
bool addLayerFromCostmap2D (costmap_2d::Costmap2DROS &costmap2d, const std::string &layer, MapType &outputMap)
 
bool addLayerFromCostmap2DAtRobotPose (costmap_2d::Costmap2DROS &costmap2d, const std::string &layer, MapType &outputMap)
 
 Costmap2DConverter ()=default
 
std::string errorMessage () const
 Human readable error message string. More...
 
void initializeFromCostmap2D (costmap_2d::Costmap2DROS &costmap2d, MapType &outputMap)
 
void initializeFromCostmap2D (const costmap_2d::Costmap2D &costmap2d, MapType &outputMap)
 
bool initializeFromCostmap2DAtRobotPose (costmap_2d::Costmap2DROS &costmap2d, const Length &length, MapType &outputMap)
 
void initializeFromGridMap (const MapType &gridMap, costmap_2d::Costmap2D &outputCostmap)
 
bool setCostmap2DFromGridMap (const MapType &gridMap, const std::string &layer, costmap_2d::Costmap2D &outputCostmap)
 
virtual ~Costmap2DConverter ()=default
 

Private Attributes

std::string errorMessage_
 

Detailed Description

template<typename MapType, typename TranslationTable = Costmap2DDefaultTranslationTable<typename MapType::DataType>>
class grid_map::Costmap2DConverter< MapType, TranslationTable >

Convert Costmap2DRos objects into cost or grid maps.

Template Parameters
MapType: either grid_map::GridMap or cost_map::CostMap
TranslationTable: class that creates a cost -> new type conversion table
See also
Costmap2DDirectTranslationTable, Costmap2DCenturyTranslationTable

Definition at line 157 of file Costmap2DConverter.hpp.

Constructor & Destructor Documentation

template<typename MapType, typename TranslationTable = Costmap2DDefaultTranslationTable<typename MapType::DataType>>
grid_map::Costmap2DConverter< MapType, TranslationTable >::Costmap2DConverter ( )
default
template<typename MapType, typename TranslationTable = Costmap2DDefaultTranslationTable<typename MapType::DataType>>
virtual grid_map::Costmap2DConverter< MapType, TranslationTable >::~Costmap2DConverter ( )
virtualdefault

Member Function Documentation

template<typename MapType, typename TranslationTable = Costmap2DDefaultTranslationTable<typename MapType::DataType>>
bool grid_map::Costmap2DConverter< MapType, TranslationTable >::addLayerFromCostmap2D ( const costmap_2d::Costmap2D costmap2d,
const std::string &  layer,
MapType &  outputMap 
)
inline

Load the costmap2d into the specified layer.

Warning
This does not lock the costmap2d object, you should take care to do so from outside this function.
Parameters
costmap2dfrom this costmap type object.
layerthe name of the layer to insert.
outputMapto this costmap type object.
Returns
true if successful, false otherwise.

Definition at line 224 of file Costmap2DConverter.hpp.

template<typename MapType, typename TranslationTable = Costmap2DDefaultTranslationTable<typename MapType::DataType>>
bool grid_map::Costmap2DConverter< MapType, TranslationTable >::addLayerFromCostmap2D ( costmap_2d::Costmap2DROS costmap2d,
const std::string &  layer,
MapType &  outputMap 
)
inline

Load the costmap2d into the specified layer.

Warning
This does not lock the costmap2d object, you should take care to do so from outside this function.
Parameters
costmap2dfrom this costmap type object.
layerthe name of the layer to insert.
outputMapto this costmap type object.
Returns
true if successful, false otherwise.

Definition at line 257 of file Costmap2DConverter.hpp.

template<typename MapType, typename TranslationTable = Costmap2DDefaultTranslationTable<typename MapType::DataType>>
bool grid_map::Costmap2DConverter< MapType, TranslationTable >::addLayerFromCostmap2DAtRobotPose ( costmap_2d::Costmap2DROS costmap2d,
const std::string &  layer,
MapType &  outputMap 
)
inline

Fill a layer in the output map with data from the subwindow centered at the robot pose.

Warning
This does not lock the costmap2d object, you should take care to do so from outside this function in scope with any initializeFromCostmap2DAtRobotPose calls you wish to make.
Parameters
costmap2dthe underlying Costmap2DROS object.
layerthe layer name to add.
outputMapthe initialized and filled in map output map.

Definition at line 347 of file Costmap2DConverter.hpp.

template<typename MapType, typename TranslationTable = Costmap2DDefaultTranslationTable<typename MapType::DataType>>
std::string grid_map::Costmap2DConverter< MapType, TranslationTable >::errorMessage ( ) const
inline

Human readable error message string.

Can be used to get a human readable description of the error type after one of the class methods has failed.

Returns
std::string

Definition at line 391 of file Costmap2DConverter.hpp.

template<typename MapType, typename TranslationTable = Costmap2DDefaultTranslationTable<typename MapType::DataType>>
void grid_map::Costmap2DConverter< MapType, TranslationTable >::initializeFromCostmap2D ( costmap_2d::Costmap2DROS costmap2d,
MapType &  outputMap 
)
inline

Definition at line 202 of file Costmap2DConverter.hpp.

template<typename MapType, typename TranslationTable = Costmap2DDefaultTranslationTable<typename MapType::DataType>>
void grid_map::Costmap2DConverter< MapType, TranslationTable >::initializeFromCostmap2D ( const costmap_2d::Costmap2D costmap2d,
MapType &  outputMap 
)
inline

Definition at line 207 of file Costmap2DConverter.hpp.

template<typename MapType, typename TranslationTable = Costmap2DDefaultTranslationTable<typename MapType::DataType>>
bool grid_map::Costmap2DConverter< MapType, TranslationTable >::initializeFromCostmap2DAtRobotPose ( costmap_2d::Costmap2DROS costmap2d,
const Length length,
MapType &  outputMap 
)
inline

Initialize the output map at the robot pose of the underlying Costmap2DROS object.

Note: This needs some beyond just fixing the center of the output map to the robot pose itself. To avoid introducing error, you want to shift the center so the underlying costmap2d cells align with the newly created map object. This does that here.

Warning
this does not lock the costmap2d object, you should take care to do so from outside this function in scope with any addLayerFromCostmap2DAtRobotPose calls you wish to make.
Parameters
costmap2d: the underlying Costmap2DROS object
geometrysize of the subwindow to snapshot around the robot pose
outputMap: initialise the output map with the required parameters

Definition at line 276 of file Costmap2DConverter.hpp.

template<typename MapType, typename TranslationTable = Costmap2DDefaultTranslationTable<typename MapType::DataType>>
void grid_map::Costmap2DConverter< MapType, TranslationTable >::initializeFromGridMap ( const MapType &  gridMap,
costmap_2d::Costmap2D outputCostmap 
)
inline

Initialize cost map size and properties from a grid map.

Parameters
gridMapGrid map containing size info and properties.
outputCostmapResized costmap.

Definition at line 167 of file Costmap2DConverter.hpp.

template<typename MapType, typename TranslationTable = Costmap2DDefaultTranslationTable<typename MapType::DataType>>
bool grid_map::Costmap2DConverter< MapType, TranslationTable >::setCostmap2DFromGridMap ( const MapType &  gridMap,
const std::string &  layer,
costmap_2d::Costmap2D outputCostmap 
)
inline

Load the grid map layer into the costmap2d object.

Parameters
outputMapfrom this gridmap type object.
layerthe name of the layer to convert.
outputCostmapto this costmap type object.
Returns
true if successful, false otherwise.

Definition at line 181 of file Costmap2DConverter.hpp.

Member Data Documentation

template<typename MapType, typename TranslationTable = Costmap2DDefaultTranslationTable<typename MapType::DataType>>
std::string grid_map::Costmap2DConverter< MapType, TranslationTable >::errorMessage_
private

Definition at line 394 of file Costmap2DConverter.hpp.


The documentation for this class was generated from the following file:


grid_map_costmap_2d
Author(s): Péter Fankhauser
autogenerated on Tue Jun 1 2021 02:13:31