rlmesh.View
How to show a live eval. Pass to run / session as view=.
View(
backend: str = 'terminal',
port: int = 8008,
fps: int = 30,
source: str | None = None,
format: str = 'jpeg',
quality: int = 75,
hold: bool | float = False,
step_hz: float | None = None,
)The common cases are the string shorthands "terminal" / "http" /
"http:9000" / "both"; construct a View directly only to tune.
Attributes
- backendWhere to draw --
"terminal"(in-place half-blocks),"http"(a local web page), or"both". - portHTTP port for the
"http"/"both"backends. - fpsTarget frame rate; frames produced faster are dropped.
- sourceWhich source to show first by label (a render label or an image role);
Noneshows the env's first declared image role, or itsrender()frame when it declares none. - formatEncoding for HTTP frames,
"jpeg"or"png". - qualityJPEG quality 1..100 (ignored for PNG).
- holdKeep the viewer up after the session ends, showing the final frame and HUD:
Trueuntil you quit it (q/Escin the terminal, the quit button on the HTTP page, or Ctrl-C), a number of seconds to hold at most that long. - step_hzPace the session's env steps to at most this many per second, so a fast sim plays back at a watchable rate (set it to the env's control rate for real time).
backend
attribute[source]backend: strWhere to draw – "terminal" (in-place half-blocks), "http" (a local web page), or "both".
port
attribute[source]port: intHTTP port for the "http" / "both" backends.
fps
attribute[source]fps: intTarget frame rate; frames produced faster are dropped. This only thins the drawing: the eval itself still runs flat out (see step_hz).
source
attribute[source]source: str | NoneWhich source to show first by label (a render label or an image role); None shows the env’s first declared image role, or its render() frame when it declares none.
format
attribute[source]format: strEncoding for HTTP frames, "jpeg" or "png".
quality
attribute[source]quality: intJPEG quality 1..100 (ignored for PNG).
hold
attribute[source]hold: bool | floatKeep the viewer up after the session ends, showing the final frame and HUD: True until you quit it (q / Esc in the terminal, the quit button on the HTTP page, or Ctrl-C), a number of seconds to hold at most that long. False (the default) closes the viewer with the session. The hold follows only a session that ended normally: one closing on an error or KeyboardInterrupt skips it and raises at once. An unbounded hold needs someone to quit it: with no interactive terminal (stdin not a tty, as in CI; the terminal backend also needs stdout to be one) it is skipped with a warning rather than blocking forever, on every backend. A number of seconds is bounded and holds regardless.
step_hz
attribute[source]step_hz: float | NonePace the session’s env steps to at most this many per second, so a fast sim plays back at a watchable rate (set it to the env’s control rate for real time). The session sleeps after each step until the next step is due; a step slower than the period is never sped up, and the lost time is not made up with a burst. None (the default) runs as fast as it can.