flatland.trajectories.trajectory_snapshot_callbacks module#
- class flatland.trajectories.trajectory_snapshot_callbacks.TrajectorySnapshotCallbacks(trajectory: Trajectory, data_dir_override: Path | None = None, snapshot_interval: int | None = None)[source]#
Bases:
FlatlandCallbacks
FlatlandCallbacks to write env snapshots at the configured interval.
Parameters#
- trajectory: Trajectory
the trajectory
- data_dir_overridePath
use this override instead of the data_dir passed in the callback.
- snapshot_intervalint
interval to write pkl snapshots to serialised_state subdirectory of the data_dir or data_dir_override. 1 means at every step. 0 means never.
- on_episode_start(*, env: RailEnv | None = None, data_dir: Path | None = None, **kwargs) None [source]#
Callback run right after an Episode has been started.
This method gets called after env.reset().
Parameters#
- envEnvironment
the env
- data_dirPath
trajectory data dir
- kwargs:
Forward compatibility placeholder.
- on_episode_step(*, env: RailEnv | None = None, data_dir: Path | None = None, **kwargs) None [source]#
Called on each episode step (after the action(s) has/have been logged).
This callback is also called after the final step of an episode, meaning when terminated/truncated are returned as True from the env.step() call.
The exact time of the call of this callback is after env.step([action]) and also after the results of this step (observation, reward, terminated, truncated, infos) have been logged to the given episode object.
Parameters#
- envEnvironment
the env
- data_dirPath
trajectory data dir
- kwargs:
Forward compatibility placeholder.