ml: 数据生成 + 可微运动学对拍 + MeanFlow/WTA 策略与闭环仿真 + APG/挖错/ONNX 导出与运行手册

- M1 数据生成器:采样/老师/距离下界认证/时间律/统计/一致性门禁;确定性老师(碰撞次数计时 + resetSession)、pos 任务冻结 J6、--consensus 邻域共识过滤、Dr 类。
- 全流程代码与运行手册:数据打包/可微运动学与对拍/MeanFlow+WTA 模型/闭环仿真/APG/挖错循环/ONNX 导出;webapp 策略运行时 ik-policy.js、?policy=1 接入、tests/policy_bench.cjs;ik-solver 增 pairList/clusterExport/criticalPairs/pairGap/leverTable。
This commit is contained in:
Hark
2026-10-18 06:40:23 +08:00
committed by cbb
parent cc43b3d3be
commit 2a0a2e55ad
56 changed files with 2990 additions and 97 deletions
+23
View File
@@ -0,0 +1,23 @@
/* 导出运动学 + 胶囊碰撞模型给 PyTorch(ml/common/kin_torch.py 读取)
* node ml/prep/export_kin.cjs [out=ml/assets/kin.json]
* collide.json 重新拟合/重生成 pair2d 后必须重跑(指纹不符时 Python 端拒绝加载)。 */
'use strict';
const fs = require('fs'), path = require('path');
const { S } = require('../../tests/route_bench_setup.cjs')();
const OUT = process.argv[2] || path.join(__dirname, '../assets/kin.json');
const COL = JSON.parse(fs.readFileSync(path.join(__dirname, '../../docs/collide.json'), 'utf8'));
const ce = S.clusterExport();
const out = {
fp: S.modelFingerprint(),
order: S.ORDER,
P: S.ORDER.map(id => S.P[id]), D: S.ORDER.map(id => S.D[id]),
lim: S.ORDER.map(id => [S.LIM[id].lo, S.LIM[id].hi, S.LIM[id].cont ? 1 : 0]),
tcp0: S.TCP0, capm: S.CAPM,
caps: COL.caps.map(c => ({ g: c.g, a: c.a, b: c.b, r: c.r })),
clusters: ce.clusters, cpairs: ce.cpairs,
lever: S.leverBounds(20000),
generated: new Date().toISOString()
};
fs.mkdirSync(path.dirname(OUT), { recursive: true });
fs.writeFileSync(OUT, JSON.stringify(out));
console.log('wrote', OUT, 'caps', out.caps.length, 'clusters', out.clusters.length, 'cpairs', out.cpairs.length, 'fp', out.fp);