41 lines
1.8 KiB
Markdown
41 lines
1.8 KiB
Markdown
# sanad_api_g1t — G1 fleet **telemetry** agent
|
||
|
||
Streams the Unitree **G1**'s live status to the YS Lootah fleet server. It's the
|
||
**telemetry** sibling of the G1 **map** agent (`../g1`) — the G1 runs both, each
|
||
its own container/service, both keyed by the **same `sn`** (same physical robot).
|
||
|
||
```
|
||
POST {SERVER_URL}/api/v1/fleet/ingest/telemetry Authorization: Bearer <device_token>
|
||
{ "sn":"g1_7892", "mac":"…", "battery":74, "charging":false,
|
||
"status":"idle", "position":{"x":…,"y":…}|null, "faults":[], "ts":… }
|
||
```
|
||
|
||
Every ~2 s; a **heartbeat** (`battery:null, status:offline`) when DDS is silent.
|
||
|
||
## Data sources (G1, `unitree_hg` DDS — same family as R1)
|
||
|
||
| field | source |
|
||
|---|---|
|
||
| `battery`, `charging` | `rt/lf/bmsstate` (`BmsState_`): `soc` 0–100; charging from `current` sign |
|
||
| `faults[]` | `rt/lowstate` (`LowState_`): motor temps + staleness |
|
||
| `position` `{x,y}` | **`rt/lf/odommodestate`** (`SportModeState_`) — firmware leg-odometry over DDS, no ROS (odom frame: drifts, resets at boot). Optional map-frame via `rosbridge`. |
|
||
| `status` | derived (charging/moving/idle/offline); optional loco **FSM** (`G1_READ_FSM=1`, ids **200** ready / 4 stand / 2 squat / 702 lie2stand — GET-only) |
|
||
| `mac` | primary NIC |
|
||
|
||
> **Safety:** read-only — never commands motion.
|
||
|
||
## Run / test
|
||
|
||
```bash
|
||
# via the fleet installer (adds a 'g1t' type):
|
||
../../fleet_install.sh install g1t <ip> --sn g1_7892
|
||
../../fleet_install.sh data g1t <ip>
|
||
|
||
# bare simulate (no robot):
|
||
SERVER_URL=… DEVICE_TOKEN=… SN=g1_7892 python3 sanad_api_g1t.py --simulate -v
|
||
```
|
||
|
||
Build on the G1 Jetson (arm64); bundles CycloneDDS + the vendored `unitree_sdk2py`
|
||
wheel (`vendor/`). `network_mode: host` for DDS. Coexists with the map agent and
|
||
with a running Sanad (DDS allows many readers of the same topics).
|