fix(leg_pattern): accept attached legs, treat zero range as no echo, rank ties by fit
On the KIT robot (28/10), hiding one trolley leg with a post always made detection fail with "too few legs". The far-right leg stood less than leg_min_depth_gap in front of another object, so its cluster was rejected as "attached". Hiding one more leg left only two free-standing legs. - LegProfile::accept_attached_legs (default false): an attached cluster that passes the width and point gates becomes a weak leg. A weak leg can be assigned to a corner, counts toward min_legs and enters the fit, but it cannot start a hypothesis. So every cart still needs one pair of free-standing legs at the right spacing. - ScanLimits::zero_range_is_no_echo (default false): the KIT driver reports no echo as range 0. The matcher read 0 as "blocked closer than min_range", so every leg edge was marked partial, and a 0 ray at a missing corner always read as occluded. With the flag set, an edge next to a 0 ray is free. A corner that sees only 0 rays carries no evidence. A ray that passes the corner and returns from a surface behind it still rejects the cart. - Confidence ties: fit_term saturates at 1, so two 4-leg hypotheses can both score 1.00. The nearer one used to win, even when it had taken a post standing 9 cm from a leg (3.4 cm off). Ties now go to the lower normalized RMS first. - LegDetection::legs_attached; the reason text says when only attached legs were found at the cart spacing. Tests: leg_pattern_matcher_kit_test replays 6 real KIT scans (test/data/kit_f_scan_trolley_occlusion.txt). leg_pattern_matcher_test adds 4 synthetic cases. With both keys off, behaviour is unchanged except for the tie rule. All 111 tests of this package and the trolley handler pass.
This commit is contained in:
20
README.md
20
README.md
@@ -170,6 +170,21 @@ cho `sqrt(σ_điểm² + (cart_dim_tolerance / 2)²)`: σ_điểm là nhiễu li
|
||||
`cart_dim_tolerance / 2` là σ của mô hình, cho sai số gia công giữa các xe cùng loại. Phần σ mô hình
|
||||
chỉ đổi điểm số, không đổi pose khớp.
|
||||
|
||||
**Chân dính** (`accept_attached_legs`, mặc định tắt). Cụm cỡ một chân mà mép liền với vật khác cùng
|
||||
tầm (tia kề lệch range dưới `leg_min_depth_gap`) mặc định bị loại như một mẩu tường. Bật khoá thì nó
|
||||
thành chân YẾU: được gán vào góc dự đoán, tính vào `min_legs`, điểm vào phép khớp — nhưng không lập
|
||||
giả thuyết, nên mỗi xe vẫn phải có một cặp chân đứng tự do đúng khoảng cách. Ca cần nó: xe đỗ sát
|
||||
tường/kệ/xe khác, chân phía sau không bao giờ "tự do", che thêm một chân là còn hai chân. Đổi lại dễ
|
||||
có thêm "xe ma" ghép từ chân thật và một vật dính tường đúng góc thứ ba; cổng mơ hồ và bộ lọc mẫu của
|
||||
handler chặn phần lớn. `LegDetection::legs_attached` đếm số chân yếu đã dùng.
|
||||
|
||||
**Lidar trả 0 khi không phản hồi** (`ScanLimits::zero_range_is_no_echo`, mặc định false). Nhiều
|
||||
driver báo tia không có phản hồi bằng range 0 thay vì inf. Đọc 0 là "bị chắn sát cảm biến" thì mọi mép
|
||||
chân kề tia 0 thành mép bị che (chân partial, dung sai ghép cặp nới thêm), và tia 0 tại góc thiếu chân
|
||||
thành "bị che". Bật khoá: mép kề tia 0 là mép tự do; tia 0 tại góc thiếu chân không phải bằng chứng gì
|
||||
— góc chỉ toàn tia 0 thì coi là không có thông tin, không loại xe; tia đi qua rồi trả về từ vật phía
|
||||
sau vẫn loại xe như cũ.
|
||||
|
||||
Quy ước đầu ra giống V/arc: `center_yaw` là pháp tuyến cạnh vào hướng về cảm biến; lật theo cách
|
||||
robot chui (tiến/lùi) là việc của handler. Plan đầy đủ: `Test/docs/trolley_detection_action/` của
|
||||
workspace phát triển.
|
||||
@@ -181,8 +196,13 @@ catkin_make --pkg dock_pattern_detector
|
||||
./devel/lib/dock_pattern_detector/v_pattern_matcher_test # 16 test
|
||||
./devel/lib/dock_pattern_detector/leg_pose_fit_test
|
||||
./devel/lib/dock_pattern_detector/leg_pattern_matcher_test
|
||||
./devel/lib/dock_pattern_detector/leg_pattern_matcher_kit_test # scan thật, test/data/
|
||||
```
|
||||
|
||||
`test/data/kit_f_scan_trolley_occlusion.txt` là 6 scan thật của lidar KIT (28/10): một cột che lần lượt
|
||||
từng chân, chân xa-phải dính vật phía sau. Mốc so sánh trong file là kết quả dò của chính robot, không
|
||||
phải số đo thước.
|
||||
|
||||
Test chạy đúng chuỗi mà handler sẽ chạy: dựng thế giới → chiếu tia → `robot_line_extraction` →
|
||||
matcher. Nhóm **từ chối** quan trọng hơn nhóm dò đúng, và mỗi ca từ chối khẳng định luôn *lý do* —
|
||||
một test chỉ kiểm `!valid` sẽ pass cả khi extractor không ra đoạn nào, tức matcher chưa hề bị thử.
|
||||
|
||||
Reference in New Issue
Block a user