43 lines
1.7 KiB
Markdown
43 lines
1.7 KiB
Markdown
# sanad_api_go2 — Go2 fleet **telemetry** agent
|
||
|
||
Pushes the Unitree **Go2**'s live status to the YS Lootah fleet server. Sibling of
|
||
`sanad_api_r1`; deploy it with the fleet installer (`../../fleet_install.sh`).
|
||
|
||
```
|
||
POST {SERVER_URL}/api/v1/fleet/ingest/telemetry Authorization: Bearer <device_token>
|
||
{ "sn":"go2_0000", "mac":"…", "battery":74, "charging":false,
|
||
"status":"idle", "position":{"x":…,"y":…}|null, "faults":[], "ts":… }
|
||
```
|
||
|
||
Sent every ~2 s; a **heartbeat** (`battery:null, status:offline`) when DDS is
|
||
silent so the robot stays online.
|
||
|
||
## Data sources (Go2, `unitree_go` DDS)
|
||
|
||
| field | source |
|
||
|---|---|
|
||
| `battery`, `charging` | **`rt/lowstate.bms_state`** (nested — Go2 has no separate BMS topic): `soc` 0–100; charging from `current` sign |
|
||
| `faults[]` | `rt/lowstate` motor temps + staleness |
|
||
| `status` | derived (charging / moving / idle / offline) |
|
||
| `position` | optional: `sportmode` (`rt/lf/sportmodestate`) or `rosbridge` (`/odom`) — default off |
|
||
| `mac` | primary NIC |
|
||
|
||
> **Safety:** read-only — never commands motion.
|
||
|
||
## Run / test
|
||
|
||
```bash
|
||
../../fleet_install.sh install go2 <ip> --sn go2_<id>
|
||
../../fleet_install.sh data go2 <ip>
|
||
# bare simulate (no robot):
|
||
SERVER_URL=… DEVICE_TOKEN=… SN=go2_0 python3 sanad_api_go2.py --simulate -v
|
||
```
|
||
|
||
Build on the Go2 compute (arm64); bundles CycloneDDS + the vendored
|
||
`unitree_sdk2py` wheel (`vendor/`). `network_mode: host` for DDS.
|
||
|
||
> ⚠️ **UNVERIFIED ON HARDWARE.** Written from the `unitree_go` SDK layout but not
|
||
> yet run on a real Go2. Confirm the `bms_state` current sign (charging polarity)
|
||
> and the `sportmodestate` fields on the robot. Verified so far: image builds,
|
||
> `unitree_go` imports, simulate/heartbeat payloads correct.
|