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:
@@ -234,8 +234,9 @@ if(CATKIN_ENABLE_TESTING AND BUILDING_WITH_CATKIN)
|
||||
)
|
||||
endif()
|
||||
|
||||
# Hai test của bộ dò xe hàng dùng chung bộ dựng scan tổng hợp `test/leg_scan_sim.h`.
|
||||
foreach(leg_test leg_pose_fit_test leg_pattern_matcher_test)
|
||||
# Test của bộ dò xe hàng: hai test đầu dùng bộ dựng scan tổng hợp `test/leg_scan_sim.h`, test
|
||||
# `_kit` đọc scan thật của lidar KIT trong `test/data/`.
|
||||
foreach(leg_test leg_pose_fit_test leg_pattern_matcher_test leg_pattern_matcher_kit_test)
|
||||
catkin_add_gtest(${leg_test} test/${leg_test}.cpp)
|
||||
|
||||
if(TARGET ${leg_test})
|
||||
@@ -244,6 +245,10 @@ if(CATKIN_ENABLE_TESTING AND BUILDING_WITH_CATKIN)
|
||||
set_target_properties(${leg_test} PROPERTIES EXCLUDE_FROM_ALL FALSE)
|
||||
|
||||
target_compile_options(${leg_test} PRIVATE -Wall -Wextra)
|
||||
target_compile_definitions(${leg_test}
|
||||
PRIVATE
|
||||
DOCK_PATTERN_DETECTOR_TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/test/data"
|
||||
)
|
||||
|
||||
target_include_directories(${leg_test}
|
||||
PRIVATE
|
||||
|
||||
Reference in New Issue
Block a user