swarmsim.world.objects.StaticObject#

Module for StaticObject class.

StaticObject is a class for objects that do not move.

It is a subclass of StaticAgent and is basically the same except it does not step() or draw_direction().

Object Config Class#

class swarmsim.world.objects.StaticObject.StaticObjectConfig(position: tuple[float, ...] | numpy.ndarray = (0, 0), angle: float | typing.Any = 0.0, name: str | typing.Any = None, controller: typing.Any | None = None, grounded: bool = True, collides: bool | int = True, sensors: list = <factory>, team: str | None = None, seed: int | None | str = 'unspecified', agent_radius: float = 0.0, body_color: tuple[int, int, int] = (255, 255, 255), body_filled: bool = False, points: list[tuple[float, float]] | numpy.ndarray | str = <factory>, anchor_point: None | tuple[float, float] | str = None, debug: bool = False)[source]#
Attributes:
anchor_point
controller
name
team

Methods

as_config_dict

as_dict

as_generator

asdict

attach_world_config

from_dict

agent_radius: float = 0.0[source]#

The radius of the agent.

Type:

float

anchor_point: None | tuple[float, float] | str = None[source]#
angle: float | Any = 0.0[source]#
as_config_dict()[source]#
as_dict()[source]#
as_generator()[source]#
asdict()[source]#
attach_world_config(world_config)[source]#
body_color: tuple[int, int, int] = (255, 255, 255)[source]#

The body color of the agent.

Type:

tuple[int, int, int]

body_filled: bool = False[source]#

Whether the body is filled.

Type:

bool

collides: bool | int = True[source]#

Whether the agent collides with other agents.

Type:

bool | int

controller: Any | None = None[source]#
debug: bool = False[source]#

Whether to draw the agent’s AABB in debug mode.

Type:

bool

classmethod from_dict(env)[source]#
grounded: bool = True[source]#
name: str | Any = None[source]#
points: list[tuple[float, float]] | np.ndarray | str[source]#

The points of the agent shape. If points is empty, the agent will be a circle.

Type:

list[tuple[float, float]] | np.ndarray | str

position: tuple[float, ...] | np.ndarray = (0, 0)[source]#
seed: int | None | str = 'unspecified'[source]#
sensors: list[source]#
team: str | None = None[source]#

Object Class#

class swarmsim.world.objects.StaticObject.StaticObject(config: StaticAgentConfig, world: RectangularWorld, name=None, initialize=True)[source]#
Attributes:
is_poly
poly_rotated
position

Alias for pos.

Methods

copy()

Create a copy of this agent.

from_config(config, world)

Returns a new agent instance from the given config and world.

getPosition()

Alias for pos.

getVelocity()

Alias for dpos.

get_aabb()

Get the agent's AABB.

get_sensors()

Alias for sensors.

make_aabb()

Return the Bounding Box of the agent

orientation_uvec([offset])

Returns the agent's 2D orientation matrix.

set_heading(new_heading)

Set the agent's heading (radians).

set_name(new_name)

Set the name of the agent.

set_pos_vec(vec)

Set the x, y, and angle of the agent.

setup_controller_from_config()

Creates and adds the AgentConfig.controller to the agent.

setup_sensors_from_config()

Creates and adds sensors from the AgentConfig.sensors to the agent.

attach_agent_to_sensors

build_collider

debug_draw

draw

draw_direction

getFrontalPoint

get_heading

get_name

get_simple_poly_radius

get_x_pos

get_y_pos

on_key_press

rotmat2d

rotmat2dT

rotmat3d

set_seed

set_x_pos

set_y_pos

step

draw_direction(screen, offset=((0, 0), 1.0))[source]#
step(check_for_world_boundaries=None, world=None, check_for_agent_collisions=None) None[source]#

Classes

StaticObject(config, world[, name, initialize])

StaticObjectConfig(position, ...)