Skip to content

sim2bot.BridgeInfo

BridgeInfo dataclass

Connection details for a local Sim2Bot bridge.

Attributes:

  • url (str) –

    JSON control and telemetry WebSocket URL.

  • video_url (str) –

    Binary camera-frame WebSocket URL.

  • health_url (str) –

    HTTP health-check URL.

  • host (str) –

    Parsed bridge host.

  • port (int) –

    WebSocket/HTTP port.

  • tcp_port (int) –

    Newline-delimited JSON TCP port.

  • udp_port (int) –

    Datagram control/telemetry port.

  • started_by_sdk (bool) –

    Whether ensure_bridge started this process.

  • pid (Optional[int]) –

    Managed bridge process ID when available.

Source code in sim2bot/bridge.py
@dataclass(frozen=True)
class BridgeInfo:
    """Connection details for a local Sim2Bot bridge.

    Attributes:
        url: JSON control and telemetry WebSocket URL.
        video_url: Binary camera-frame WebSocket URL.
        health_url: HTTP health-check URL.
        host: Parsed bridge host.
        port: WebSocket/HTTP port.
        tcp_port: Newline-delimited JSON TCP port.
        udp_port: Datagram control/telemetry port.
        started_by_sdk: Whether [`ensure_bridge`][sim2bot.bridge.ensure_bridge]
            started this process.
        pid: Managed bridge process ID when available.
    """

    url: str
    video_url: str
    health_url: str
    host: str
    port: int
    tcp_port: int
    udp_port: int
    started_by_sdk: bool = False
    pid: Optional[int] = None

Practical examples

Examples use objects discovered from the current scene rather than hard-coded robot metadata.

Inspect an automatic bridge

from sim2bot import ensure_bridge

info = ensure_bridge()
print(info.url, info.video_url)
print(info.started_by_sdk, info.pid)

Use raw transport ports

info = ensure_bridge(tcp_port=8770, udp_port=8771)
print(info.host, info.tcp_port, info.udp_port)

Guidance

Usage tip

started_by_sdk distinguishes a process this Python interpreter owns from a bridge it merely discovered.


See also