This commit is contained in:
chk
2026-06-26 22:01:02 +02:00
parent 1bbcb535aa
commit f87610c9c1
4 changed files with 241 additions and 17 deletions

View File

@@ -14,6 +14,7 @@ import { runHoming, runHomingOffline } from './homingOrchestrator.js';
import { fetchRobot, robotCachePath } from './robotConfig.js';
import { sendGcode, isDriverConfigured } from './driverClient.js';
import { buildG92 } from './buildG92.cjs';
import { fkStateToDriverG92 } from './fkStateToDriverG92.cjs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
@@ -920,23 +921,6 @@ app.post('/api/homing/run', async (req, res) => {
if (!res.writableEnded) res.end();
});
/**
* Konvertiert den FK-State (von 4b_revolute_angle.py / 5_pose_estimation.py)
* in die G92-Driver-Konvention (appRobotDriver/doc/Info_G92.md).
*
* Unterschiede:
* b: FK b=0 = gerade Hand; Driver B=180° = gerade Hand → B = 180 b
* c: FK c=0 = neutral Roll; Driver C=90° = neutral → C = c + 90
* z: 4b misst Ellbogen RELATIV zu Arm1; Driver braucht absoluten Winkel → Z = y + z
*/
function fkStateToDriverG92(s) {
const d = { ...s };
if (d.b != null) d.b = 180 - d.b;
if (d.c != null) d.c = d.c + 90;
if (d.z != null && d.y != null) d.z = d.y + d.z;
return d;
}
/**
* POST /api/homing/send-state
* Baut aus { state: { x, y, z, a, b[, c, e] } } ein G92 und sendet es als