irsim.world.map.perlin_map_generator#

Perlin noise based 2D grid map generator for robot navigation.

Generates procedural occupancy grids using Perlin noise. Parameter semantics (complexity, fill, fractal, attenuation) follow the map generation used in GCOPTER (ZJU-FAST-Lab/GCOPTER). Pure NumPy implementation.

Attributes#

Classes#

PerlinGridGenerator

Perlin noise based 2D occupancy grid map.

Functions#

generate_perlin_noise(β†’Β numpy.ndarray)

Generate 2D Perlin noise array.

Module Contents#

irsim.world.map.perlin_map_generator.generate_perlin_noise(width: int, height: int, complexity: float = 0.142857, fractal: int = 1, attenuation: float = 0.5, seed: int | None = None) numpy.ndarray[source]#

Generate 2D Perlin noise array.

Parameter semantics follow GCOPTER map_gen (see ZJU-FAST-Lab/GCOPTER).

Parameters:
  • width (int) – Output width in grid cells.

  • height (int) – Output height in grid cells.

  • complexity (float) – Base noise frequency. Default 0.142857.

  • fractal (int) – Number of octave layers. Default 1. Must be >= 1.

  • attenuation (float) – Amplitude for layer k is attenuation / (k + 1). Default 0.5. Must be > 0.

  • seed (int | None) – Random seed for reproducibility.

Returns:

Noise array of shape (width, height), values in [0, 1].

Return type:

np.ndarray

Raises:

ValueError – If fractal < 1 or attenuation <= 0.

class irsim.world.map.perlin_map_generator.PerlinGridGenerator(width: int, height: int, complexity: float = 0.142857, fill: float = 0.38, fractal: int = 1, attenuation: float = 0.5, seed: int | None = None)[source]#

Bases: irsim.world.map.grid_map_generator_base.GridMapGenerator

Perlin noise based 2D occupancy grid map.

Holds width, height, and a grid of occupancy values (0-100; values > 50 are obstacles). Parameter semantics follow GCOPTER map_gen (ZJU-FAST-Lab/GCOPTER). Output can be saved as PNG for use with World.gen_grid_map().

Initialize map parameters.

Parameters:
  • width (int) – Map width in grid cells.

  • height (int) – Map height in grid cells.

  • complexity (float) – Base noise frequency. Default 0.142857.

  • fill (float) – Obstacle ratio in [0, 1]. Default 0.38.

  • fractal (int) – Number of octave layers. Default 1. Must be >= 1.

  • attenuation (float) – Amplitude decay per octave. Default 0.5. Must be > 0.

  • seed (int | None) – Random seed for reproducibility.

name = 'perlin'#
yaml_param_names = ('complexity', 'fill', 'fractal', 'attenuation', 'seed')#
width#
height#
complexity = 0.142857#
fill = 0.38#
fractal = 1#
attenuation = 0.5#
seed = None#
preview(title: str = 'Perlin 2D Map', cmap: str = 'gray_r') None[source]#

Preview the grid with matplotlib.

irsim.world.map.perlin_map_generator.pmap#