MIRA
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
CostMap Class Reference

#include <maps/CostMap.h>

Inheritance diagram for CostMap:
Inheritance graph
[legend]

Public Types

typedef GridMap< double > Base
 
typedef Base::Pixel CellType
 
typedef ImgPixel< double, 1 > Pixel
 
typedef ImgIterator< ImgPixel< double, 1 > > iterator
 
typedef ImgConstIterator< ImgPixel< double, 1 > > const_iterator
 

Public Member Functions

 CostMap ()
 
 CostMap (const Base &map, const std::string &iFrameID)
 
 CostMap (const Size2i &size, float cellSize, const Point2i &offset=Point2i(0, 0), const std::string &iFrameID="")
 
CostMapoperator= (const CellType &c)
 
CostMap clone () const
 
Point2f getGradient (const Point2i &mapPos) const
 Returns the gradient per cell. More...
 
float getCellSize () const
 Returns the size of each cell in meter. More...
 
Point2i getOffset () const
 Returns the offset of the map, e.g. the index of the cell that is located in the origin. More...
 
Point2i getMapOffset () const
 Provided for backward compatibility. Use getOffset() instead. More...
 
Point2f getWorldOffset () const
 Returns the offset of the map in metric coordinates. More...
 
Rect2f getRegion () const
 Returns the region that is covered by the GridMap. More...
 
Rect2i getMapRegion () const
 Returns the region that is covered by the GridMap in grid cells. More...
 
void grow (const Rect2f &region, const CellType &valueForNewCells)
 Grows the map so that the specified region is covered by the map. More...
 
void grow (const Rect2i &region, const CellType &valueForNewCells)
 
void grow (const Point2i &growLowerLeftDelta, const Point2i &growUpperRightDelta, const CellType &valueForNewCells)
 Grows the map by decreasing its minCorner by growLowerLeftDelta and increasing its maxCorner by growUpperRightDelta. More...
 
void clip (const Rect2i &region, const CellType &valueForNewCells)
 Grows and optionally crops the map to cover the specified region while minimizing copying of memory. More...
 
void clip (const Rect2f &region, const CellType &valueForNewCells)
 
Point2i world2map (const Point2f &p, bool roundDown=true) const
 Convert a given point to map coordinates. More...
 
Rect2i world2map (const Rect2f &r, bool includeBorder=true) const
 Returns the Rect in cell coordinates that is covered by the given rect that is specified in world coordinates. More...
 
Point2f world2mapf (const Point2f &p) const
 Convert a given point to map coordinates. More...
 
Point2f map2world (const Point2i &p) const
 Convert a given point to world coordinates. More...
 
Point2f map2world (const Point2f &p) const
 Convert a given point to world coordinates. More...
 
void reflect (BinarySerializer< Derived > &r)
 Reflect method for serialization. More...
 
void reflect (BinaryDeserializer< Derived > &r)
 Reflect method for deserialization. More...
 
void reflect (JSONSerializer &r)
 Reflect method for text visualization. More...
 
ImgPixel< double, 1 > * operator[] (int y)
 
const ImgPixel< double, 1 > * operator[] (int y) const
 
Img< double, 1 > operator() (const cv::Rect &roi)
 
Img< double, 1 > operator() (const cv::Rect &roi) const
 
ImgPixel< double, 1 > & operator() (int x, int y)
 
const ImgPixel< double, 1 > & operator() (int x, int y) const
 
ImgPixel< double, 1 > & operator() (const cv::Point &p)
 
const ImgPixel< double, 1 > & operator() (const cv::Point &p) const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
 operator const cv::Mat & () const
 
 operator cv::Mat & ()
 
void assignROI (const cv::Rect &roi, const ImgBase &other)
 
void assignMask (const cv::Rect &roi, const ImgBase &other, const cv::Mat &mask)
 
void assignPolygon (const cv::Rect &roi, const ImgBase &other, const Polygon2i &poly)
 
bool operator== (const cv::Mat &other) const
 
bool operator!= (const cv::Mat &other) const
 
const cv::MatgetMat () const
 
bool empty () const
 
int width () const
 
int height () const
 
std::size_t step () const
 
std::size_t bytesPerLine () const
 
Size2i size () const
 
int depth () const
 
int channels () const
 
bool isEmpty () const
 
uint8data ()
 
const uint8data () const
 
uint8data (int y)
 
const uint8data (int y) const
 
ImgFormat format () const
 
void resize (const Size2i &s)
 
void resize (int width, int height)
 
void clear ()
 
std::size_t total () const
 

Static Public Member Functions

static Img< double, 1 > convertFrom (const cv::Mat &other, bool alwaysCopy=false)
 

Public Attributes

std::string frameID
 
 Channels
 

Protected Types

typedef Img< double, 1 > Self
 

Protected Member Functions

Img< double, 1 > * This ()
 
const Img< double, 1 > * This () const
 
cv::Mat_< ImgPixel< double, 1 > > & castToMat ()
 
const cv::Mat_< ImgPixel< double, 1 > > & castToMat () const
 

Protected Attributes

float mCellSize
 width of one cell in m More...
 
Point2i mOffset
 cell index that corresponds to the origin of the map More...
 
cv::Mat mData
 

Member Typedef Documentation

◆ Base

typedef GridMap<double> Base

◆ CellType

typedef Base::Pixel CellType
inherited

Constructor & Destructor Documentation

◆ CostMap() [1/3]

CostMap ( )
inline

◆ CostMap() [2/3]

CostMap ( const Base map,
const std::string &  iFrameID 
)
inline

◆ CostMap() [3/3]

CostMap ( const Size2i size,
float  cellSize,
const Point2i offset = Point2i(0, 0),
const std::string &  iFrameID = "" 
)
inline

Member Function Documentation

◆ operator=()

CostMap& operator= ( const CellType c)
inline

◆ clone()

CostMap clone ( ) const
inline

◆ getGradient()

Point2f getGradient ( const Point2i mapPos) const
inline

Returns the gradient per cell.

Divide by the cell size to get gradient per meter.

◆ getCellSize()

float getCellSize ( ) const
inlineinherited

Returns the size of each cell in meter.

◆ getOffset()

Point2i getOffset ( ) const
inlineinherited

Returns the offset of the map, e.g. the index of the cell that is located in the origin.

◆ getMapOffset()

Point2i getMapOffset ( ) const
inlineinherited

Provided for backward compatibility. Use getOffset() instead.

◆ getWorldOffset()

Point2f getWorldOffset ( ) const
inlineinherited

Returns the offset of the map in metric coordinates.

◆ getRegion()

Rect2f getRegion ( ) const
inlineinherited

Returns the region that is covered by the GridMap.

◆ getMapRegion()

Rect2i getMapRegion ( ) const
inlineinherited

Returns the region that is covered by the GridMap in grid cells.

◆ grow() [1/3]

void grow ( const Rect2f region,
const CellType valueForNewCells 
)
inlineinherited

Grows the map so that the specified region is covered by the map.

New cells are initialized with the specified value. If the region is already covered by the map this method does nothing. Note that, if the map is resized, data from the old map will be copied into the new map. This may result in performance penalties, if the map is resized very often. Additionally, the specified value for new cells is copied using a memcpy. This is allowed since the GridMap class can be used for POD types only.

◆ grow() [2/3]

void grow ( const Rect2i region,
const CellType valueForNewCells 
)
inlineinherited

◆ grow() [3/3]

void grow ( const Point2i growLowerLeftDelta,
const Point2i growUpperRightDelta,
const CellType valueForNewCells 
)
inlineinherited

Grows the map by decreasing its minCorner by growLowerLeftDelta and increasing its maxCorner by growUpperRightDelta.

Parameters
growLowerLeftDeltamargin by which the minCorner is decreased. Must not be negative
growUpperRightDeltamargin by which the mayCorner is increased. Must not be negative
valueForNewCellsThe value for cells that are newly added

◆ clip() [1/2]

void clip ( const Rect2i region,
const CellType valueForNewCells 
)
inlineinherited

Grows and optionally crops the map to cover the specified region while minimizing copying of memory.

Parameters
regionThe new region that is covered by the map
valueForNewCellsThe value for cells that are newly added

◆ clip() [2/2]

void clip ( const Rect2f region,
const CellType valueForNewCells 
)
inlineinherited

◆ world2map() [1/2]

Point2i world2map ( const Point2f p,
bool  roundDown = true 
) const
inlineinherited

Convert a given point to map coordinates.

Parameters
[in]pPoint in world coordinates
[in]roundDownIf true, use std::floor for rounding, else use std::ceil
Returns
Point in map coordinates
Note
The point is not checked if it exceeds the boundaries of the map

◆ world2map() [2/2]

Rect2i world2map ( const Rect2f r,
bool  includeBorder = true 
) const
inlineinherited

Returns the Rect in cell coordinates that is covered by the given rect that is specified in world coordinates.

Parameters
includeBorderIf true, it is guaranteed, that the returned Rect covers at least the same area as the specified rect. If it is false, the Rect may be smaller.
Note
The rect is not checked if it exceeds the boundaries of the map

◆ world2mapf()

Point2f world2mapf ( const Point2f p) const
inlineinherited

Convert a given point to map coordinates.

Parameters
[in]pPoint in world coordinates
Returns
Floating-point point in map coordinates.
Note
The point is not checked if it exceeds the boundaries of the map

◆ map2world() [1/2]

Point2f map2world ( const Point2i p) const
inlineinherited

Convert a given point to world coordinates.

Parameters
[in]pCell index in map coordinates.
Returns
Point in world coordinates. Specifying the cell's lower-left corner position

◆ map2world() [2/2]

Point2f map2world ( const Point2f p) const
inlineinherited

Convert a given point to world coordinates.

Parameters
[in]pPoint in map coordinates. Specifying an floating-point point in cell coordinates.
Returns
Point in world coordinates.

◆ reflect() [1/3]

void reflect ( BinarySerializer< Derived > &  r)
inlineinherited

Reflect method for serialization.

◆ reflect() [2/3]

void reflect ( BinaryDeserializer< Derived > &  r)
inlineinherited

Reflect method for deserialization.

◆ reflect() [3/3]

void reflect ( JSONSerializer r)
inlineinherited

Reflect method for text visualization.

Member Data Documentation

◆ frameID

std::string frameID

◆ mCellSize

float mCellSize
protectedinherited

width of one cell in m

◆ mOffset

Point2i mOffset
protectedinherited

cell index that corresponds to the origin of the map


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