Nav2 Navigation Stack - kilted  kilted
ROS 2 Navigation Stack
Public Member Functions | List of all members
nav2_simple_commander.costmap_2d.PyCostmap2D Class Reference

Public Member Functions

None __init__ (self, OccupancyGrid occupancy_map)
 
int getSizeInCellsX (self)
 
int getSizeInCellsY (self)
 
float getSizeInMetersX (self)
 
float getSizeInMetersY (self)
 
float getOriginX (self)
 
float getOriginY (self)
 
float getResolution (self)
 
str getGlobalFrameID (self)
 
Time getCostmapTimestamp (self)
 
np.uint8 getCostXY (self, int mx, int my)
 
np.uint8 getCostIdx (self, int index)
 
None setCost (self, int mx, int my, np.uint8 cost)
 
tuple[float, float] mapToWorld (self, int mx, int my)
 
tuple[Optional[int], Optional[int]] worldToMapValidated (self, float wx, float wy)
 
int getIndex (self, int mx, int my)
 

Detailed Description

PyCostmap2D.

Costmap Python3 API for OccupancyGrids to populate from published messages

Definition at line 34 of file costmap_2d.py.

Constructor & Destructor Documentation

◆ __init__()

None nav2_simple_commander.costmap_2d.PyCostmap2D.__init__ (   self,
OccupancyGrid  occupancy_map 
)
Initialize costmap2D.

Args
----
    occupancy_map (OccupancyGrid): 2D OccupancyGrid Map

Returns
-------
    None

Definition at line 41 of file costmap_2d.py.

References nav2_voxel_grid::VoxelGrid.costmap, map_t.origin_x, map_t.origin_y, nav2_map_server::LoadParameters.resolution, map_t.size_x, nav2_smac_planner::HybridMotionTable.size_x, nav2_smac_planner::LatticeMotionTable.size_x, and map_t.size_y.

Member Function Documentation

◆ getCostIdx()

np.uint8 nav2_simple_commander.costmap_2d.PyCostmap2D.getCostIdx (   self,
int  index 
)
Get the cost of a cell in the costmap using Index.

Args
----
    index (int): index of cell to get cost

Returns
-------
    np.uint8: cost of a cell

Definition at line 116 of file costmap_2d.py.

References nav2_voxel_grid::VoxelGrid.costmap.

◆ getCostmapTimestamp()

Time nav2_simple_commander.costmap_2d.PyCostmap2D.getCostmapTimestamp (   self)
Get costmap timestamp.

Definition at line 96 of file costmap_2d.py.

◆ getCostXY()

np.uint8 nav2_simple_commander.costmap_2d.PyCostmap2D.getCostXY (   self,
int  mx,
int  my 
)
Get the cost of a cell in the costmap using map coordinate XY.

Args
----
    mx (int): map coordinate X to get cost
    my (int): map coordinate Y to get cost

Returns
-------
    np.uint8: cost of a cell

Definition at line 100 of file costmap_2d.py.

References nav2_voxel_grid::VoxelGrid.costmap, nav2_smac_planner::Node2D.getIndex(), nav2_smac_planner::NodeHybrid.getIndex(), nav2_smac_planner::NodeLattice.getIndex(), theta_star::ThetaStar.getIndex(), nav2_simple_commander.costmap_2d.PyCostmap2D.getIndex(), nav2_costmap_2d::Costmap2D.getIndex(), and mppi::critics::CostCritic.getIndex().

Here is the call graph for this function:

◆ getGlobalFrameID()

str nav2_simple_commander.costmap_2d.PyCostmap2D.getGlobalFrameID (   self)
Get global frame_id.

Definition at line 92 of file costmap_2d.py.

◆ getIndex()

int nav2_simple_commander.costmap_2d.PyCostmap2D.getIndex (   self,
int  mx,
int  my 
)
Get the index of the cell using map coordinate XY.

Args
----
    mx (int): map coordinate X to get Index
    my (int): map coordinate Y to get Index

Returns
-------
    int: The index of the cell

Definition at line 193 of file costmap_2d.py.

References map_t.size_x, nav2_smac_planner::HybridMotionTable.size_x, and nav2_smac_planner::LatticeMotionTable.size_x.

Referenced by nav2_simple_commander.costmap_2d.PyCostmap2D.getCostXY(), and nav2_simple_commander.costmap_2d.PyCostmap2D.setCost().

Here is the caller graph for this function:

◆ getOriginX()

float nav2_simple_commander.costmap_2d.PyCostmap2D.getOriginX (   self)
Get the origin x axis of the map [m].

Definition at line 80 of file costmap_2d.py.

References map_t.origin_x.

◆ getOriginY()

float nav2_simple_commander.costmap_2d.PyCostmap2D.getOriginY (   self)
Get the origin y axis of the map [m].

Definition at line 84 of file costmap_2d.py.

References map_t.origin_y.

◆ getResolution()

float nav2_simple_commander.costmap_2d.PyCostmap2D.getResolution (   self)
Get map resolution [m/cell].

Definition at line 88 of file costmap_2d.py.

References nav2_map_server::LoadParameters.resolution.

◆ getSizeInCellsX()

int nav2_simple_commander.costmap_2d.PyCostmap2D.getSizeInCellsX (   self)
Get map width in cells.

Definition at line 64 of file costmap_2d.py.

References map_t.size_x, nav2_smac_planner::HybridMotionTable.size_x, and nav2_smac_planner::LatticeMotionTable.size_x.

◆ getSizeInCellsY()

int nav2_simple_commander.costmap_2d.PyCostmap2D.getSizeInCellsY (   self)
Get map height in cells.

Definition at line 68 of file costmap_2d.py.

References map_t.size_y.

◆ getSizeInMetersX()

float nav2_simple_commander.costmap_2d.PyCostmap2D.getSizeInMetersX (   self)

◆ getSizeInMetersY()

float nav2_simple_commander.costmap_2d.PyCostmap2D.getSizeInMetersY (   self)
Get y axis map size in meters.

Definition at line 76 of file costmap_2d.py.

References nav2_map_server::LoadParameters.resolution, and map_t.size_y.

◆ mapToWorld()

tuple[float, float] nav2_simple_commander.costmap_2d.PyCostmap2D.mapToWorld (   self,
int  mx,
int  my 
)
Get the world coordinate XY using map coordinate XY.

Args
----
    mx (int): map coordinate X to get world coordinate
    my (int): map coordinate Y to get world coordinate

Returns
-------
    tuple of float: wx, wy
    wx (float) [m]: world coordinate X
    wy (float) [m]: world coordinate Y

Definition at line 148 of file costmap_2d.py.

References map_t.origin_x, map_t.origin_y, and nav2_map_server::LoadParameters.resolution.

◆ setCost()

None nav2_simple_commander.costmap_2d.PyCostmap2D.setCost (   self,
int  mx,
int  my,
np.uint8  cost 
)
Set the cost of a cell in the costmap using map coordinate XY.

Args
----
    mx (int): map coordinate X to get cost
    my (int): map coordinate Y to get cost
    cost (np.uint8): The cost to set the cell

Returns
-------
    None

Definition at line 131 of file costmap_2d.py.

References nav2_voxel_grid::VoxelGrid.costmap, nav2_smac_planner::Node2D.getIndex(), nav2_smac_planner::NodeHybrid.getIndex(), nav2_smac_planner::NodeLattice.getIndex(), theta_star::ThetaStar.getIndex(), nav2_simple_commander.costmap_2d.PyCostmap2D.getIndex(), nav2_costmap_2d::Costmap2D.getIndex(), and mppi::critics::CostCritic.getIndex().

Here is the call graph for this function:

◆ worldToMapValidated()

tuple[Optional[int], Optional[int]] nav2_simple_commander.costmap_2d.PyCostmap2D.worldToMapValidated (   self,
float  wx,
float  wy 
)
Get the map coordinate XY using world coordinate XY.

Args
----
    wx (float) [m]: world coordinate X to get map coordinate
    wy (float) [m]: world coordinate Y to get map coordinate

Returns
-------
    (None, None): if coordinates are invalid
    tuple of int: mx, my (if coordinates are valid)
    mx (int): map coordinate X
    my (int): map coordinate Y

Definition at line 168 of file costmap_2d.py.

References map_t.origin_x, map_t.origin_y, nav2_map_server::LoadParameters.resolution, map_t.size_x, nav2_smac_planner::HybridMotionTable.size_x, nav2_smac_planner::LatticeMotionTable.size_x, and map_t.size_y.

Referenced by nav2_simple_commander.footprint_collision_checker.FootprintCollisionChecker.footprintCost().

Here is the caller graph for this function:

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