flatland.envs.record_steps_effects_generator module#

class flatland.envs.record_steps_effects_generator.RecordStepsEffectsGenerator[source]#

Bases: EffectsGenerator[RailEnv]

Records agent positions, orientations, malfunction status, state and deadlock status for each step into env.cur_episode, and the actions into self.list_actions, for every step, whenever composed into an env’s effects_generator. Whether steps are recorded at all is controlled by whether this generator is present in the chain (see RailEnv’s record_steps constructor argument), not by any flag on this class.

on_episode_step_end(env: RailEnv, action_dict: Dict[int, RailEnvActions] | None = None, *args, **kwargs) RailEnv[source]#

Called by env at the end of step before computing observations and infos.

In the future, will receive immutable state instead of full env.

Naming similar to https://docs.ray.io/en/latest/rllib/package_ref/doc/ray.rllib.callbacks.callbacks.RLlibCallback.on_episode_step.html#ray.rllib.callbacks.callbacks.RLlibCallback.on_episode_step, but modifying.

Parameters#

env: Ra args kwargs

Returns#

set_state(list_actions: List[Dict[int, RailEnvActions] | None])[source]#

Restore list_actions from persisted state, e.g. the “actions” recorded by RailEnvPersister.save_episode. Not part of the generic EffectsGenerator.__getstate__/__setstate__ roundtrip, since actions are stored under a dedicated top-level key rather than embedded in the serialized effects_generator state.