Commit Graph

3 Commits

Author SHA1 Message Date
588ed58b6d fix(leg_pattern): rescue a real taped leg's edge-ramp bright run from the bloom-spread gate 2026-10-30 09:43:41 +07:00
347896e252 fix(leg_pattern): segment mirror-taped legs by intensity and estimate their range bias
Mirror tape on the KIT lidar blooms: a taped leg returns a saturated core plus a skirt of
dim rays whose range climbs smoothly to the background. Clustering by geometry first made
taped legs attached (no depth jump at the edge) or too wide for the width gate, so the
robot found the cart in 6 of 227 scans at 1.2 m. The saturated core also reads 1-3 cm short.

All changes sit behind tape_enabled plus their own key; with the keys at 0 or tape off the
detector runs exactly as before.

- tape_bloom_max_angle [rad]: bright runs become leg candidates before geometric
  clustering. The bloom skirt is walked and masked, and the edge class comes from the walk.
  A bright core spread over more than the leg's apparent width in range is rejected: it is
  a leg corrupted by a nearer mirror's bloom.
- tape_range_bias_sigma [m]: the pose fit estimates one common range bias for bright points
  (x, y, yaw, b) with a Gaussian prior. This only happens when at least one bare leg anchors
  the range; otherwise the 3-DoF fit is unchanged. |b| > 0.1 m invalidates the fit. Pair
  spacing and measured dimensions use bias-corrected leg centres.
- Real KIT scans with intensities: 9 from the 2-leg-taped run (11:06) and 2 with all four
  legs taped (12:12).
2026-10-29 13:05:55 +07:00
979bef360d 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.
2026-10-28 16:37:28 +07:00