KeyboardControlledTrajectoryViewer(episode_record: maze.core.trajectory_recording.records.trajectory_record.StateTrajectoryRecord, renderer: maze.core.rendering.renderer.Renderer, initial_step_index: int = 0, renderer_kwargs: Dict[str, Any] = None)¶
Render trajectory data with the possibility to browse back and forward through the episode steps using keyboard.
This is the simplest form of interactive rendering of episode trajectory, useful for example when rendering the trajectory ad hoc while the environment is still running. For more comfortable rendering of trajectory data inside of a Jupyter Notebook, use
The keyboard controls might not work well when run outside of terminal.
If running this through PyCharm, the “Emulate terminal in output console” options in Run/Debug configurations needs to be set to true, otherwise the keys will not be picked up correctly and this run loop will crash.
Also, the console needs to be active dor the keys to be picked up.
Run the interactive rendering loop. Waits for user input (right or left arrow), updates the step index accordingly and triggers the redraw through the renderer.