flatland.trajectories.trajectory_observation_callbacks module#
- class flatland.trajectories.trajectory_observation_callbacks.TrajectoryObservationCallbacks(trajectory: Trajectory, data_dir_override: Path | None = None, format: Literal['pkl', 'mpk'] = 'pkl')[source]#
Bases:
FlatlandCallbacks
FlatlandCallbacks to write observations.
Parameters#
- trajectory: Trajectory
the trajectory
- data_dir_overridePath
use this override instead of the data_dir passed in the callback.
- 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.