-
Notifications
You must be signed in to change notification settings - Fork 153
Feat: Phone teleoperation stack with Go2 example #1280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
c04454d
initial commit
ruthwikdasyam d2a9b64
Feat: Added add/sub operations
ruthwikdasyam 71c43dc
Feat: Added phone_teleop blueprints
ruthwikdasyam 42b5833
Feat/Misc - phoneteleop with go2, renamed files
ruthwikdasyam f2a482d
CI code cleanup
ruthwikdasyam f9d3ac7
Misc: Added imports, formatting
ruthwikdasyam 440ab9b
Fix: pre-commit errors
ruthwikdasyam f66333e
Feat: launch deno server with teleop module
ruthwikdasyam 80bfe41
Feat: 50hz fixed, new port 8444
ruthwikdasyam a804625
Fix: button margin auto
ruthwikdasyam 4ed86f8
Feat: server stop with timeout and kill
ruthwikdasyam 91bfaf5
Fix: pre-commit errors
ruthwikdasyam b4b3e5f
Merge branch 'dev' into ruthwik_iphone_teleop
ruthwikdasyam 5164357
blueprints update
ruthwikdasyam beb8fd1
Fix: mypy errors
ruthwikdasyam df08e54
Fix: if doesnt die - check - greptile issue
ruthwikdasyam be33ee4
Merge branch 'dev' into ruthwik_iphone_teleop
ruthwikdasyam 0c66ae5
changed 'hold_to_teleop' button position + topic names
ruthwikdasyam 4c9ffe5
Misc: transports autoconnect (matching names)
ruthwikdasyam db9ec28
Misc: remove redundant docstrings and logging
ruthwikdasyam 7642d09
Fix: Module works for any robot that takes twist input
ruthwikdasyam f2613da
Fix: add threading
ruthwikdasyam 1b5aaee
Fix: pre-commit errors
ruthwikdasyam 068b47a
Fix: updated to single subclass
ruthwikdasyam f0c5e7a
Fix: blueprints order
ruthwikdasyam 94c198a
Fix: mypy errors
ruthwikdasyam e859187
Feat: deno check
ruthwikdasyam 4fc9ff9
Fix: remove base protocol
ruthwikdasyam ec4eb16
Feat: no protocol, no rpc calls, comments updated
ruthwikdasyam 2e8576e
Misc: comments
ruthwikdasyam c6f57ab
Misc: comments + html button status fix
ruthwikdasyam 9c1b68b
Fix: rpc to start/stop
ruthwikdasyam 5909831
Merge branch 'dev' into ruthwik_iphone_teleop
ruthwikdasyam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # Phone Teleop | ||
|
|
||
| Teleoperation via smartphone motion sensors. Tilt to drive. | ||
|
|
||
| ## Architecture | ||
|
|
||
| ``` | ||
| Phone Browser (DeviceOrientation + DeviceMotion) | ||
| | | ||
| | TwistStamped + Bool via WebSocket | ||
| v | ||
| Deno Bridge (teleop_server.ts) | ||
| | | ||
| | LCM topics | ||
| v | ||
| PhoneTeleopModule | ||
| | Orientation delta from home pose | ||
| | Gains -> velocity commands | ||
| v | ||
| TwistStamped / Twist outputs | ||
| ``` | ||
|
|
||
| ## Modules | ||
|
|
||
| ### PhoneTeleopModule | ||
| Base module. Receives raw sensor data and button state. On engage (button hold), captures home orientation and publishes deltas as TwistStamped. Launches the Deno bridge server automatically. | ||
|
|
||
| ### SimplePhoneTeleop | ||
| Filters to mobile-base axes (linear.x, linear.y, angular.z) and publishes as `Twist` on `cmd_vel` for direct autoconnect wiring with any module that has `cmd_vel: In[Twist]`. | ||
|
|
||
| ## Subclassing | ||
|
|
||
| Override these methods: | ||
|
|
||
| | Method | Purpose | | ||
| |--------|---------| | ||
| | `_handle_engage()` | Customize engage/disengage logic | | ||
| | `_should_publish()` | Add conditions for when to publish | | ||
| | `_publish_msg()` | Change output format | | ||
|
|
||
| **Do not acquire `self._lock` in overrides.** The control loop already holds it. | ||
|
|
||
| ## LCM Topics | ||
|
|
||
| | Topic | Type | Description | | ||
| |-------|------|-------------| | ||
| | `/phone_sensors` | TwistStamped | linear=(roll,pitch,yaw) deg, angular=(gyro) deg/s | | ||
| | `/phone_button` | Bool | Teleop engage button (1=held) | | ||
| | `/teleop/twist` | TwistStamped | Output velocity command | | ||
|
|
||
| ## Running | ||
|
|
||
| ```bash | ||
| dimos run phone-go2-teleop # Go2 | ||
| dimos run simple-phone-teleop # Generic ground robot | ||
| ``` | ||
|
|
||
| Server starts on port `8444`. Open `https://<host-ip>:8444` on phone, accept the self-signed certificate, allow sensor permissions, connect, hold button to drive. | ||
|
|
||
| ## File Structure | ||
|
|
||
| ``` | ||
| phone/ | ||
| ├── phone_teleop_module.py # Base phone teleop module | ||
| ├── phone_extensions.py # SimplePhoneTeleop | ||
| ├── blueprints.py # Pre-wired configurations | ||
| └── web/ | ||
| ├── teleop_server.ts # Deno WSS-to-LCM bridge | ||
| └── static/index.html # Mobile web app | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright 2025-2026 Dimensional Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from dimos.core.blueprints import autoconnect | ||
| from dimos.robot.unitree.go2.blueprints.basic.unitree_go2_basic import unitree_go2_basic | ||
| from dimos.teleop.phone.phone_extensions import simple_phone_teleop_module | ||
|
|
||
| # Simple phone teleop (mobile base axis filtering + cmd_vel output) | ||
| simple_phone_teleop = autoconnect( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice |
||
| simple_phone_teleop_module(), | ||
| ) | ||
|
|
||
| # Phone teleop wired to Unitree Go2 | ||
| phone_go2_teleop = autoconnect( | ||
| simple_phone_teleop_module(), | ||
| unitree_go2_basic, | ||
| ) | ||
|
|
||
|
|
||
| __all__ = ["phone_go2_teleop", "simple_phone_teleop"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright 2025-2026 Dimensional Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """Phone teleop module extensions. | ||
|
|
||
| Available subclasses: | ||
| - SimplePhoneTeleop: Filters to ground robot axes and outputs cmd_vel: Out[Twist] | ||
| """ | ||
|
|
||
| from dimos.core import Out | ||
| from dimos.msgs.geometry_msgs import Twist, TwistStamped, Vector3 | ||
| from dimos.teleop.phone.phone_teleop_module import PhoneTeleopModule | ||
|
|
||
|
|
||
| class SimplePhoneTeleop(PhoneTeleopModule): | ||
| """Phone teleop for ground robots. | ||
|
|
||
| Filters the raw 6-axis twist to mobile base axes (linear.x, linear.y, angular.z) | ||
| and publishes as Twist on cmd_vel for direct autoconnect wiring with any | ||
| module that has cmd_vel: In[Twist]. | ||
| """ | ||
|
|
||
| cmd_vel: Out[Twist] | ||
|
|
||
| def _publish_msg(self, output_msg: TwistStamped) -> None: | ||
| self.cmd_vel.publish( | ||
| Twist( | ||
| linear=Vector3(x=output_msg.linear.x, y=output_msg.linear.y, z=0.0), | ||
| angular=Vector3(x=0.0, y=0.0, z=output_msg.linear.z), | ||
| ) | ||
| ) | ||
|
|
||
|
|
||
| simple_phone_teleop_module = SimplePhoneTeleop.blueprint | ||
|
|
||
| __all__ = [ | ||
| "SimplePhoneTeleop", | ||
| "simple_phone_teleop_module", | ||
| ] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.