feat: read tape_range_bias_all_max_std and log the bias std

This commit is contained in:
2026-10-30 10:58:56 +07:00
parent d51f83804d
commit b00d320094
4 changed files with 39 additions and 6 deletions

View File

@@ -98,3 +98,9 @@ catkin_make --pkg dock_pattern_detector trolley_detection_action
./devel/lib/dock_pattern_detector/leg_pattern_matcher_test
./devel/lib/trolley_detection_action/trolley_detection_action_test
```
`tape_range_bias_all_max_std` [m] mặc định 0 tắt fit bias khi không có chân trần.
Khi bật tape, `tape_legs: all` và sigma bias dương, fit chỉ được nhận nếu σ hậu nghiệm không vượt
ngưỡng; nếu vượt, handler nhận kết quả fit 3-DoF cũ. Tăng ngưỡng nhận ở xa hơn nhưng có thể bù
sai pose; giảm làm gate bảo thủ hơn. KIT dán cả 4 chân dùng 0.02 m (chọn từ replay 3 bag, xem
README `dock_pattern_detector`); chưa chạy trên robot.

View File

@@ -335,13 +335,14 @@ public:
const dock_pattern_detector::LegProfile& p = found->second;
robot::log_info("[trolley_detection][debug] '%s': detecting profile '%s' (cart %.3f x %.3f m, "
"leg %s %.3f m, min_legs %d, attached legs %s, tape %s/%s, bloom %.3f rad, "
"plateau %.3f, range bias sigma %.3f m, offset_yaw %.3f, prior %s in '%s') on '%s', entry "
"plateau %.3f, range bias sigma %.3f m, all max std %.3f m, offset_yaw %.3f, prior %s in '%s') on '%s', entry "
"%s -> '%s'.",
name_.c_str(), profile_name.c_str(), p.cart_opening, p.cart_depth,
dock_pattern_detector::toString(p.leg_shape), p.leg_width, p.min_legs,
p.accept_attached_legs ? "on" : "off",
p.tape_enabled ? "on" : "off", dock_pattern_detector::toString(p.tape_legs),
p.tape_bloom_max_angle, p.tape_plateau_min_fraction, p.tape_range_bias_sigma, p.offset_yaw,
p.tape_bloom_max_angle, p.tape_plateau_min_fraction, p.tape_range_bias_sigma,
p.tape_range_bias_all_max_std, p.offset_yaw,
p.has_prior ? "on" : "off", prior_frame_.c_str(), scan_topic_.c_str(),
toString(entry_direction_), output_frame_.c_str());
}
@@ -466,6 +467,7 @@ private:
nh_param(p_nh, "tape_bloom_max_angle", profile.tape_bloom_max_angle);
nh_param(p_nh, "tape_plateau_min_fraction", profile.tape_plateau_min_fraction);
nh_param(p_nh, "tape_range_bias_sigma", profile.tape_range_bias_sigma);
nh_param(p_nh, "tape_range_bias_all_max_std", profile.tape_range_bias_all_max_std);
nh_param(p_nh, "leg_cluster_gap", profile.leg_cluster_gap);
nh_param(p_nh, "leg_min_depth_gap", profile.leg_min_depth_gap);
nh_param(p_nh, "accept_attached_legs", profile.accept_attached_legs);
@@ -797,22 +799,22 @@ private:
{
robot::log_info("[trolley_detection][debug] '%s': cart at (%.3f, %.3f) yaw %.3f in '%s'%s, "
"legs seen %d (partial %d, attached %d, occluded %d, out of view %d), "
"measured %.3f x %.3f m, fit rms %.4f m, tape range bias %.3f m, confidence "
"measured %.3f x %.3f m, fit rms %.4f m, tape range bias %.3f m (std %.4f m; 0 = unavailable), confidence "
"%.2f.",
name_.c_str(), d.center_x, d.center_y, d.center_yaw, pending_frame_.c_str(),
scan_flipped_ ? " (upright view)" : "", d.legs_seen, d.legs_partial,
d.legs_attached, d.legs_occluded, d.legs_out_of_view, d.measured_opening,
d.measured_depth, d.fit_rms, d.tape_range_bias, d.confidence);
d.measured_depth, d.fit_rms, d.tape_range_bias, d.tape_range_bias_std, d.confidence);
}
else
{
robot::log_info("[trolley_detection][debug] '%s': cart at (%.3f, %.3f) yaw %.3f in '%s'%s, "
"legs seen %d (partial %d, attached %d, occluded %d, out of view %d), "
"measured %.3f x %.3f m, fit rms %.4f m, confidence %.2f.",
"measured %.3f x %.3f m, fit rms %.4f m, bias off (std %.4f m; 0 = unavailable), confidence %.2f.",
name_.c_str(), d.center_x, d.center_y, d.center_yaw, pending_frame_.c_str(),
scan_flipped_ ? " (upright view)" : "", d.legs_seen, d.legs_partial,
d.legs_attached, d.legs_occluded, d.legs_out_of_view, d.measured_opening,
d.measured_depth, d.fit_rms, d.confidence);
d.measured_depth, d.fit_rms, d.tape_range_bias_std, d.confidence);
}
}

View File

@@ -37,6 +37,9 @@ actions_trolley:
# Ngưỡng quá thấp nguy hiểm vì pose sai; phải nhỏ hơn 1. KIT dán băng gương dùng 0.65 để giữ
# chân có dốc ở mép và loại lõi bị bloom; chỉ dùng sau khi kiểm chứng trên scan của lidar.
tape_plateau_min_fraction: 0.0
# [m] σ tối đa cho bias khi mọi góc đều sáng; 0 tắt. Tăng nhận xa hơn nhưng dễ sai pose;
# giảm bỏ nhiều trường hợp. Ngưỡng lớn nguy hiểm do bias lẫn với tịnh tiến; miền 0–0.1.
tape_range_bias_all_max_std: 0.0
tci_trolley_plateau:
cart_opening: 0.517 # [m] Khoảng cách chân cạnh vào của xe test.
cart_depth: 0.720 # [m] Khoảng cách chân dọc xe test.
@@ -47,6 +50,11 @@ actions_trolley:
# [-] Ngưỡng plateau: tăng loại nhiều lõi dốc hơn, giảm dễ nhận lõi méo gây sai pose;
# 0 tắt, phải nhỏ hơn 1 và cần tape cùng bloom. KIT băng gương dùng 0.65 để cứu mép dốc.
tape_plateau_min_fraction: 0.65
# [m] σ tối đa cho bias mọi góc sáng; 0 tắt, cần tape và sigma > 0.
# Tăng nhận xa hơn nhưng dễ sai pose; giảm từ chối nhiều hơn; > 0.1 nguy hiểm và bị cấm.
# 0.02 chỉ để test, KIT cần replay xác nhận trước khi sử dụng.
tape_range_bias_sigma: 0.05
tape_range_bias_all_max_std: 0.02
tci_trolley_prior:
cart_opening: 0.517
cart_depth: 0.720

View File

@@ -529,6 +529,23 @@ TEST(TrolleyDetectionAction, LoadsPlateauFromYamlAndRejectsInvalidValue)
rig.nh.setParam(key, 0.65);
}
TEST(TrolleyDetectionAction, LoadsAllBrightBiasThresholdAndRejectsInvalidValue)
{
Rig rig;
ASSERT_TRUE(rig.loaded);
const std::string key = "actions_trolley/detect_trolley/profiles/tci_trolley_plateau/"
"tape_range_bias_all_max_std";
double value = 0.0;
ASSERT_TRUE(rig.nh.getParam(key, value));
EXPECT_DOUBLE_EQ(value, 0.02);
rig.nh.setParam(key, 0.101);
ActionRegistry invalid;
invalid.setContext(rig.ctx);
EXPECT_FALSE(invalid.loadFromConfig(rig.nh, kNamespace));
EXPECT_EQ(invalid.find("DetectTrolley"), nullptr);
rig.nh.setParam(key, 0.02);
}
TEST(TrolleyDetectionAction, RefusesToLoadWithoutASensorStore)
{
robot::NodeHandle nh;