/* 路径规划基准的求解器装配(Node):node tests/route_bench.cjs [solver.js] [N] */ const fs=require('fs'),path=require('path'); const ROOT=path.resolve(__dirname,'..'); module.exports=function(solverPath,collidePath){ const ArmIK=require(solverPath||path.join(ROOT,'webapp/js/ik-solver.js')); const JMap=/* 关节表取自 arm/kinematics.py JOINTS(无需 mesh_arm.json) */ {"J1": {"rear": [-51.0, 128.0, 610.0], "d": [1, 0, 0]}, "J2": {"rear": [19.5, 100.0, 490.0], "d": [0, 1, 0]}, "J3": {"rear": [19.5, 128.0, 445.0], "d": [0, 0, -1]}, "J4": {"rear": [19.5, 100.0, 332.0], "d": [0, 1, 0]}, "J5": {"rear": [19.5, 100.0, 222.0], "d": [0, 1, 0]}, "J6": {"rear": [19.5, 128.0, 176.0], "d": [0, 0, -1]}}; const travel=JSON.parse(fs.readFileSync(ROOT+'/docs/travel.json','utf8')); const COL=JSON.parse(fs.readFileSync(collidePath||ROOT+'/docs/collide.json','utf8')); const TR={};for(const t of travel){const a=COL.adj[t.axis];TR[t.axis]={lo:a?a[0]:t.lo,hi:a?a[1]:t.hi,continuous:!!t.continuous};} const S=ArmIK.make({joints:JMap,travel:TR,tcp:[19.5,128,93],collide:COL}); return {S,ArmIK}; };