feat: read tape_plateau_min_fraction

This commit is contained in:
2026-10-30 09:43:47 +07:00
parent 1a76e7798f
commit d51f83804d
4 changed files with 44 additions and 4 deletions

View File

@@ -55,8 +55,11 @@ Sau đó `PoseSampleFilter` gom nhiều scan trong `global_frame` và chốt khi
`tape_bloom_max_angle` để bỏ vệt loang khỏi bề rộng hình học. Góc quá lớn có thể gộp vật cạnh chân;
giá trị 0 giữ đường cũ. `tape_range_bias_sigma` cho phép fit bù bias chung giữa chân dán và chân
trần; giá trị 0 tắt bù, prior quá rộng có thể làm fit theo sai điểm sáng. Kết quả có `|bias| > 0.1 m`
bị từ chối.
- Bộ lọc loại run sáng có độ trải cự ly lớn hơn `maxApparentLegWidth()`: về vật lý một chân không
bị từ chối. `tape_plateau_min_fraction` [-] mặc định 0 giữ cách loại cũ; bật cùng tape và bloom
để cứu run có plateau liên tiếp đủ dài nhưng mép dốc. KIT băng gương dùng 0.65; giảm ngưỡng có
thể nhận lõi bloom méo gây sai pose, tăng có thể mất chân thật. Giá trị phải nhỏ hơn 1.
- Mặc định bộ lọc loại run sáng có độ trải cự ly lớn hơn `maxApparentLegWidth()`; khi bật plateau
chỉ run đủ điều kiện trên mới được cứu. Về vật lý một chân không
thể trải theo tia xa hơn bề rộng biểu kiến của nó. Quy tắc này đòi ngưỡng cường độ nằm trên lõi.
Với lidar KIT, 5501 lõi thật ở ngưỡng 8000 trải tối đa khoảng 0.041 m; ở 4000 lõi thật đã tới
0.068 m, vì vậy cần dùng 8000.

View File

@@ -335,13 +335,13 @@ 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, "
"range bias sigma %.3f m, offset_yaw %.3f, prior %s in '%s') on '%s', entry "
"plateau %.3f, range bias sigma %.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_range_bias_sigma, p.offset_yaw,
p.tape_bloom_max_angle, p.tape_plateau_min_fraction, p.tape_range_bias_sigma, p.offset_yaw,
p.has_prior ? "on" : "off", prior_frame_.c_str(), scan_topic_.c_str(),
toString(entry_direction_), output_frame_.c_str());
}
@@ -464,6 +464,7 @@ private:
nh_param(p_nh, "shadow_min_angle", profile.shadow_min_angle);
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, "leg_cluster_gap", profile.leg_cluster_gap);
nh_param(p_nh, "leg_min_depth_gap", profile.leg_min_depth_gap);

View File

@@ -32,6 +32,21 @@ actions_trolley:
leg_shape: box
leg_width: 0.030 # [m]
min_legs: 3
# [-] Tỷ lệ plateau liên tiếp gần nhất trong run sáng bị trải cự ly; 0 tắt, cần bật tape và bloom.
# Tăng giúp loại lõi bloom dốc, nhưng dễ mất chân thật; giảm cứu thêm chân nhưng có thể nhận lõi méo.
# 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
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.
leg_shape: box
leg_width: 0.030 # [m] Bề rộng chân test.
tape_enabled: true
tape_bloom_max_angle: 0.10 # [rad] Góc lọc bloom cho test.
# [-] 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
tci_trolley_prior:
cart_opening: 0.517
cart_depth: 0.720

View File

@@ -508,6 +508,27 @@ TEST(TrolleyDetectionAction, RefusesAnUnknownProfile)
EXPECT_FALSE(h->start(makeAction("DetectTrolley", "khong_co_profile_nay"), robot::Time(10.0)));
}
TEST(TrolleyDetectionAction, LoadsPlateauFromYamlAndRejectsInvalidValue)
{
Rig rig;
ASSERT_TRUE(rig.loaded);
ActionHandler* handler = rig.registry.find("DetectTrolley");
ASSERT_NE(handler, nullptr);
EXPECT_TRUE(handler->start(makeAction("DetectTrolley", "tci_trolley_plateau"), robot::Time(10.0)));
const std::string key = "actions_trolley/detect_trolley/profiles/tci_trolley_plateau/"
"tape_plateau_min_fraction";
double value = 0.0;
ASSERT_TRUE(rig.nh.getParam(key, value));
EXPECT_DOUBLE_EQ(value, 0.65);
rig.nh.setParam(key, 1.0);
ActionRegistry invalid;
invalid.setContext(rig.ctx);
EXPECT_FALSE(invalid.loadFromConfig(rig.nh, kNamespace));
EXPECT_EQ(invalid.find("DetectTrolley"), nullptr);
rig.nh.setParam(key, 0.65);
}
TEST(TrolleyDetectionAction, RefusesToLoadWithoutASensorStore)
{
robot::NodeHandle nh;