irsim.world.map.obstacle_map#

Attributes#

Classes#

ObstacleMap

Static obstacle object backed by map line segments and optional grid data.

Functions#

grid_collision_geometry() → bool)

Check collision of a Shapely geometry against an occupancy grid.

Module Contents#

irsim.world.map.obstacle_map.OCCUPANCY_THRESHOLD = 50#
irsim.world.map.obstacle_map.CELL_CENTER_OFFSET = 0.5#
irsim.world.map.obstacle_map.COLLISION_RADIUS_FACTOR = 0.5#
irsim.world.map.obstacle_map.grid_collision_geometry(grid: numpy.ndarray | None, grid_reso: tuple[float, float], geometry, world_offset: tuple[float, float] = (0.0, 0.0)) bool[源代码]#

Check collision of a Shapely geometry against an occupancy grid.

Uses a two-phase approach: 1. Quick bounding box check for early rejection 2. Precise check: verify if geometry actually intersects occupied cells

参数:
  • grid -- Occupancy grid, or None when the map carries no grid.

  • grid_reso -- Cell size (x_reso, y_reso) in meters.

  • geometry -- Shapely geometry object to check collision for.

  • world_offset -- World coordinates of the grid origin.

返回:

True if collision detected, False otherwise.

返回类型:

bool

class irsim.world.map.obstacle_map.ObstacleMap(shape: dict | None = None, color: str = 'k', static: bool = True, grid_map: numpy.ndarray | None = None, grid_reso: numpy.ndarray | None = None, world_offset: list[float] | None = None, **kwargs: Any)[源代码]#

Bases: irsim.world.object_base.ObjectBase

Static obstacle object backed by map line segments and optional grid data.

Create an obstacle map object from a set of line segments.

参数:
  • shape (dict | None) -- Map shape configuration with keys like {"name": "map", "reso": float, "points": array}.

  • color (str) -- Display color. Default "k".

  • static (bool) -- Whether the object is static. Default True.

  • grid_map (np.ndarray | None) -- Grid map array for fast collision detection.

  • grid_reso (np.ndarray | None) -- Resolution [x_reso, y_reso] of the grid.

  • world_offset (list | None) -- World offset [x, y].

  • **kwargs -- Forwarded to ObjectBase constructor.

linestrings#
geometry_tree#
grid_map = None#
grid_reso#
world_offset#
check_grid_collision(geometry) bool[源代码]#

Check collision using grid array lookup.

参数:

geometry -- Shapely geometry object to check collision for.

返回:

True if collision detected, False otherwise.

返回类型:

bool

is_collision(geometry) bool[源代码]#

Check collision against grid (if present) and map geometry.