Separate the measured calibration from the derived offset

offset_x/y/yaw carried two different things at once. Part of it is geometry
that can be worked out on paper - half the robot, the footprint padding, how
far the wings project toward the robot, the clearance. The rest is whatever
the real station turns out to need: a laser mounted slightly off, odometry
bias, a systematic lean in the detection.

Folded into one number, changing the footprint silently discards the field
correction that was tuned into it, and nobody can look at the value later and
say which half is which. The first time someone re-derives the geometry, the
calibration is gone and nothing says so.

calib_x/y/yaw are added on top, in the same frame, defaulting to zero. Dock,
measure how far base_link ended up from where it should have, subtract it
here. The geometry stays derivable and the correction stays visible.

They are bounded to 0.30 m and 0.20 rad. Field calibration is centimetres and
degrees; needing half a metre means offset_x is wrong, and taping over that
with a calibration term hides the cause until the next footprint change makes
it worse.
This commit is contained in:
duongtd
2026-08-26 15:07:24 +07:00
parent c54f8d4cd1
commit 000374791b
4 changed files with 104 additions and 5 deletions

View File

@@ -112,6 +112,31 @@ struct DockProfile
/// [rad] Bù tấm lắp XOAY so với đầu cắm.
double offset_yaw = 0.0;
// --- Hiệu chỉnh hiện trường -------------------------------------------------------------------
//
// Cộng thêm vào `offset_*`, cùng hệ quy chiếu. Tách riêng chứ không gộp vào `offset_*` vì hai
// nhóm này đến từ hai nguồn khác nhau và có vòng đời khác nhau:
//
// offset_* SUY RA được bằng công thức (nửa thân xe + padding + hình chiếu cánh + khe hở).
// Đổi xe, đổi padding hay đổi tấm là phải TÍNH LẠI.
// calib_* ĐO được sau khi dock thật: sai lệch còn lại do cảm biến lắp lệch, odometry lệch,
// hoặc phép dò lệch hệ thống. Không suy ra được, chỉ đo.
//
// Gộp chung thì mỗi lần đổi footprint là mất luôn phần hiệu chỉnh đã đo, và không ai phân biệt
// được con số nào là hình học, con số nào là bù sai số.
//
// Cách dùng: dock thật, đo sai lệch của `base_link` so với chỗ đáng lẽ phải dừng, rồi TRỪ vào
// đây. Dừng xa 2 cm -> calib_x = -0.02.
/// [m] Hiệu chỉnh dọc pháp tuyến. Dương = dừng xa tấm hơn.
double calib_x = 0.0;
/// [m] Hiệu chỉnh ngang. Dương = lệch sang trái theo hướng tấm.
double calib_y = 0.0;
/// [rad] Hiệu chỉnh góc.
double calib_yaw = 0.0;
// --- Cổng chất lượng ---------------------------------------------------------------------------
/// Số tia đỡ tối thiểu cho MỘT cánh. Dưới ngưỡng này phép khớp không còn nghĩa thống kê.