mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-06-23 12:01:36 +02:00
Description and better naming scheme for the Door-Module
This commit is contained in:
@ -60,7 +60,7 @@ Just define what your environment needs in a *yaml*-configfile like:
|
|||||||
done_at_collisions: !!bool True
|
done_at_collisions: !!bool True
|
||||||
ItemRespawn:
|
ItemRespawn:
|
||||||
spawn_freq: 5
|
spawn_freq: 5
|
||||||
DoorAutoClose: {}
|
DoDoorAutoClose: {}
|
||||||
|
|
||||||
Assets:
|
Assets:
|
||||||
- Defaults
|
- Defaults
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from .actions import DoorUse
|
from .actions import DoorUse
|
||||||
from .entitites import Door, DoorIndicator
|
from .entitites import Door, DoorIndicator
|
||||||
from .groups import Doors
|
from .groups import Doors
|
||||||
from .rules import DoorAutoClose, DoorIndicateArea
|
from .rules import DoDoorAutoClose, IndicateDoorAreaInObservation
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
from marl_factory_grid.environment.rules import Rule
|
|
||||||
from marl_factory_grid.environment import constants as c
|
from marl_factory_grid.environment import constants as c
|
||||||
|
from marl_factory_grid.environment.rules import Rule
|
||||||
from marl_factory_grid.utils.results import TickResult
|
from marl_factory_grid.utils.results import TickResult
|
||||||
from . import constants as d
|
from . import constants as d
|
||||||
from .entitites import DoorIndicator
|
from .entitites import DoorIndicator
|
||||||
|
|
||||||
|
|
||||||
class DoorAutoClose(Rule):
|
class DoDoorAutoClose(Rule):
|
||||||
|
|
||||||
def __init__(self, close_frequency: int = 10):
|
def __init__(self, close_frequency: int = 10):
|
||||||
|
"""
|
||||||
|
This rule closes doors, that have been opened automatically, when no entity is blocking the position.
|
||||||
|
|
||||||
|
:type close_frequency: int
|
||||||
|
:param close_frequency: How many ticks after opening, should the door close?
|
||||||
|
"""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.close_frequency = close_frequency
|
self.close_frequency = close_frequency
|
||||||
|
|
||||||
@ -22,9 +28,16 @@ class DoorAutoClose(Rule):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
class DoorIndicateArea(Rule):
|
class IndicateDoorAreaInObservation(Rule):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
"""
|
||||||
|
Whether to add an indicator aka place a value around doors (within the door tile), for agents to see.
|
||||||
|
This could improve learning.
|
||||||
|
|
||||||
|
"""
|
||||||
|
# Todo: Discuss if this rather be a single entity with a standalone observation.
|
||||||
|
# Could then be combined with the "Combine"-approach.
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def on_init(self, state, lvl_map):
|
def on_init(self, state, lvl_map):
|
||||||
|
Reference in New Issue
Block a user