Skip to content
Proyectos

V4C38/dimensional-os-ar

Ver en GitHub

Acerca de

Snap Spectacles AR integration with Dimensional OS - contoller for Unitree GO2 and G1 robots.

Ciencia e ingeniería

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
0
in 7 days
Recopilando historial
in 15 days
Recopilando historial
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

Spectacles AR for Robotics and Physical AI

GitHub MIT License Stars Forks Contributors

TypeScript Python

This project explores the use of Augmented Reality as an interface for robotics and physical AI in the context of navigation tasks and sensor data visualization.
AR glasses: Snap Spectacles 2024 developer kit. Robot: Unitree Go2 quadruped or G1 humanoid. Controlled via Dimensional OS which handles the entire physical stack, incl. navigation and LiDAR data streaming.

Setup • System Design • Augmented Reality Interface • Pose Drift

Spectacles AR manual control of a Unitree Go2

Supported Hardware

Quadruped Humanoid
🟩 Unitree Go2 pro/air
Fully supported & tested
🟧 Unitree G1
Supported, not tested - looking for collaborators

Setup

Mac which runs DimOS, Spectacles AR glasses and the robot need to be on the same WiFi with a stable internet connection.

Via launcher (recommended)DimOS AR Bridge launcher: robot stack, Bridge IP, OPENAI_API_KEY, AprilTags, and log

The launcher is a small web app that runs on your Mac and manages Dimensional OS and the AR Bridge in a clean UI.
It installs and configures both if needed, handles robot network discovery, generates and configures the AprilTag settings, and starts or stops the bridge. The Log also shows detailed output which is useful for debugging.

Double-click launcher/Start Launcher.command in Finder, or run:

cd /path/to/spectacles-dimensional-os
./launcher/scripts/start-launcher.sh

Your browser opens at http://127.0.0.1:8790. Leave the terminal window it started from open, closing it stops the launcher.

The Dependencies tab allows installing and configuring dependencies based on your selected stack (Go2 / G1), choose whether to reuse a Dimensional OS install you already have or download a fresh one, then press Install. This can take a while.

Every run: pick Unitree Go2 or Unitree G1, press Start, and wait for status to turn to Bridge Ready. The value shown as Bridge IP is the address you type into the Lens during the setup wizard. If no robot answers on the network, the bridge starts with a simulated robot instead.

macOS asks for your admin password the first time you start after a reboot. Dimensional OS needs a local network route and larger socket buffers for its internal messaging.

Via manual install

The launcher runs two scripts, and you can run them yourself.

launcher/scripts/setup.sh locates a Dimensional OS install or clones one into ../dimos, then installs this repo's dimos-ar package into that same Python environment and runs its tests. Add --stack g1 if you need the G1 navigation stack, which requires Dimensional OS from source.

./launcher/scripts/setup.sh

launcher/scripts/start.sh applies the macOS network settings, asks which robot stack to run, looks for the robot on the network, and boots the bridge on port 8787. The log prints the address to enter on Spectacles. Set OPENAI_API_KEY beforehand if you want Agent Mode, and ROBOT_IP to skip discovery.

./launcher/scripts/start.sh

To skip the scripts entirely, install Dimensional OS yourself, add the bridge to the same environment, and start a blueprint directly:

cd /path/to/spectacles-dimensional-os/dimos-ar
/path/to/dimos/.venv/bin/python3 -m pip install -e ".[dev]"

sudo ../launcher/scripts/configure-system.sh --apply

export ROBOT_IP=<robot-lan-ip>   # or "fake" for a simulated robot
/path/to/dimos/.venv/bin/python3 -c "
import sys
sys.path.insert(0, '.')
from dimos.core.coordination.module_coordinator import ModuleCoordinator
from dimos.ar.blueprints import ar_go2
ModuleCoordinator.build(ar_go2).loop()
"

Use ar_g1 instead of ar_go2 for the humanoid.

AprilTag setup

The frames of the glasses and the robot are aligned by the glasses detecting a mounted AprilTag at a known location on the robot.
In the Launcher, open Config, click the tag image to get a printable PDF, and print it at 100% scale with no page scaling. Then mount it at the location as indicated in the table below. You can change the size, count and transform of the tag(s) as you see fit.

Unitree Go2 Unitree G1
Default AprilTag mount location on Unitree Go2 Default AprilTag mount locations on Unitree G1
One tag, ID 0, printed at 70 mm.

It lies flat on top of the body, 18 cm ahead of the robot center and 6 cm up, tilted slightly backwards due to body shape.
Two tags, ID 0 and ID 1, printed at 70 mm.

ID 0 sits on the chest panel, ID 1 sits on the back panel. Both are centered left to right. Two tags let the Lens see the robot from either side. The torso shell is curved, so a larger tag would not seat flat.
Note: this has not been tested on a G1 yet.

If you want to mount a tag somewhere else, change its ID, size and offsets in the launcher under Config. Adding a second tag that is visible from the start will significantly improve the initial yaw calibration.

The defaults can be found in go2.py and g1.py if you do not want to use the launcher.

Register inside Spectacles Lens

Open lens-studio/spectacles-dimensional-os.esproj in Lens Studio and send the Lens to your Spectacles (Lens with experimental API enabled cannot be published so you need to upload via LS). The Registration Wizard walks you through connecting and locating the robot. Enter the Bridge IP from the launcher when asked.

Registration wizard on Spectacles: connect, scan tag, finish setup

Leave the robot standing still and walk around it while looking at the tag. Registration finishes on its own once it has gathered sufficient tag sightings. Keep viewing distance about 0.5 - 1.5 meters. Alternatively, switch to Manual Placement, where you drag a marker onto the robot by hand - this doesn`t require printing and mounting the tag but yields much lower accuracy and will not support runtime drift correction.

Alignment is rough at first and gets better as the robot moves and more tag sightings are integrated into the world frame calibration.

System Design

Dimensional OS runs the robot. It owns the connection to the Go2 or G1, builds a map out of the LiDAR, plans routes through that map and handles the navigation. In Agent Mode it also runs the language model behind your voice commands.

The DimOS AR-Bridge is the main addition of this repo. It streams the robot's position, route and LiDAR over a WebSocket and takes navigation goals and other commands back. It is responsible for aligning both glasses and robot coordinate systems via the mounted AprilTag.

The bridge is designed to be device agnostic. Clients implement PROTOCOL.md as the communication protocol for all messages.

The Spectacles Lens is the reference client. It renders the robot and its route, reads hand gestures, sends camera images the bridge requires for AprilTag based frame alignment and handles speech.

flowchart LR
  Robot["Unitree<br>Go2 / G1"]

  subgraph DimOS["Dimensional OS (Mac)"]
    direction TB
    Stack["Robot stack<br>connection · mapping · planning · agent"]
    Bridge["AR-Bridge · dimos-ar<br>world alignment · WebSocket server"]
    Stack <--> Bridge
  end

  Lens["Spectacles Lens<br>lens-studio"]

  Robot <-->|"WebRTC / DDS"| Stack
  Bridge <-->|"WebSocket protocol"| Lens
Architecture overview

DimOS AR-Bridge

Python package under dimos/ar/, loaded by Dimensional OS as a module. One package per concern:

  • ARBridge (bridge/) is the composition root. It builds the collaborators and fans out the robot's sensor streams. No business logic lives here.
  • WorldFrameState (world_frame/) holds the committed AR↔robot transform. Registration writes it, telemetry and navigation read it.
  • The remaining packages own one job each: WebSocket server in network/, tag detection in tag_tracking/, setup in registration/, goals in navigation/.
flowchart LR
  Module["bridge/<br>ARBridge"]
  Net["network/"]
  Align["registration/<br>tag_tracking/"]
  World["world_frame/"]
  Rest["navigation/ · agent/<br>robot_profile/ · …"]

  Module --> Net
  Module --> Align
  Module --> World
  Module --> Rest

Spectacles Lens

Lens Studio project with scripts split into two folders, wired by two scene scripts:

  • ARBridge/ implements PROTOCOL.md: WebSocket session, inbound routing, and one client per domain (registration, telemetry, navigation, camera, agent).
  • App/ is the Spectacles side: UI, presenters, registration wizard, and hand input.
  • ARBridgeServices is the composition root. It holds the scene inputs and builds the runtime services.
  • ARBridgeCoordinator owns phase and mode. It starts in registration, hands off to runtime, and tears down on disconnect.

Inbound messages land in AppState, and the UI reacts to that store rather than to raw messages.

flowchart LR
  subgraph App["App/"]
    Services["ARBridgeServices<br>composition root"]
    Coord["ARBridgeCoordinator<br>lifecycle"]
    UI["UI · Robot · Nav · Wizard"]
  end

  subgraph BridgeLayer["ARBridge/"]
    Net["Network · Session"]
    Clients["Domain clients"]
  end

  Coord --> Services
  Services --> UI
  Services --> Net
  Services --> Clients

Augmented Reality Interface

Spectacles AR interface with Unitree Go2 outdoors: wrist menu and LiDAR visualization

Hold your left palm up to open the wrist menu. Switch between Manual and Agent Mode, restart registration (i.e. re-calibrate the frame alignment), show the debug console, and request emergency stop (will immediately cancel all navigation).

Wrist menu on Spectacles: Manual/Agent mode, LiDAR, registration, debug console, and emergency stop

The LiDAR button in the wrist menu cycles three states: off, obstacles only (filters the point cloud by proximity to the robot bridge-side — performance friendly), and the full point cloud around the robot (performance heavy, can cause glasses to overheat over a long period).

Manual Mode

The NavigationMarker is initially attached to the robot and allows the user to drag it at any time. The direction you drag sets the heading it should face when it arrives, as indicated by the arrow. The robot will continuously move towards the marker. The yellow path line shown is the real navigation path the planner sends back, rendered in world space.

Agent Mode

Wake word "Robot" activates receival of voice commands. This state is indicated on the Robot Marker by Idle vs Asleep (before wake word detected).
Speech to text runs on the Spectacles and the transcript goes to a GPT-4o agent on the Mac, which picks from the tools below. The session closes after 30 seconds of silence. Say "stop" and the robot stops immediately (same Emergency Stop path as in the wrist UI).

Anything the agent starts looks and behaves exactly like a manually placed navigation goal. You can grab the marker and take over at any point which will override the goal set by the agent immediately.

The agent does respond in a few words on the robot and in the debug console. It would be possible to implement TTS into the Lens if needed. It will assume reasonable defaults when user commands are unspecific.

Tool What it does
relative_move Walk or turn by an amount relative to where the robot is now
navigate_to_user Come to you, using the position of your headset
get_user_pose Find out where you are standing and which way you face
cancel_navigation Emergency-stop the robot and clear the current goal
place_marker Leave a marker floating in the room
draw_line Draw a line between two points in the room
clear_annotation Remove a marker or line it drew earlier

[!NOTE] Agent Mode needs OPENAI_API_KEY set in the launcher and an internet connection on the Mac.

Pose Drift

Runtime pose drift: AR robot marker and path slowly misalign as the Go2 walks

During fast movements (as shown in the GIF above) the RobotMarker can lag behind the real robot position, but will quickly recover when the velocity reduces (i.e. coming to a hold). Drift is also directly proportional to travelled distance and as a function of network quality. The amount of drift varies but is approx. 25 cm at a total travel distance of 5 m.

The cause is inconsistent odometry data from the robot itself. In simple terms, the robot estimates its current world pose by adding up how far it has moved, and on Unitree hardware those numbers are not consistent, so small errors accumulate over time and distance.

The bridge corrects for this whenever it gets a valid camera frame at the AprilTag. It compares where the tag really is against where the robot reports to be and corrects the alignment to match the observation. Between those corrections the error grows again.

[!NOTE] Expect drift to accumulate over long distance walks - it is automatically corrected when the April Tag is sighted by the glasses camera.

Development & Troubleshooting

Run the full CI suite before opening a PR. It covers both sides and mirrors what GitHub Actions runs.

./launcher/scripts/run-ci.sh

Python tests on their own, using the Dimensional OS environment:

cd dimos-ar
/path/to/dimos/.venv/bin/python3 -m pytest

Lens tests on their own. These are plain TypeScript and do not need Lens Studio:

cd lens-studio/Tests
npm test

Troubleshooting

Symptom Things to try
Lens cannot connect Check that Spectacles and the Mac are on the same WiFi and that you typed the Bridge IP from the launcher, not 127.0.0.1.
AprilTag not detected Get closer, improve the lighting, keep walking around the robot, and check that the tag printed at full size.
Drift after registration Expected, see Pose Drift. Look at the tag while the robot stands still so the bridge can correct itself.
Navigation unavailable The bridge log reports which capabilities the robot advertised. G1 navigation needs the Unitree DDS packages in the DimOS environment.
Agent does not respond Check that OPENAI_API_KEY is set in the launcher and that the Mac has internet.
Wake word ignored Turn on the debug console and watch line 7 to see what was transcribed, and check that you are in Agent Mode.
Robot does not move Registration has to be finished and the robot connected. The agent reply on line 8 turns red or yellow when something failed.

Contributing

Contributions, ideas and bug reports are welcome. If you are changing something that crosses between the bridge and the Lens, read CONTRIBUTING.md first, especially the rules on keeping the protocol in sync.

License

MIT License, see LICENSE.

Explorar proyectos relacionados

Cargando…