go2tool: add Go2 wifi setup workflow#2421
Conversation
Greptile SummaryThis PR collapses the multi-step Go2 Wi-Fi provisioning flow into a single
Confidence Score: 4/5Safe to merge after addressing the subprocess hang risk in the macOS helper path. The dimos/robot/unitree/go2/cli/macos_ble_helper.py — specifically the subprocess.run call in _invoke_helper around line 341. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant go2tool as go2tool setup
participant BLE as BLE Backend
participant Helper as macOS Helper .app
participant LAN as LAN Discovery
participant Robot as Go2 Robot
User->>go2tool: dimos go2tool setup --ssid X
go2tool->>go2tool: prompt password (hidden)
alt macOS auto/helper backend
go2tool->>Helper: open -W -n (request.json via tmpfile)
Helper->>Robot: BLE scan + provision_wifi
Robot-->>Helper: serial
Helper-->>go2tool: response.json (serial)
else Linux/direct backend
go2tool->>BLE: find_robots(timeout)
BLE-->>go2tool: device list
go2tool->>BLE: provision_wifi(address, ssid, password)
BLE->>Robot: BLE credentials
Robot-->>BLE: serial
BLE-->>go2tool: serial
end
loop up to rediscovery_attempts
go2tool->>LAN: discover() via run_in_executor
LAN-->>go2tool: Go2Device list
go2tool->>go2tool: match by serial
end
go2tool->>Robot: "POST /con_notify (allow_redirects=False)"
Robot-->>go2tool: 200 + base64 payload
go2tool-->>User: "result=ok robot_ip=X.X.X.X"
Reviews (4): Last reviewed commit: "docs: clarify Go2 wifi setup options" | Re-trigger Greptile |
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
leshy
left a comment
There was a problem hiding this comment.
actually this Jetson and Eric can use current go2tool already on Mac, what's the issue this is solving?
pls don't use AI generated PR description, describe in your own words
Manually composed a thorough PR description. |
TL;DR:
solves two concerns:
Problem
This PR was born from my issues of setting up a Go2 dog on a local Wifi network.
I powered up the dog and told Codex to connect it to the local Wifi.
It took codex 1 hour end-to-end because of multiple steps necessary + the peculiarities of bluetooth permissions on macOS depending on the terminal used.
The workflow before this PR: provision over BLE, wait for the robot to join the network, rediscover it on LAN, pick the right IP, and then run DimOS with that IP.
Now the flow becomes:
If multiple dogs are visible, use:
macOS Bluetooth permissions peculiarity
On macOS, Bluetooth access is controlled by TCC permissions. Running Bleak directly from a terminal means Bluetooth authorization may be attached to Terminal, iTerm, Python, uv, or some other launch context. On some Macs this works. On others, scan/provision can fail or behave inconsistently even though the robot and code are fine.
This PR adds a macOS helper .app path so Bluetooth access goes through a normal LaunchServices app bundle with Bluetooth usage keys. That gives macOS a clearer thing to authorize.
Instead of Bluetooth access coming from “Terminal running Python,” macOS sees “DimOS BLE Helper.app wants Bluetooth.” That app has the proper Bluetooth permission strings in its Info.plist, so macOS TCC has a stable app identity to authorize.
Flow:
This only changes how macOS sees and authorizes the process using Bluetooth, not the Go2 BLE protocol.
It also fixes operational flakiness:
setupretries rediscovery.Solution
dimos go2tool setupandverifyfor BLE provisioning, LAN rediscovery, and no-movement endpoint verification.[REDACTED]redaction.POST /con_notify,allow_redirects=False, and expected payload validation.How to Test
uv run pytest dimos/robot/unitree/go2/cli -q-> 34 passed, with existing pytest-asyncio deprecation warnings and a subprocess ResourceWarning.uv run ruff check dimos/robot/unitree/go2/cli/go2tool.py dimos/robot/unitree/go2/cli/macos_ble_helper.py dimos/robot/unitree/go2/cli/setup.py dimos/robot/unitree/go2/cli/verify.py dimos/robot/unitree/go2/cli/test_macos_ble_helper.py-> passed.uv run ruff format --check dimos/robot/unitree/go2/cli/go2tool.py dimos/robot/unitree/go2/cli/macos_ble_helper.py dimos/robot/unitree/go2/cli/setup.py dimos/robot/unitree/go2/cli/verify.py dimos/robot/unitree/go2/cli/test_macos_ble_helper.py-> passed.uv run mypy dimos/robot/unitree/go2/cli/go2tool.py dimos/robot/unitree/go2/cli/macos_ble_helper.py dimos/robot/unitree/go2/cli/setup.py dimos/robot/unitree/go2/cli/verify.py-> passed.uv run doclinks --dry-run docs/coding-agents/go2-wifi-provisioning.md docs/coding-agents/index.md docs/platforms/quadruped/go2/index.md docs/usage/cli.md-> passed.uv run dimos go2tool --help,uv run dimos go2tool connect-wifi --help,uv run dimos go2tool setup --help, anduv run dimos go2tool verify --help-> passed.Full
uv run pytestwas not rerun locally because the default suite pulls authenticated LFS data fromhttps://lfs.dimensionalos.com.