update
This commit is contained in:
@@ -73,8 +73,19 @@ const V3D = sb.__V3D;
|
||||
V3D.ready = true;
|
||||
V3D.root = new Grp();
|
||||
|
||||
const r = { radius: 0.17, wheel_radius: 0.075, wheel_sep: 0.30,
|
||||
laser_x: 0.24, laser_y: 0.0, laser_z: 0.125, cam_x: 0.10 };
|
||||
// ⚠️ Hinh hoc THAT tu robot.yaml, khong phai so rut gon.
|
||||
//
|
||||
// Ban truoc bai kiem nay dung mot `r` thieu `body_l/w/h`, `body_off_x` va
|
||||
// `clearance`, nen duong ve KHOI HOP -- duong that su duoc dung -- chua bao
|
||||
// gio duoc chay. Mot bai kiem di duong khac voi ban chay that thi khong bao
|
||||
// dam gi ca.
|
||||
const r = { radius: 0.24, wheel_radius: 0.075, wheel_sep: 0.36,
|
||||
laser_x: 0.24, laser_y: 0.0, laser_z: 0.125,
|
||||
cam_x: 0.19, cam_y: 0.0, cam_z: 0.725, cam_pitch: 0.2618,
|
||||
cam_hfov: 1.204, cam_vfov: 0.733,
|
||||
body_l: 0.40, body_w: 0.34, body_h: 0.85,
|
||||
body_off_x: -0.06, clearance: 0.04,
|
||||
cliff_min: 1.10, cliff_max: 2.50 };
|
||||
sb.__shape(r);
|
||||
|
||||
// Sai so thuc do duoc giua uoc luong va ground truth: 9 mm.
|
||||
@@ -143,5 +154,34 @@ say('v3dSetPose giu cao do san co (m)', lifted.position.y, 0.5);
|
||||
say('v3dSetPose dat x', lifted.position.x, 1.0);
|
||||
say('v3dSetPose dat z (= -y ROS)', lifted.position.z, -2.0);
|
||||
|
||||
// 5. ⚠️ Moi NUT tuong ung o hai hinh phai o CUNG cao do.
|
||||
//
|
||||
// So `group.position` khong du: hai nhom co the o cung cho ma THAN ben trong
|
||||
// lai nam o hai tang khac nhau -- do dung la loi da xay ra mot lan (gtGroup
|
||||
// thieu lop boc). Phai duyet ca cay va so tung nut mot.
|
||||
function nodes(root) {
|
||||
const out = [];
|
||||
(function walk(n, acc) {
|
||||
const y = acc + (n.position ? n.position.y : 0);
|
||||
const x = (n.position ? n.position.x : 0);
|
||||
if (n !== root) out.push({ y, x, kind: n.geometry ? n.geometry.constructor.name : 'group' });
|
||||
(n.children || []).forEach((c) => walk(c, y));
|
||||
})(root, 0);
|
||||
return out;
|
||||
}
|
||||
{
|
||||
const A = nodes(V3D.robotGroup), B = nodes(V3D.gtGroup);
|
||||
// robotGroup co them vanh cliff; chi so cac nut co trong CA HAI.
|
||||
const n = Math.min(A.length, B.length);
|
||||
let worst = 0, worstK = '';
|
||||
for (let i = 0; i < n; ++i) {
|
||||
const dy = Math.abs(A[i].y - B[i].y), dx = Math.abs(A[i].x - B[i].x);
|
||||
if (Math.max(dy, dx) > worst) { worst = Math.max(dy, dx); worstK = A[i].kind; }
|
||||
}
|
||||
console.log(` so ${n} nut tuong ung lech lon nhat ${worst.toFixed(4)} m` +
|
||||
(worst > 1e-9 ? ' <-- ' + worstK : ''));
|
||||
if (worst > 1e-9) bad.push('nut lech giua hai hinh');
|
||||
}
|
||||
|
||||
console.log(bad.length ? '\n => HONG: ' + bad.join(', ') : '\n => DAT');
|
||||
process.exit(bad.length ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user