Configuration Dataclasses#
All robot worlds and robots are configured through immutable dataclasses. You can either use the built-in named configs or build your own by constructing these dataclasses directly.
RobotConfig#
Controls the robot’s appearance and starting direction.
Field |
Default |
Description |
|---|---|---|
|
none |
Identifier string |
|
|
RGBA color of the robot body |
|
|
Initial heading in degrees (90 = right) |
Built-in configs: "standard" (red), "blue" (blue).
WorldConfig#
Controls the world layout, objects, allowed abilities, and win condition.
Field |
Default |
Description |
|---|---|---|
|
none |
Identifier string |
|
|
Grid width |
|
|
Grid height |
|
|
Pixel size of each tile |
|
light green |
Background fill color |
|
|
Tuple of |
|
empty |
|
|
|
Abilities the robot exposes |
ObjectConfig#
Describes a single pre-placed object.
Field |
Description |
|---|---|
|
|
|
|
TargetConfig#
Describes the win condition checked by RobotWorld.is_solved().
All fields are optional; only non-None fields are checked.
Field |
Description |
|---|---|
|
Required final tile position |
|
Required final heading |
|
Exact number of steps the robot must have taken |
|
Required set of remaining |
Custom world example#
from miniworlds_robot import RobotWorld, load_robot
from miniworlds_robot.config import WorldConfig, ObjectConfig, TargetConfig
config = WorldConfig(
name="my_task",
columns=5,
rows=5,
objects=(ObjectConfig("leaf", (3, 2)),),
target=TargetConfig(robot_position=(4, 2), objects=()),
robot_abilities=frozenset({"step", "on_leaf", "remove_leaf"}),
)
world = RobotWorld(config)
robot = load_robot(world=world)