feat(ik): 避障路径改为多目标 Lazy RRT-Connect + 捷径平滑;碰撞窄相位预筛提速 38%;动画按轴速比时间参数化、途经点不停顿

This commit is contained in:
Hark
2026-10-15 05:05:24 +00:00
parent 1dfdd48792
commit 8ad5b3b4fa
5 changed files with 351 additions and 12 deletions
+12
View File
@@ -0,0 +1,12 @@
/* 路径规划基准的求解器装配(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){
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(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};
};