Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions dimos/protocol/pubsub/impl/webrtc/providers/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
The aiortc/CF quirks this inherits (MAX_BUNDLE, the id=0 throwaway channel)
are documented in ``dimos/teleop/quest_hosted/README.md``.

``robot_id`` is a per-transport label (set on ``CloudflareTransport`` /
``BrokerConfig``) distinguishing multiple robots under one key — it lives on
the transport, not the process, so two robots on one machine stay distinct.

Env vars (fallback when config fields are unset):
TELEOP_BROKER_URL — default https://teleop.dimensionalos.com
TELEOP_API_KEY — robot API key (dtk_live_*); the broker derives the
robot identity from it
TELEOP_ROBOT_ID — optional robot identifier override (must match the
key's namespaced robot id when set)
TELEOP_ROBOT_NAME — human-readable robot name
"""

Expand Down Expand Up @@ -109,7 +111,7 @@ def __init__(self, config: BrokerConfig | None = None) -> None:
or os.environ.get("TELEOP_BROKER_URL", "https://teleop.dimensionalos.com")
).rstrip("/")
self._api_key = config.api_key or os.environ.get("TELEOP_API_KEY", "")
self._robot_id = config.robot_id or os.environ.get("TELEOP_ROBOT_ID", "")
self._robot_id = config.robot_id or ""
self._robot_name = config.robot_name or os.environ.get("TELEOP_ROBOT_NAME", "robot")
if not self._api_key:
raise RuntimeError(
Expand Down
6 changes: 5 additions & 1 deletion dimos/teleop/quest_hosted/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@
# CloudflareTransport("state_reliable_back", ...) the same way.
#
# Run: TELEOP_API_KEY=dtk_live_... dimos run teleop-hosted-go2-transport
# (robot identity is derived from the key; TELEOP_ROBOT_ID optional)
# then connect from https://teleop.dimensionalos.com (keyboard view).
#
# robot_id is a per-transport kwarg (rides the pickled config to the provider),
# so running several robots off one key just means a distinct id per blueprint —
# e.g. CloudflareTransport("cmd_unreliable", TwistStamped, robot_id="go2-a").
# Omitted here → empty; the broker still keeps sessions distinct by session id.
Comment on lines +73 to +76

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 The example sets robot_id only on CloudflareTransport while leaving CloudflareVideoTransport() with no robot_id. Because ProviderConfig.provider() is a per-process singleton keyed on config equality, a data transport with BrokerConfig(robot_id="go2-a") and a video transport with BrokerConfig(robot_id="") resolve to two different providers — two separate broker sessions. Video lands on one session; data channels on the other, silently breaking teleop. The robot_id must be set identically on every transport in the blueprint that should share a session.

Suggested change
# robot_id is a per-transport kwarg (rides the pickled config to the provider),
# so running several robots off one key just means a distinct id per blueprint —
# e.g. CloudflareTransport("cmd_unreliable", TwistStamped, robot_id="go2-a").
# Omitted here → empty; the broker still keeps sessions distinct by session id.
# robot_id is a per-blueprint label: every transport in the blueprint must carry
# the same robot_id so they all resolve to the same per-process provider
# singleton (configs are compared by equality — a mismatch creates two separate
# broker sessions, splitting data channels from the video track).
# e.g. CloudflareTransport("cmd_unreliable", TwistStamped, robot_id="go2-a"),
# CloudflareVideoTransport(robot_id="go2-a")
# Omitted here → empty; the broker still keeps sessions distinct by session id.

teleop_hosted_go2_transport = unitree_go2_basic.transports(
{
("cmd_vel", Twist): CloudflareTransport("cmd_unreliable", TwistStamped),
Expand Down
Loading