Skip to content
Open
Changes from 1 commit
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
10 changes: 8 additions & 2 deletions dimos/robot/unitree/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import asyncio
from dataclasses import dataclass
import functools
import os
import threading
import time
from typing import Any, TypeAlias
Expand Down Expand Up @@ -85,12 +86,17 @@ def to_ndarray(self, format=None): # type: ignore[no-untyped-def]
class UnitreeWebRTCConnection(Resource):
_SPORT_API_ID_RAGEMODE: int = 2059

def __init__(self, ip: str, mode: str = "ai") -> None:
def __init__(self, ip: str, mode: str = "ai", aes_128_key: str | None = None) -> None:
self.ip = ip
self.mode = mode
self.stop_timer: threading.Timer | None = None
self.cmd_vel_timeout = 0.2
self.conn = LegionConnection(WebRTCConnectionMethod.LocalSTA, ip=self.ip)
# Per-device AES-128 key required by G1 firmware >= 1.5.1 (data2=3 WebRTC handshake).
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We could also include GO2 firmware 1.1.15 as it has the same issue and this should fix it for the GO2 too !

# Fetch with: unitree-fetch-aes-key --email YOU --sn <serial>
if aes_128_key is None:
aes_128_key = os.environ.get("UNITREE_AES_128_KEY")
Comment thread
mihai-chiorean marked this conversation as resolved.
Outdated
extra: dict[str, Any] = {"aes_128_key": aes_128_key} if aes_128_key else {}
self.conn = LegionConnection(WebRTCConnectionMethod.LocalSTA, ip=self.ip, **extra)
self.connect()

def connect(self) -> None:
Expand Down
Loading