irsim.world.world#

Classes#

World

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', **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#

Image file for the obstacle map.

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 – Image file for the obstacle map.

  • mdownsample (int) – Downsampling factor for the obstacle map.

  • plot (dict) – Plot configuration.

  • status (str) – Initial simulation status.

name#
height = 10#
width = 10#
step_time = 0.1#
sample_time = None#
offset = None#
count = 0#
sampling = True#
x_range#
y_range#
plot_parse = None#
status = 'None'#
step() None[source]#

Advance the simulation by one step.

gen_grid_map(obstacle_map: str | None, mdownsample: int = 1) tuple[source]#

Generate a grid map for obstacles.

Parameters:
  • obstacle_map – Path to the obstacle map image.

  • mdownsample (int) – Downsampling factor.

Returns:

Grid map, obstacle indices, and 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.

reset() None[source]#

Reset the world simulation.

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

rgb2gray(rgb: numpy.ndarray) numpy.ndarray[source]#