Skip to content

Studio

bt.studio(scene) serves the 3D studio on 127.0.0.1 and opens a browser. The UI and your Python session share one scene: dragging the TCP gizmo runs IK and the new joint values are visible from Python, and scene.set_tcp_target(...) moves the robot in the browser.

bt.studio(scene)                          # blocks until Ctrl-C

server = bt.studio(scene, block=False)    # or keep working in the same script
print(server.url)
server.stop()

The studio assets must be present

Wheels bundle the built UI. In a source checkout, run ./scripts/build_studio.sh first, or point BOTRAIL_STUDIO_DIR at a built studio dist directory.

studio

studio(
    scene: Scene,
    *,
    host: str = "127.0.0.1",
    port: int = 0,
    open_browser: bool = True,
    block: bool = True,
    physics=None,
    view: tuple[
        tuple[float, float, float],
        tuple[float, float, float],
    ]
    | None = None,
) -> StudioServer | None

Serves the studio UI for scene and (by default) opens a browser.

With block=True (default) this runs until Ctrl-C. With block=False it returns a :class:StudioServer handle; the server stops when the handle is garbage collected or stop() is called.

physics is what the studio's physics toggle bakes under: None (the default) the whole cell — bt.Physics(world=True), every obstacle and robot the engine's, ground at z = 0 —, a bt.Physics(...) exactly that (powered=False makes the toggle a power cut), False no physics on this host (the toggle reports it).

view=(eye, target) sets the initial orbit view in the printed/opened browser URL, with both points in world metres. The returned server's url remains the base endpoint.

StudioServer

The handle returned by studio(..., block=False). The server also stops when the handle is garbage-collected.

StudioServer

Handle to a running studio server. Dropping it (or calling stop) shuts the server down.

url property

url