WebViewer#
The main interface for starting and managing the web viewer server.
Purpose#
WebViewer provides a high-level interface to start, manage, and control the web viewer server. It handles the initialization of both the server and sender components, and provides methods for frame transmission and server lifecycle management.
Constructor#
WebViewer(
host: str = "127.0.0.1",
port: int = 8000,
log_level: str = "info",
server_log_level: str = "warning",
**kwargs
)
Parameters#
Methods#
run(use_thread: bool = True, wait_for_startup: int = 2)
#
Start the server and initialize the viewer.
Parameters:
stop()
#
Stop the server and cleanup resources.
send_frame(state: State, env_id: int = 0)
#
Send a frame to the viewer.
Parameters:
state
(Brax State): Brax environment state to sendenv_id
(int): Environment ID for batched environments (default: 0)
stitch_state(batched_state: State) -> State
#
Convert batched state to single state.
Parameters:
batched_state
(Brax State): Batched state from environment
Returns:
Brax State: Single environment state
log(message: str, level: str = "info")
#
Log a message with specified level.
Parameters:
Properties#
rendering_enabled
#
Get or set the rendering enabled state.
Type: bool
Access: Read/Write