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 (https://github.com/ZJU-FAST-Lab/GCOPTER). Pure NumPy implementation.
Attributes#
Classes#
Perlin noise based 2D occupancy grid map. |
Functions#
|
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 https://github.com/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.GridMapGeneratorPerlin 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 (https://github.com/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#
- irsim.world.map.perlin_map_generator.pmap#