This commit is contained in:
trung09122002
2026-09-19 15:33:52 +07:00
parent 48bd5377dc
commit 3b281174d0
22 changed files with 1913 additions and 119 deletions

View File

@@ -12,7 +12,55 @@ const MAGIC = 0x314C5356; // 'VSL1' little-endian
// Phien ban ma nguon giao dien. TANG khi doi app.js / app3d.js / style.css.
// Hien ngay tren thanh tren cung de phan biet "chua sua" voi "trinh duyet con
// cache ban cu".
const UI_VERSION = '2026-09-18c';
const UI_VERSION = '2026-09-19f';
// ⚠️ HAI bang mau, mot cho moi khung. Chung KHONG duoc giong nhau.
//
// Ban truoc dung MOT bang cho ca hai: `free` gan trang (#ffffff) tren nen gan
// trang (#f3f6fa). Hai mau do cach nhau vai don vi, nen vung DA QUET va vung
// chua co gi trong y het nhau -- khong con biet quet toi dau.
//
// Gio moi khung mang tone cua cong cu no thay the:
//
// `world` -- khung THE GIOI, tone Gazebo: nen troi, san sang, tuong xam.
// `slam` -- khung SLAM, tone RViz: nen than chi, o TRONG sang bat len, o bi
// chiem gan den. Tuong phan nam giua `free` va `bg`, khong giua
// `occupied` va `bg` -- vi cai nguoi van hanh can thay la vung DA
// QUET lon den dau.
//
// Nguyen tac khong doi cho ca hai: CHUA BIET trong suot (xem rasterize()).
const PALETTE = {
world: {
bg: '#a9b8c6', // troi Gazebo
occupied: [86, 97, 108, 255], // tuong, xam dam
free: [232, 237, 241, 235], // san, sang
unknown: [0, 0, 0, 0],
path: '#1b5e8a',
scan: '#c0392b',
cloud: '#1f7a4d',
nose: '#eef2f6',
text: '#44505c',
robot: '#1a6ea8',
gt: '#0f9d58',
},
slam: {
// Nen RViz. Sang hon mot nac so voi ban dau (#2e3033): o do tuong gan
// den chi cach nen 29.5 don vi, nen mot o tuong le giua vung chua quet la
// vo hinh. Tuong phan chinh van la free-vs-bg, nhung occupied-vs-bg cung
// phai du.
bg: '#3c4046',
occupied: [18, 18, 20, 255], // tuong, gan den
free: [206, 208, 211, 235], // vung da quet, SANG -- day la tuong phan
unknown: [0, 0, 0, 0],
path: '#4fc3f7',
scan: '#ff5a4d',
cloud: '#34d17e',
nose: '#3c4046',
text: '#9aa3ad',
robot: '#42a5f5',
gt: '#2ee06a',
},
};
const T_SCAN = 1, T_CLOUD = 2, T_MAP_FULL = 3, T_MAP_PATCH = 4, T_PATH = 5;
// Ban do THE GIOI cua bo mo phong -- khung nhin "Gazebo". Tinh: gui mot lan.
@@ -29,7 +77,10 @@ const state = {
bytes: 0, lastBytes: 0, wireRate: 0,
};
const view = { x: 0, y: 0, scale: 40, init: false }; // scale = pixel/met
// `rot` = goc XOAY cua khung nhin, radian, nguoc chieu kim dong ho trong he
// the gioi. Hai khung dung CHUNG view nay nen chung luon thang hang -- doi
// chieu duoc hai ban do la ca ly do mo hai khung.
const view = { x: 0, y: 0, scale: 40, rot: 0, init: false }; // scale = pixel/met
// --- WebSocket -------------------------------------------------------------
@@ -134,12 +185,12 @@ function onBinary(dv) {
if (type === T_WORLD_MAP) {
// Ban do THE GIOI: su that, de lai cho chuan. KHONG lan vao state.map.
state.worldMap = grid;
state.worldMapImage = rasterize(grid);
state.worldMapImage = rasterize(grid, PALETTE.world);
if (!view.init) centerOnMap(grid);
return;
}
state.map = grid;
state.mapImage = rasterize(grid);
state.mapImage = rasterize(grid, PALETTE.slam);
// Can khung theo ban do THE GIOI neu co -- no la cai khong doi, con ban
// do SLAM lon dan khi quet va se keo khung nhin chay theo.
if (!view.init && !state.worldMap) centerOnMap(grid);
@@ -161,7 +212,7 @@ function onBinary(dv) {
// Giai RLE mot lan cho moi map_version roi blit -- moi khung chi con mot
// drawImage thay vi ve lai tung o.
function rasterize(map) {
function rasterize(map, pal) {
const img = new ImageData(map.w, map.h);
const d = img.data;
for (let i = 0; i < map.cells.length; i++) {
@@ -182,12 +233,12 @@ function rasterize(map) {
// RViz ve chua-biet trong suot, va do la ly do ban do o do "lon dan" nhin
// thay duoc.
//
// Mau cung dao lai cho nen TOI: bi chiem SANG (tuong noi len), trong thi
// mo. Ban truoc de bi chiem gan DEN tren nen den -- vo hinh.
// Mau lay tu `CANVAS` o dau file, khong go tai cho: bang do phai doi cung
// luc voi bien CSS, va de hai noi thi chac chan se lech.
let c;
if (v < 0) c = [0, 0, 0, 0]; // chua biet -> TRONG SUOT
else if (v < 50) c = [58, 70, 86, 170]; // trong, mo
else c = [222, 232, 244, 255]; // bi chiem, SANG
if (v < 0) c = pal.unknown; // chua biet -> TRONG SUOT
else if (v < 50) c = pal.free;
else c = pal.occupied;
d[j] = c[0]; d[j + 1] = c[1]; d[j + 2] = c[2]; d[j + 3] = c[3];
}
const cv = document.createElement('canvas');
@@ -271,6 +322,20 @@ function onState(s) {
if (s.teleop) {
txt('linSpeed', fmt(s.teleop.linear_speed, 2));
txt('angSpeed', fmt(s.teleop.angular_speed, 2));
// Thanh truot: chi dong bo khi NGUOI DUNG khong dang keo, va lay tran
// tu server (`--max-speed` co the noi tran len cho mo phong).
syncRange('linRange', s.teleop.linear_speed, s.teleop.max_linear_speed);
syncRange('angRange', s.teleop.angular_speed, s.teleop.max_angular_speed);
}
// Toc do DO DUOC tu encoder, de canh gia tri dat.
//
// ⚠️ Dat 2.0 ma do duoc 0.98 KHONG phai loi: `accel_limit` 0.30 m/s^2 can
// 6.7 giay va ~6.7 m duong chay de len toi 2 m/s, ma cho rong nhat trong
// toa nha chi 4.75 m. Hai so nay canh nhau thi khac biet do nhin thay ngay
// thay vi thanh mot cau hoi.
if (s.odom) {
txt('linReal', fmt(Math.abs(s.odom.vx), 2));
txt('angReal', fmt(Math.abs(s.odom.vyaw), 2));
}
const btn = document.getElementById('estop');
@@ -291,6 +356,11 @@ function fmt(v, d) {
const cv = document.getElementById('main');
const ctx = cv.getContext('2d');
// ⚠️ Khai o DAY chu khong o cho dung dau tien: bo xu ly chuot ben duoi gan
// cho ca hai khung, va `const` khai muon hon cho dung se nem ReferenceError
// ngay luc nap trang.
const cvR = document.getElementById('mainR');
const ctxR = cvR.getContext('2d');
function resize() {
const dpr = window.devicePixelRatio || 1;
@@ -315,27 +385,47 @@ function centerOnMap(grid) {
// y: hai ban do phai thang hang thi moi doi chieu duoc, ma doi chieu chinh la
// ly do mo hai khung.
let curCv = null;
function sx(x) { return (x - view.x) * view.scale + curCv.clientWidth / 2; }
function sy(y) { return curCv.clientHeight / 2 - (y - view.y) * view.scale; }
// The gioi -> man hinh, qua ba buoc: doi goc ve tam nhin, XOAY, roi doi ti le.
// Truc y cua canvas nguoc voi truc y the gioi, nen moi phep xoay xuat hien o
// `ctx.rotate()` deu mang dau am.
function sx(x, y) {
const c = Math.cos(view.rot), s_ = Math.sin(view.rot);
const dx = x - view.x, dy = y - view.y;
return (dx * c - dy * s_) * view.scale + curCv.clientWidth / 2;
}
function sy(x, y) {
const c = Math.cos(view.rot), s_ = Math.sin(view.rot);
const dx = x - view.x, dy = y - view.y;
return curCv.clientHeight / 2 - (dx * s_ + dy * c) * view.scale;
}
function on(id) { return document.getElementById(id).checked; }
// Tam giac chi huong. Mot ham cho ca pose uoc luong lan ground truth: hai ban
// chep cua cung mot hinh se lech nhau ngay lan sua dau tien, va luc do khong ai
// so sanh duoc hai cai nua.
function drawRobot(ctx, x, y, yaw, color, alpha) {
const L = 0.30 * view.scale, W = 0.17 * view.scale;
// Robot ve theo HINH HOP, dung kich thuoc that tu robot.yaml.
//
// ⚠️ Ban truoc ve tam giac voi hai hang so 0.30 va 0.17 go thang vao day. Do
// la dung lop bug "hai cho phai giu dong bo" ma `PROJECT_CONTEXT.md` da ghi
// giua URDF va launch param: doi hinh hoc trong robot.yaml thi hinh ve khong
// doi theo, va khong co gi bao.
//
// Hop mot minh thi khong doc duoc huong, nen them mot vach o dau mui.
function drawRobot(ctx, x, y, yaw, color, alpha, pal) {
const r = state.robot;
const L = (r && r.body_l ? r.body_l : 0.40) * view.scale;
const W = (r && r.body_w ? r.body_w : 0.34) * view.scale;
const off = (r && r.body_off_x ? r.body_off_x : 0) * view.scale;
ctx.save();
ctx.globalAlpha = alpha;
ctx.translate(sx(x), sy(y));
ctx.rotate(-yaw);
ctx.beginPath();
ctx.moveTo(L, 0);
ctx.lineTo(-L * 0.6, -W);
ctx.lineTo(-L * 0.6, W);
ctx.closePath();
ctx.translate(sx(x, y), sy(x, y));
ctx.rotate(-yaw - view.rot);
ctx.fillStyle = color;
ctx.fill();
ctx.fillRect(off - L / 2, -W / 2, L, W);
// Vach mui: chi ro dau la phia truoc.
ctx.fillStyle = pal.nose;
ctx.fillRect(off + L / 2 - L * 0.14, -W * 0.16, L * 0.14, W * 0.32);
ctx.restore();
}
@@ -348,21 +438,21 @@ function drawRobot(ctx, x, y, yaw, color, alpha) {
//
// Mot ham cho ca hai khung: hai ban chep se lech nhau ngay lan sua dau, va
// luc do khong con doi chieu duoc nua.
function drawScene(targetCv, targetCtx, grid, gridImage, robotPose, showGt, mapToggle) {
function drawScene(targetCv, targetCtx, grid, gridImage, robotPose, showGt, mapToggle, pal) {
curCv = targetCv;
const ctx = targetCtx;
const w = targetCv.clientWidth, h = targetCv.clientHeight;
if (targetCv.width !== w || targetCv.height !== h) {
targetCv.width = w; targetCv.height = h;
}
ctx.fillStyle = '#12151a';
ctx.fillStyle = pal.bg;
ctx.fillRect(0, 0, w, h);
// Mot khung den khong noi duoc vi sao no den. Neu day la khung SLAM va
// SLAM dang TAT, viet ra -- nguoi van hanh khong phai doan.
if (!grid && mapToggle === 'lyMap' &&
(state.slamMode === 'off' || !state.slamMode)) {
ctx.fillStyle = '#7d8896';
ctx.fillStyle = pal.text;
ctx.font = '13px system-ui, sans-serif';
ctx.textAlign = 'center';
ctx.fillText('SLAM dang TAT', w / 2, h / 2 - 10);
@@ -373,17 +463,24 @@ function drawScene(targetCv, targetCtx, grid, gridImage, robotPose, showGt, mapT
if (grid && gridImage && on(mapToggle || 'lyMap')) {
const m = grid;
ctx.imageSmoothingEnabled = false;
ctx.drawImage(gridImage,
sx(m.ox), sy(m.oy + m.h * m.res),
// Goc TREN-TRAI cua anh trong he the gioi la (ox, oy + h*res). Dua goc do
// vao dung cho roi xoay CA anh quanh no.
const gx = m.ox, gy = m.oy + m.h * m.res;
ctx.save();
ctx.translate(sx(gx, gy), sy(gx, gy));
ctx.rotate(-view.rot);
ctx.drawImage(gridImage, 0, 0,
m.w * m.res * view.scale, m.h * m.res * view.scale);
ctx.restore();
}
if (state.path && on('lyPath')) {
ctx.strokeStyle = '#5aa9e6';
ctx.strokeStyle = pal.path;
ctx.lineWidth = 1.5;
ctx.beginPath();
for (let i = 0; i < state.path.length; i += 2) {
const X = sx(state.path[i]), Y = sy(state.path[i + 1]);
const X = sx(state.path[i], state.path[i + 1]);
const Y = sy(state.path[i], state.path[i + 1]);
i === 0 ? ctx.moveTo(X, Y) : ctx.lineTo(X, Y);
}
ctx.stroke();
@@ -397,7 +494,7 @@ function drawScene(targetCv, targetCtx, grid, gridImage, robotPose, showGt, mapT
// Ground truth ve TRUOC pose uoc luong, de pose ve de len tren: cai ta
// dang danh gia phai nhin ro hon cai lam chuan.
if (showGt && state.gt && on('lyGt')) {
drawRobot(ctx, state.gt.x, state.gt.y, state.gt.yaw, '#00c853', 0.45);
drawRobot(ctx, state.gt.x, state.gt.y, state.gt.yaw, pal.gt, 0.45, pal);
}
if (state.cloud && on('lyCloud')) {
@@ -411,12 +508,12 @@ function drawScene(targetCv, targetCtx, grid, gridImage, robotPose, showGt, mapT
const t = Math.max(0, Math.min(1, z / 1.2));
ctx.fillStyle = 'rgb(' + Math.round(80 + 175 * t) + ',' +
Math.round(200 - 90 * t) + ',' + Math.round(120 + 60 * t) + ')';
ctx.fillRect(sx(x) - 1, sy(y) - 1, 2, 2);
ctx.fillRect(sx(x, y) - 1, sy(x, y) - 1, 2, 2);
}
}
if (state.scan && on('lyScan')) {
ctx.fillStyle = '#e2574c';
ctx.fillStyle = pal.scan;
const pts = state.scan;
// ⚠️ Scan trong frame LASER -- phai bu vi tri gan LiDAR truoc khi dua
// vao pose cua base. Xem ghi chu trong v3dSetScan().
@@ -426,11 +523,11 @@ function drawScene(targetCv, targetCtx, grid, gridImage, robotPose, showGt, mapT
const bx = pts[i] + lx, by = pts[i + 1] + ly;
const x = p.x + c * bx - s * by;
const y = p.y + s * bx + c * by;
ctx.fillRect(sx(x) - 1.5, sy(y) - 1.5, 3, 3);
ctx.fillRect(sx(x, y) - 1.5, sy(x, y) - 1.5, 3, 3);
}
}
drawRobot(ctx, robotPose.x, robotPose.y, robotPose.yaw, '#4ec9a0', 1.0);
drawRobot(ctx, robotPose.x, robotPose.y, robotPose.yaw, pal.robot, 1.0, pal);
}
}
@@ -460,6 +557,9 @@ function updateSlamLabel() {
}
function draw() {
// Goi o DAY chu khong trong draw3d(): o so sanh uoc luong voi ground truth
// phai chay ca khi dang xem khung 2D.
updateGapChip();
// ⚠️ 3D va CHIA DOI phai chay CUNG NHAU.
//
// Ban truoc viet `if (use3d) { draw3d(); return; }` -- tuc khi bat 3D thi
@@ -472,7 +572,8 @@ function draw() {
// Khung phai VAN phai chay khi dang chia doi.
if (split) {
updateSlamLabel();
drawScene(cvR, ctxR, state.map, state.mapImage, state.pose, true, 'lyMap');
drawScene(cvR, ctxR, state.map, state.mapImage, state.pose, true, 'lyMap',
PALETTE.slam);
}
requestAnimationFrame(draw);
return;
@@ -481,17 +582,19 @@ function draw() {
updateSlamLabel();
// TRAI = THE GIOI: ban do that + pose THAT. Day la khung de LAI.
drawScene(cv, ctx, state.worldMap, state.worldMapImage,
state.gt || state.pose, false, 'lyWorld');
state.gt || state.pose, false, 'lyWorld', PALETTE.world);
// PHAI = SLAM: ban do dang dung + pose UOC LUONG. Khung de xem quet toi
// dau, va lech bao nhieu so voi khung trai.
drawScene(cvR, ctxR, state.map, state.mapImage, state.pose, true, 'lyMap');
drawScene(cvR, ctxR, state.map, state.mapImage, state.pose, true, 'lyMap',
PALETTE.slam);
} else {
// Mot khung: uu tien ban do SLAM neu co, khong thi ban do the gioi.
const haveSlam = !!state.map;
drawScene(cv, ctx,
haveSlam ? state.map : state.worldMap,
haveSlam ? state.mapImage : state.worldMapImage,
state.pose, true, haveSlam ? 'lyMap' : 'lyWorld');
state.pose, true, haveSlam ? 'lyMap' : 'lyWorld',
haveSlam ? PALETTE.slam : PALETTE.world);
}
requestAnimationFrame(draw);
}
@@ -500,24 +603,48 @@ function draw() {
let dragging = false, lastX = 0, lastY = 0;
cv.addEventListener('mousedown', (e) => {
dragging = true; lastX = e.clientX; lastY = e.clientY;
});
// ⚠️ Gan cho CA HAI khung.
//
// Truoc day chi khung trai nhan chuot, nen khung SLAM ben phai khong keo va
// khong phong to duoc -- ma do moi la khung nguoi dung nhin lau nhat khi quet.
//
// Hai khung dung chung mot `view`, nen keo o khung nao thi ca hai cung di. Do
// la co y: doi chieu duoc hai ban do la ca ly do mo hai khung.
for (const c of [cv, cvR]) {
c.addEventListener('mousedown', (e) => {
dragging = e.button === 2 ? 'rot' : 'pan';
lastX = e.clientX; lastY = e.clientY;
e.preventDefault();
});
c.addEventListener('contextmenu', (e) => e.preventDefault());
c.addEventListener('wheel', (e) => {
e.preventDefault();
view.scale *= e.deltaY < 0 ? 1.1 : 1 / 1.1;
view.scale = Math.max(2, Math.min(400, view.scale));
view.init = true;
}, { passive: false });
c.addEventListener('dblclick', () => { view.rot = 0; centerOnMap(); });
}
window.addEventListener('mouseup', () => { dragging = false; });
window.addEventListener('mousemove', (e) => {
if (!dragging) return;
view.x -= (e.clientX - lastX) / view.scale;
view.y += (e.clientY - lastY) / view.scale;
const dx = e.clientX - lastX, dy = e.clientY - lastY;
lastX = e.clientX; lastY = e.clientY;
if (dragging === 'rot') {
// Keo ngang de xoay khung nhin. Keo sang PHAI thi canh quay sang phai.
view.rot -= dx * 0.005;
} else {
// Keo canh: canh phai di THEO tay, ke ca khi khung nhin dang xoay. Nen
// phai dua do doi man hinh NGUOC ve he the gioi truoc.
const c = Math.cos(view.rot), s_ = Math.sin(view.rot);
const wx = dx / view.scale, wy = -dy / view.scale;
view.x -= wx * c + wy * s_;
view.y -= -wx * s_ + wy * c;
}
view.init = true;
});
cv.addEventListener('wheel', (e) => {
e.preventDefault();
view.scale *= e.deltaY < 0 ? 1.1 : 1 / 1.1;
view.scale = Math.max(2, Math.min(400, view.scale));
view.init = true;
}, { passive: false });
cv.addEventListener('dblclick', () => { centerOnMap(); });
// --- Lenh ------------------------------------------------------------------
@@ -671,6 +798,26 @@ function adjustSpeed(which, dir) {
post('teleop/adjust', { axis: which, dir: dir });
}
// Dong bo thanh truot voi gia tri server, TRU khi nguoi dung dang keo no.
// Ghi de giua luc keo lam thanh truot giat nguoc ve va khong dat duoc gia tri.
function syncRange(id, value, max) {
const el = document.getElementById(id);
if (!el || el === document.activeElement || el.dataset.drag === '1') return;
if (max && Number(el.max) !== max) el.max = String(max);
el.value = String(value);
}
for (const [id, axis] of [['linRange', 'lin'], ['angRange', 'ang']]) {
const el = document.getElementById(id);
if (!el) continue;
el.addEventListener('pointerdown', () => { el.dataset.drag = '1'; });
el.addEventListener('pointerup', () => { el.dataset.drag = '0'; });
el.addEventListener('input', () => {
txt(id === 'linRange' ? 'linSpeed' : 'angSpeed', Number(el.value).toFixed(2));
post('teleop/set', { axis: axis, value: Number(el.value) });
});
}
for (const b of document.querySelectorAll('.sbtn')) {
b.addEventListener('click', () => adjustSpeed(b.dataset.adj, Number(b.dataset.dir)));
}
@@ -707,8 +854,6 @@ connect();
// Tuong duong mo ca Gazebo lan RViz. Khung trai la SU THAT (de lai cho
// chuan), khung phai la cai SLAM dang dung (de biet quet toi dau). Hai khung
// dung CHUNG `view`, nen pan/zoom khoa voi nhau va doi chieu duoc truc tiep.
const cvR = document.getElementById('mainR');
const ctxR = cvR.getContext('2d');
const btnSplit = document.getElementById('btnSplit');
const labR = document.getElementById('labR');
const wrap = document.querySelector('.canvas-wrap');
@@ -769,21 +914,27 @@ function loadWorldMeshes() {
});
}
btn3d.addEventListener('click', () => {
if (!use3d && !V3D.ready) {
// Bat/tat khung 3D. Tach ra khoi bo xu ly nut vi CAC NUT GOC NHIN cung goi
// no: bam "tren" khi dang o 2D thi phai vao 3D roi moi dat goc, khong thi nut
// khong lam gi ca va nguoi dung tuong no hong.
function setThreeD(on) {
if (on && !V3D.ready) {
if (!v3dInit(cv3d)) {
btn3d.textContent = '3D loi';
btn3d.classList.add('bad');
return;
return false;
}
}
if (!use3d) loadWorldMeshes();
use3d = !use3d;
if (on && !use3d) loadWorldMeshes();
use3d = on;
// Chi doi CLASS. Dat style inline o day se de bep quy tac .split trong
// stylesheet -- dung cai bay da lam khung phai den xi mot lan.
wrap.classList.toggle('three', use3d);
btn3d.textContent = use3d ? '2D' : '3D';
});
return true;
}
btn3d.addEventListener('click', () => { setThreeD(!use3d); });
// Khoang cach VE giua hai hinh robot -- do tren chinh hai doi tuong 3D, khong
// phai tinh lai tu du lieu.
@@ -795,12 +946,39 @@ btn3d.addEventListener('click', () => {
function updateGapChip() {
const el = document.getElementById('gap');
if (!el) return;
// Sai so DU LIEU: khoang cach giua pose uoc luong va ground truth, tinh tu
// chinh hai con so server gui len.
let dData = null;
if (state.pose && state.gt) {
dData = Math.hypot(state.pose.x - state.gt.x, state.pose.y - state.gt.y);
}
// Khoang cach VE: do tren hai doi tuong 3D that su dang duoc ve.
let dDraw = null;
const a = V3D.robotGroup && V3D.robotGroup.position;
const b = V3D.gtGroup && V3D.gtGroup.position;
if (!a || !b || !V3D.gtGroup.visible) { el.textContent = 'gap --'; return; }
const d = Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);
el.textContent = 'gap ' + d.toFixed(3) + ' m';
el.classList.toggle('bad', d > 0.05);
if (a && b && V3D.gtGroup.visible) {
dDraw = Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);
}
if (dData === null) { el.textContent = 'gap --'; el.title = ''; return; }
// ⚠️ Hien CA HAI khi chung khac nhau.
//
// Sai so du lieu va khoang cach ve la HAI so. Bang nhau nghia la hinh ve
// trung thuc va cai nhin thay la sai so that. Khac nhau nghia la con loi o
// tang hien thi -- da xay ra hai lan (thieu lop boc, va quen laser_x).
const drift = dDraw !== null && Math.abs(dDraw - dData) > 0.01;
el.textContent = 'gap ' + dData.toFixed(3) + ' m' +
(drift ? ' / ve ' + dDraw.toFixed(3) : '');
el.title = drift
? 'Sai so du lieu va khoang cach VE khac nhau -- con loi o tang hien thi.'
: 'Sai so uoc luong vs ground truth. Hinh ve trung thuc voi du lieu.';
el.classList.toggle('bad', dData > 0.05 || drift);
}
for (const b of document.querySelectorAll('.vbtn')) {
b.addEventListener('click', () => {
if (!setThreeD(true)) return;
v3dSetView(b.dataset.view);
});
}
function draw3d() {
@@ -813,7 +991,6 @@ function draw3d() {
V3D.gtGroup.visible = false;
}
updateGapChip();
v3dSetScan(on('lyScan') ? state.scan : null, state.pose, state.robot);
v3dSetCloud(on('lyCloud') ? state.cloud : null, state.pose);