irsim.world.world#
Classes#
Represents the main simulation environment, managing objects and maps. |
Module Contents#
- class irsim.world.world.World(name: str | None = 'world', height: float = 10, width: float = 10, step_time: float = 0.1, sample_time: float | None = None, offset: list[float] | None = None, control_mode: str = 'auto', collision_mode: str = 'stop', obstacle_map: Any | None = None, mdownsample: int = 1, plot: dict[str, Any] | None = None, status: str = 'None', world_param_instance: irsim.config.world_param.WorldParam | None = None, **kwargs: Any)[source]#
Represents the main simulation environment, managing objects and maps.
- name#
Name of the world.
- Type:
str
- height#
Height of the world.
- Type:
float
- width#
Width of the world.
- Type:
float
- step_time#
Time interval between steps.
- Type:
float
- sample_time#
Time interval between samples.
- Type:
float
- offset#
Offset for the world’s position.
- Type:
list
- control_mode#
Control mode (‘auto’ or ‘keyboard’).
- Type:
str
- collision_mode#
Collision mode (‘stop’, , ‘unobstructed’).
- Type:
str
- obstacle_map#
None, image path (str), grid ndarray, or generator spec dict.
- mdownsample#
Downsampling factor for the obstacle map.
- Type:
int
- status#
Status of the world and objects.
- plot#
Plot configuration for the world.
Initialize the world object.
- Parameters:
name (str) – Name of the world.
height (float) – Height of the world.
width (float) – Width of the world.
step_time (float) – Time interval between steps.
sample_time (float) – Time interval between samples.
offset (list) – Offset for the world’s position.
control_mode (str) – Control mode (‘auto’ or ‘keyboard’).
collision_mode (str) – Collision mode (‘stop’, , ‘unobstructed’).
obstacle_map –
None, image path (str), grid ndarray, or generator spec dict.mdownsample (int) – Downsampling factor for the obstacle map.
plot (dict) – Plot configuration.
status (str) – Initial simulation status.
world_param_instance – Optional WorldParam instance. If provided, uses this instance for param storage; otherwise falls back to global.
- name#
- height = 10#
- width = 10#
- step_time = 0.1#
- sample_time#
- offset = None#
- count = 0#
- sampling = True#
- x_range#
- y_range#
- plot_parse = None#
- status = 'None'#
- gen_grid_map(obstacle_map: Any | None = None, mdownsample: int = 1) tuple[source]#
Generate a grid map for obstacles.
The obstacle_map value is resolved to a float64 ndarray by :pyfunc:`irsim.world.map.resolve_obstacle_map`. Accepted types:
None, path string (image), ndarray, or generator spec dict.- Parameters:
obstacle_map –
None, path string, ndarray, or generator spec dict.mdownsample (int) – Downsampling factor.
- Returns:
(grid_map, obstacle_index, obstacle_positions).- Return type:
tuple
- get_map(resolution: float = 0.1, obstacle_list: list[Any] | None = None) irsim.world.map.Map[source]#
Get the map of the world with the given resolution.
When resolution is coarser than the obstacle grid, the grid is downsampled (conservative: any obstacle in a block marks the block) so that planning and collision use the same grid. When resolution is finer than the grid, no upsampling is done; planning uses the grid resolution and a warning is emitted.
- property time: float#
Get the current simulation time.
- Returns:
Current time based on steps and step_time.
- Return type:
float
- property buffer_reso: float#
Get the maximum resolution of the world.
- Returns:
Maximum resolution.
- Return type:
float
- property logger#
Get the logger of the env_param.
- Returns:
The logger associated in the env_param.
- Return type:
Logger