web: chi lam muot HINH robot (truot 50 ms, bo du doan van toc 0.15 s lam vuot roi giat khi dung quay); scan + cloud neo theo pose THAT de dinh vao tuong -- neo theo pose muot thi lac quanh tuong moi khi xoay, roi mat
This commit is contained in:
@@ -12,7 +12,7 @@ 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-10-07a';
|
||||
const UI_VERSION = '2026-10-07b';
|
||||
|
||||
// ⚠️ HAI bang mau, mot cho moi khung. Chung KHONG duoc giong nhau.
|
||||
//
|
||||
@@ -626,8 +626,10 @@ function composePose(a, d) {
|
||||
//
|
||||
// CHI la hien thi: so lieu (px/py/pyaw, gap voi ground truth) van doc
|
||||
// `state.pose` THAT.
|
||||
const DISP_TAU = 0.08; // s
|
||||
const DISP_LEAD_MAX = 0.15; // s
|
||||
const DISP_TAU = 0.05; // s
|
||||
// KHONG du doan theo van toc (07/10): du doan 0.15 s lam robot VUOT qua roi giat
|
||||
// lai moi lan dung quay (0.8 rad/s x 0.15 s = 7 do) -- roi mat.
|
||||
const DISP_LEAD_MAX = 0.0; // s
|
||||
const DISP_SNAP_M = 1.0, DISP_SNAP_RAD = 0.8;
|
||||
const disp = { pose: null, t: 0, rx: 0, vx: 0, vyaw: 0 };
|
||||
|
||||
@@ -760,6 +762,9 @@ function drawScene(targetCv, targetCtx, grid, gridImage, robotPose, showGt, mapT
|
||||
// scan va cloud o frame robot -> xoay theo pose truoc khi ve. Nhung KHONG
|
||||
// phai pose hien tai: moi lop neo vao pose no thuoc ve, xem anchorPose().
|
||||
const p = robotPose;
|
||||
// Scan / cloud neo theo pose THAT -- dinh vao tuong cua ban do. Neo theo pose
|
||||
// lam muot (displayPose) thi chung lac quanh tuong moi khi quay (07/10: roi mat).
|
||||
const anchor = robotPose === state.dispPose ? state.pose : robotPose;
|
||||
if (p) {
|
||||
|
||||
// Ground truth ve TRUOC pose uoc luong, de pose ve de len tren: cai ta
|
||||
@@ -770,7 +775,7 @@ function drawScene(targetCv, targetCtx, grid, gridImage, robotPose, showGt, mapT
|
||||
|
||||
if (state.cloud && on('lyCloud')) {
|
||||
// Cloud KHONG dung `p` -- xem anchorPose().
|
||||
const cp = anchorPose(p, state.cloudPose);
|
||||
const cp = anchorPose(anchor, state.cloudPose);
|
||||
const cc = Math.cos(cp.yaw), cs = Math.sin(cp.yaw);
|
||||
const pts = state.cloud;
|
||||
for (let i = 0; i < pts.length; i += 3) {
|
||||
@@ -795,7 +800,7 @@ function drawScene(targetCv, targetCtx, grid, gridImage, robotPose, showGt, mapT
|
||||
const ly = (state.robot && state.robot.laser_y) || 0;
|
||||
// Neo vao pose LUC QUET, khong phai `p` -- xem anchorPose(). Khi quay
|
||||
// 50 do/s thi 100 ms giu giua hai khung la 5 do, o 3 m la 26 cm.
|
||||
const sp = anchorPose(p, state.scanPose);
|
||||
const sp = anchorPose(anchor, state.scanPose);
|
||||
const sc = Math.cos(sp.yaw), ss = Math.sin(sp.yaw);
|
||||
for (let i = 0; i < pts.length; i += 2) {
|
||||
const bx = pts[i] + lx, by = pts[i + 1] + ly;
|
||||
@@ -1374,9 +1379,9 @@ function draw3d() {
|
||||
}
|
||||
|
||||
v3dSetScan(on('lyScan') ? state.scan : null,
|
||||
anchorPose(state.dispPose, state.scanPose), state.robot);
|
||||
anchorPose(state.pose, state.scanPose), state.robot);
|
||||
v3dSetCloud(on('lyCloud') ? state.cloud : null,
|
||||
anchorPose(state.dispPose, state.cloudPose));
|
||||
anchorPose(state.pose, state.cloudPose));
|
||||
|
||||
// THE GIOI: tuong 3D dung tu ban do mo phong -- day la phan "Gazebo".
|
||||
// Dung MOT lan (ban do the gioi la tinh), roi chi bat/tat.
|
||||
|
||||
Reference in New Issue
Block a user