last changes
This commit is contained in:
@@ -6,6 +6,29 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CarRacingScape(Actor):
|
||||
"""
|
||||
Scape (environment) actor wrapping a CarRacing-like Gymnasium environment.
|
||||
|
||||
This actor provides an asynchronous message interface for sensors and
|
||||
actuators in the actor-based cortex architecture:
|
||||
|
||||
- Sensors request observations/features via ("sense", sid, sensor_pid).
|
||||
The scape replies to the given sensor actor with ("percept", vec).
|
||||
|
||||
- Actuators apply actions via ("action", action, actuator_pid).
|
||||
The scape performs an env.step(action) and replies with
|
||||
("result", step_reward, halt_flag) where halt_flag is 1 if the episode
|
||||
terminated or was truncated.
|
||||
|
||||
In addition, the scape automatically resets the environment when an episode
|
||||
ends (halt_flag == 1) using env.fast_reset().
|
||||
|
||||
Notes about `_stepped`:
|
||||
- Some environments do not provide a meaningful feature vector immediately
|
||||
after reset until at least one `step()` was executed.
|
||||
- `_get_features()` ensures that the environment has been stepped once
|
||||
(with a zero action) before calling `env.get_feature_vector()`.
|
||||
"""
|
||||
def __init__(self, env, name: str = "CarRacingScape"):
|
||||
super().__init__(name)
|
||||
self.env = env
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
"""
|
||||
this is a test scape for validation.
|
||||
"""
|
||||
from mathema.actors.actor import Actor
|
||||
import math
|
||||
import logging
|
||||
|
||||
Reference in New Issue
Block a user