irsim.world.map.fog_map#
Classes#
Fog-of-map overlay grid, built on |
Module Contents#
- class irsim.world.map.fog_map.FogMap(width: float = 10, height: float = 10, resolution: float = 0.1, world_offset: tuple[float, float] | list[float] | None = None)[source]#
Bases:
irsim.world.map.MapFog-of-map overlay grid, built on
Map.Every cell starts unexplored (covered by fog). A robot’s lidar reveals cells along each beam’s line of sight, so the explored region grows as the robot navigates. The overlay is rendered as a grey layer that is opaque where unexplored and transparent where explored, so the underlying obstacle map shows through only once an area has been seen (free space appears white, obstacles black, the unknown stays grey).
The explored mask is updated regardless of whether a display is active, so it is also usable headless as an exploration observation or coverage metric.
Initialize the fog grid.
- Parameters:
width – Width of the world (metres) — matches the world it covers.
height – Height of the world (metres).
resolution – Fog cell size (metres/cell). Finer is smoother but heavier; coarser is faster.
world_offset – World origin
(x, y)for cell indexing.
- Raises:
ValueError – If
resolutionis not positive and finite (it is user-configurable viafog_map_resolution).
- explored#
- property shape: tuple[int, int]#
Grid shape
(nx, ny)(cells along x and y).
- property explored_ratio: float#
Fraction of the world revealed so far, in
[0, 1].
- reveal_from_lidar(origin: numpy.ndarray | list[float], angles: numpy.ndarray | list[float], ranges: numpy.ndarray | list[float]) None[source]#
Reveal cells along each lidar beam’s line of sight.
- Parameters:
origin – Lidar world pose
[x, y, theta](theta optional).angles – Per-beam angles in the lidar’s local frame (radians).
ranges – Per-beam measured ranges (metres), aligned with
angles.
- reveal_fov(origin: numpy.ndarray | list[float], fov: float, fov_radius: float) None[source]#
Reveal every cell within a field-of-view sector (no occlusion).
Used when a sensing object has no lidar: each cell within
fov_radiusof the origin and within±fov/2of the object’s heading is revealed.- Parameters:
origin – Object world pose
[x, y, theta](theta optional).fov – Full field-of-view angle in radians (
2*piis a full circle).fov_radius – View range in metres.
- to_rgba(color: tuple[float, float, float] = (0.78, 0.78, 0.8), alpha: float = 1.0) numpy.ndarray[source]#
RGBA image of the fog for rendering.
Unexplored cells get
coloratalpha(a soft light grey, opaque by default so the fog still fully hides the map until seen); explored cells are fully transparent so the underlying map shows through. Shape is(nx, ny, 4)(transpose the first two axes forimshow).The buffer is allocated once and reused: the constant RGB channels are filled on the first call, and only the alpha channel is recomputed (the only thing that changes as cells are revealed).