irsim.world.map.grid_map_generator_base#

Abstract base class for grid map generators.

Provides a unified interface (generate(), .grid) and registry for YAML grid_generator: name + variable parameter list. Subclasses implement _build_grid() and set name / yaml_param_names to register.

Classes#

GridMapGenerator

Abstract base for procedural grid map generators.

Module Contents#

class irsim.world.map.grid_map_generator_base.GridMapGenerator(**kwargs: Any)[source]#

Bases: abc.ABC

Abstract base for procedural grid map generators.

Subclasses must implement _build_grid() and set class attributes name (for YAML) and yaml_param_names (allowed constructor params from YAML).

Subclasses accept their own parameters via kwargs.

registry: ClassVar[dict[str, type[GridMapGenerator]]]#
name: str = ''#
yaml_param_names: tuple[str, Ellipsis] = ()#
generate() GridMapGenerator[source]#

Build the grid and return self. Call _build_grid() and set _grid.

property grid: numpy.ndarray#

Occupancy grid (0-100). Generates on first access if needed.

save_as_image(filepath: str, invert: bool = True) None[source]#

Save grid as grayscale PNG for use with World.gen_grid_map().

preview(title: str = 'Grid Map', cmap: str = 'gray_r') None[source]#

Display the occupancy grid with matplotlib.