Skip to content

Conversation

@ruthwikdasyam
Copy link
Contributor

@ruthwikdasyam ruthwikdasyam commented Feb 7, 2026

Feature

  • Adding teleoperation support to DimOS stack. A way to control any robots (Arms, Quadrupeds, Humanoids) via teleop.
  • This PR sets foundation for how a device (VR, Xbox controllers, Exoskeleton, Gloves) must be laid out to expose its controls out - to be connected with any robot on dimos.
  • This PR has explicitly Implementation for the Quest3 VR headset.

Issue - Linear

closes DIM-420
closes DIM-394

Approach/Solution

Web stuff

  • WebXR captures controller poses + buttons data and sends over Websocket to Deno server
  • Deno HTTPS server bridge forwards same raw bytes over UDP multicast via LCM
  • python QuestTeleopModule subscribes to those LCM channels and decodes
  • Further, we can send LCM messages back through UDP for any Visualizations/Feedback to display in the VR

Architecture

  • QuestTeleopModule receives these Pose/Joy LCM streams. once engaged, computes deltas and publishes msg commands.
  • QuestControllerState/'QuestButtons' wraps over raw Joy messages for clean controller data access.
  • subclasses override hooks (_handle_engage, _should_publish, _get_output_pose, _publish_msg) to customize what commands get published to the robot.
  • Example implementations ArmTeleopModule (toggle-engage arm control), TwistTeleopModule (velocity commands), VisualizingTeleopModule (Rerun debug overlay) are included.

Refer for Detailed Spec

Breaking Changes

None

How to Test

If you have Quest3

  1. Start the Deno bridge: ./dimos/teleop/quest/web/teleop_server.ts
  2. In another terminal: dimos run arm-teleop-visualizing
  3. On Quest 3, open https://<host-ip>:8443 and click connect - opens passthrough
  4. Press X to engage
  • move controllers and press buttons and toggle
  • verify poses and data update in real-time in Rerun
  1. Press X again to disengage - verify poses stop updating
  2. To End: click menu button, closes passthrough view - click disconnect in VR browser

Files

  • assets/teleop_certs - for generated self-signed TLS certs
  • dimos/teleop/ - full subsystem (protocol, quest module, types, extensions, transforms, visualization, blueprints)
  • dimos/msgs/std_msgs/UInt32.py - base type for QuestButtons
  • dimos/teleop/quest/web/ - Deno bridge + WebXR client

@ruthwikdasyam ruthwikdasyam marked this pull request as ready for review February 8, 2026 05:46
@greptile-apps
Copy link

greptile-apps bot commented Feb 8, 2026

Greptile Overview

Greptile Summary

This PR adds a complete Meta Quest 3 teleoperation stack spanning:

  • WebXR client (dimos/teleop/quest/web/static/index.html) streaming PoseStamped and Joy over WebSocket at ~80Hz.
  • Deno bridge (dimos/teleop/quest/web/teleop_server.ts) serving the WebXR UI over HTTPS and forwarding raw LCM packets between browser and UDP LCM.
  • Python teleop module (dimos/teleop/quest/quest_teleop_module.py) that subscribes to VR pose/joy topics, transforms WebXR poses into the robot frame (teleop_transforms.py), computes controller deltas (via new Pose.__sub__), and publishes Pose/Twist outputs plus packed button state (QuestButtons).

The change fits into the codebase by registering new module entrypoints and blueprints (dimos/robot/all_blueprints.py, dimos/teleop/blueprints.py) so the teleop pipeline can be instantiated via the existing blueprint/module system.

Main issues to address before merge:

  • The Deno server references lcm in the request handler before it is initialized/started, causing runtime failures on first websocket traffic.
  • The Python Joy parsing path can raise unhandled ValueError (format mismatch), which can break the subscription callback.
  • The module’s conditional subscription logic (if stream.transport) can result in a “starts but never subscribes” behavior depending on how transports are attached.
  • QuestButtons bitmask mutation depends on data initialization semantics from the UInt32/LCM base class; ensure data is initialized before bit-ops are used.

Confidence Score: 2/5

  • This PR has merge-blocking runtime issues in the Deno bridge and robustness gaps in the Python input handling.
  • Score is reduced due to a definite runtime ordering bug in teleop_server.ts (server starts before LCM init), plus unhandled Joy format errors and wiring/subscription behavior that can make the module silently non-functional depending on transport setup.
  • dimos/teleop/quest/web/teleop_server.ts, dimos/teleop/quest/quest_teleop_module.py, dimos/teleop/quest/quest_types.py

Important Files Changed

Filename Overview
.gitignore Ignores generated teleop TLS cert directory under dimos/assets/teleop_certs/.
dimos/msgs/geometry_msgs/Pose.py Adds Pose.sub to compute delta pose (position subtraction + quaternion delta).
dimos/msgs/std_msgs/UInt32.py Adds ROS-compatible UInt32 wrapper; potential base-init concerns for subclasses relying on data being initialized.
dimos/teleop/blueprints.py Adds arm teleop blueprints wiring Quest teleop outputs to LCM topics.
dimos/teleop/quest/quest_teleop_module.py Implements core QuestTeleopModule with threads + RLock control loop; issues: uncaught ValueError in _on_joy, RPC/lock layering, and conditional subscription on transport.
dimos/teleop/quest/quest_types.py Adds QuestControllerState parsing and QuestButtons bitmask; potential initialization/bitmask setattr pitfalls.
dimos/teleop/quest/web/teleop_server.ts Adds Deno HTTPS+WebSocket to LCM bridge; critical bug: server starts before LCM is initialized, causing runtime failures.
dimos/teleop/utils/teleop_transforms.py Adds WebXR-to-robot transform utility using matrices + controller-specific Z rotation.

Sequence Diagram

sequenceDiagram
    participant Quest as Quest Browser (WebXR)
    participant Deno as Deno teleop_server.ts
    participant LCM as LCM bus (UDP)
    participant Py as QuestTeleopModule (Python)

    Quest->>Deno: wss:// connect
    loop ~80Hz
        Quest->>Deno: WS binary (LCM packet)<br/>/vr_left_pose, /vr_right_pose
        Quest->>Deno: WS binary (LCM packet)<br/>/vr_left_joy, /vr_right_joy
        Deno->>LCM: publishPacket(packet)
        LCM-->>Py: PoseStamped / Joy
        Py->>Py: _on_pose/_on_joy
    end

    loop 50Hz control loop
        Py->>Py: _handle_engage
        Py->>Py: _get_output_pose (delta)
        Py->>LCM: publish PoseStamped (/teleop/*)
        Py->>LCM: publish QuestButtons (/teleop/buttons)
    end

    LCM-->>Deno: subscribePacket(raw)
    Deno-->>Quest: WS binary (LCM packet)
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

8 files reviewed, 5 comments

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Feb 8, 2026

Additional Comments (5)

dimos/teleop/quest/web/teleop_server.ts
Serve starts before LCM init

Deno.serve(...) is invoked before const lcm = new LCM(); await lcm.start(); (later in the file). The HTTP handler’s websocket path uses await lcm.publishPacket(packet), but lcm hasn’t been initialized yet at server start, so the first websocket upgrade/message will throw (and likely crash the request handler). Initialize/start lcm before calling Deno.serve, or move the server startup below the LCM initialization.


dimos/teleop/quest/quest_teleop_module.py
Deadlock via re-entrant lock

_control_loop() holds self._lock for the full iteration, and _handle_engage() calls self.engage()/self.disengage() which are @rpc methods that also acquire self._lock (re-entrant). With threading.RLock this won’t deadlock, but it will run the engage logic twice through two lock layers and can block other threads longer than intended. More importantly, in subclasses overriding _handle_engage() (e.g., ArmTeleopModule), you’re calling engage()/disengage() from inside the lock-held loop too. Consider adding non-RPC internal helpers (e.g., _set_engaged(hand, bool)) that assume the lock is held, and have RPC methods delegate to them, so the control loop doesn’t go through RPC wrappers.


dimos/teleop/quest/quest_teleop_module.py
Unhandled ValueError kills callback

QuestControllerState.from_joy() raises ValueError when Joy doesn’t have the expected axis/button lengths, but _on_joy() doesn’t catch it. If the WebXR client sends fewer buttons/axes (common across browsers/firmware), the subscription callback will raise and can terminate/disable that stream. Catch ValueError here (log once/throttle) and ignore the malformed message so the module stays alive.


dimos/teleop/quest/quest_teleop_module.py
Inputs silently not subscribed

The if stream and stream.transport guard means the module won’t subscribe unless the In[...] already has a transport attached at start(). In typical blueprint wiring, the transport may be attached after instantiation but before start, but if it’s attached later (or is lazily created), this module will never subscribe and will never receive data. Subscribing unconditionally (and letting .subscribe raise if miswired) or rechecking/attaching on transport changes would prevent a “starts but does nothing” failure mode.


dimos/teleop/quest/quest_types.py
Bitmask attr set may break

QuestButtons.__setattr__ mutates self.data via self.data |= ... / &= .... If the underlying LCMUInt32 base class implements data as a property/slot without a pre-existing data attribute at construction, this can raise during from_controllers() when buttons = cls() and then buttons.left_trigger = ... runs. Ensure UInt32.__init__ runs (and sets data) for subclasses, or explicitly initialize data in QuestButtons.__init__ before using bit ops.

@ruthwikdasyam
Copy link
Contributor Author

All Greptile feedback addressed in latest commits

.gitignore Outdated
*mobileclip*
/results

dimos/assets/teleop_certs/
Copy link
Contributor

Choose a reason for hiding this comment

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

dimos/ is only for code. Should this have been assets/teleop_certs/?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, fixed this
server path + .gitignore are updated to /assets/teleop_certs/

## Running

```bash
deno run --allow-net --allow-read --allow-run --allow-write --unstable-net dimos/teleop/quest/web/teleop_server.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you have the #!/usr/bin/env -S deno run --allow-net --allow-read --allow-run --allow-write --unstable-net she-bang there, couldn't this be just:

./dimos/teleop/quest/web/teleop_server.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, updated the README and added the execute bit.
Git tracks the file mode, so it'll be executable for all after this commit.

console.log(`Server: https://localhost:${PORT}`);

// Forward all raw packets to browser (we are decoding LCM directly in the browser)
lcm.subscribePacket((packet) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

oof you are sending ALL of the dimos pubsub packets into quest, this is A LOT of data that's not being processed at all, just loads the CPU and I assume will crash on applications that involve cameras or sensors

ws.onclose = () => {
setStatus('WebSocket closed');
};
ws.onmessage = () => {};
Copy link
Contributor

Choose a reason for hiding this comment

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

as you are forwarding every pubsub message, this function is actually called at hundreds or thousands of times a second

buttons.push(gamepad.buttons[i]?.pressed ? 1 : 0);
}

const joyMsg = new sensor_msgs.Joy({
Copy link
Contributor

Choose a reason for hiding this comment

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

nice, yes, that looks like a correct msg

Copy link
Contributor

@leshy leshy left a comment

Choose a reason for hiding this comment

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

there is this issue with forwarding all LCM packets to quest otherwise looks good.

Generally for PRs pls include an example how to run this so people can test easily, I'm missing for example an XAarm teleop blueprint or something to make it clear how this is to be used

Deno server that bridges WebSocket and LCM:
- Serves WebXR client over HTTPS (required for Quest)
- Forwards controller data from browser to LCM
- Forwards LCM packets to browser
Copy link
Contributor

Choose a reason for hiding this comment

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

it shouldn't forward any LCM packets to browser right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay yes. Was trying out sending images to display them in the headset. This PR doesn't have it - not forwarding any messages to the browser. Let me remove the lines related to it. Thanks for pointing it out!

document.getElementById('status').textContent = `Error: ${msg}`;
};

import { encodePacket, geometry_msgs, std_msgs, sensor_msgs } from "https://esm.sh/jsr/@dimos/msgs@0.1.4";
Copy link
Contributor

Choose a reason for hiding this comment

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

all good, just so we are aware, dependancy on the external package sstore makes the system not work without an internet connection on quest

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, its loading the msgs package from an external CDN at runtime. can mention this somewhere in README for now.

@@ -0,0 +1,95 @@
#!/usr/bin/env -S deno run --allow-net --allow-read --allow-run --allow-write --unstable-net
Copy link
Contributor

Choose a reason for hiding this comment

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

for the next pass, generally I'd want to auto-start this somehow as a part of the blueprint, so I don't need an extra terminal when testing.. issue here is that this is TS so not a standard dimos module. we could add an empty hosting module that just runs the TS file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, i was thinking about it. would be nice if we auto-start in the blueprint

Copy link
Contributor

@leshy leshy Feb 9, 2026

Choose a reason for hiding this comment

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

I think actual QuestTeleopModule should start this and stop it maybe? would this make it easily usable in blueprints? How come there is no example blueprint that works with xarm btw?

Copy link
Contributor Author

@ruthwikdasyam ruthwikdasyam Feb 9, 2026

Choose a reason for hiding this comment

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

That might be one way to do it. If QuestTeleopModule.start() autolaunches the server and if stop() kills it, there's no need for extra terminal, and nothing to mention in blueprint. This can be implemented using subprocess, and can be solved by making few additions in start() and stop().
But, this involves including server related lines in the Module, which doesn't feel very good. Receiving msgs from device via LCM gave us the benefit to keep the module independent of server/ws related code. So, not entirely sure on this.

Anonther pro - This webserver and deno bridge are explicitly for quest. so, just including its lifecycle with the quest module makes sense, rather than another hosting module to connect with quest module.
Its highly unlikely we would use that TS-server-module to connect with a non-quest module.

Copy link
Contributor Author

@ruthwikdasyam ruthwikdasyam Feb 9, 2026

Choose a reason for hiding this comment

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

Reg xarm+quest_teleop blueprint, as mentioned in the below comment - few changes and additions are required in dioms/control/tasks for the teleop to work with arms. So, preparing to make another short PR for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

In terms of pro/cons - you are designing an interface, think about what other developer "as a user" wants from you. They don't want to know or mange your lifecycle or implementation details, is it deno server? is it .apk using TCP? no one wants to know actually.

Ideally a dev can think only about stuff they care about, so topics you provide for teleop and start/stop, the rest is implementation details. so IMO starting a server (and whatever else you need to provide your interface) is ok but approving the PR for now and you can iterate

@ruthwikdasyam
Copy link
Contributor Author

ruthwikdasyam commented Feb 8, 2026

there is this issue with forwarding all LCM packets to quest otherwise looks good.

Modified - No forwarding to quest in this PR. Will be adding this feature later

Generally for PRs pls include an example how to run this so people can test easily, I'm missing for example an XAarm teleop blueprint or something to make it clear how this is to be used

yes, added test in PR description. We can run a blueprint and see poses and button presses through rerun viz.
Did test with xarm, and that requires few upgrades with the arm controls. I have it ready, will be making a seperate PR for that. Thus, we will have a quest-xarm-teleop blueprint to test.

@leshy
Copy link
Contributor

leshy commented Feb 9, 2026

#1222 there is a way to do this without a separate TS server, others can prioritize when/if to do this

@ruthwikdasyam
Copy link
Contributor Author

#1222 there is a way to do this without a separate TS server, others can prioritize when/if to do this

Great. Will look into this, and any other alternatives too. I was trying a similar approach having a weserver on python side and receiving msgs in JSON. But, switched to have it in LCM to maintain DimOS style
Prioritizing and making it a single module will help, as this design will be carried to other teleop-device integrations as well.

Copy link
Contributor

@leshy leshy left a comment

Choose a reason for hiding this comment

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

approving with proposed imho better approach #1222

@leshy leshy merged commit 020105c into dev Feb 9, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants