Heartbeat

This commit is contained in:
chk
2026-06-12 17:03:38 +02:00
parent 4db6c472b7
commit 6fc6605080
11 changed files with 342 additions and 32 deletions

View File

@@ -66,7 +66,9 @@ Das ist die einzige Absicherung. Kein JWT, keine Sessions, kein Rate-Limiting
| 1 — Datei anlegen | appRobotDriver | ✅ erledigt |
| 2 — RobotConfigService | appRobotDriver | ✅ erledigt |
| 3 — Registrierung InfoServer | appRobotDriver | ✅ erledigt |
| 4 — Driver liest Armlängen | appRobotDriver | ✅ erledigt |
| 4 — Driver liest Armlängen | appRobotDriver | ✅ erledigt (→ ToDo 3) |
| 4a — InfoServer auf Express umgestellt | appRobotDriver | ✅ erledigt |
| 4b — UI: Robot.json + History in index.html | appRobotDriver | ✅ erledigt |
| 5 — appRobotHoming umstellen | appRobotHoming | ⬜ offen |
| 6 — appRobotRendering umstellen | appRobotRendering | ⬜ offen |
| 7 — Aufräumen | alle Repos | ⬜ offen |
@@ -113,25 +115,35 @@ Timestamp-Format: `YYYYMMDD_HHmmss` (konsistent mit appRobotHoming).
### Schritt 3 — Registrierung in InfoServer.js (appRobotDriver) ✅
Eine Zeile in `server/InfoServer.js` am Anfang der Request-Handler:
`InfoServer.js` wurde auf Express umgestellt. Registrierung mit einer Zeile:
```js
robotConfigService.register(httpsServer, { apiKey });
robotConfigService.register(app, { apiKey: options.apiKey });
```
Da `InfoServer.js` kein Express nutzt (rohes `https.createServer`), bekommt `RobotConfigService` intern einen minimalen Router, der url-Matching selbst macht — oder `InfoServer.js` wird auf Express umgestellt (kleiner Schritt, bringt mehr Flexibilität für spätere Endpunkte).
### Schritt 4 — Driver liest Armlängen aus robot.json ✅
`startRobot.js` liest beim Start arm-lengths aus `data/robot/robot.json`.
Fallback auf `{ l1: 250, l2: 264, l3: 100 }` mit Log-Warnung wenn Datei fehlt oder Keys fehlen.
Ausgelagert nach `robot/RobotConfig.js` (→ ToDo 3). Liest beim Start synchron `data/robot/robot.json`, leitet l1/l2/l3 aus `links.*.skeleton.to` ab (nicht mehr aus `size`):
```js
// links.Arm1.size[1] → l1
// links.Arm2.size[1] → l2
// links.Ellbow.size[0] → l3
// links.Arm1.skeleton.to[1] → l1 (Math.abs)
// links.Arm2.skeleton.to[1] → l2 (Math.abs)
// links.Ellbow.skeleton.to[0] → l3
```
Fallback auf Defaults wenn Datei fehlt. Controller-IPs/-Ports/-Achsen ebenfalls aus `robot.json` (keine hardcodierten Werte mehr in `startRobot.js`).
### Schritt 4a — InfoServer auf Express umgestellt ✅
`server/InfoServer.js` nutzt jetzt Express statt rohem `https.createServer`. Ermöglicht saubere Router-Registrierung und ist Grundlage für alle weiteren API-Endpunkte.
### Schritt 4b — UI: Robot.json + History in index.html ✅
Zwei neue Panels im InfoServer-Frontend (`public/index.html` + `app.js`):
- **Robot.json** — zeigt aktuelle `robot.json` mit aufklappbaren Top-Level-Abschnitten (`<details>`). Aktualisiert sich automatisch, solange kein Snapshot ausgewählt ist. Label (`_label`-Feld) wird oben angezeigt.
- **Robot.json History** — listet alle Snapshots aus `GET /api/robot/history`. Klick auf Eintrag lädt diesen Snapshot in das Robot.json-Panel. Klick auf „aktuell" schaltet zurück auf Live-Ansicht.
### Schritt 5 — appRobotHoming auf Driver-API umstellen ⬜
`server/server.js` in appRobotHoming: