Commit Graph

4 Commits

Author SHA1 Message Date
a6c09f2386 fix(leg_pose_fit): estimate the taped range bias when every leg is taped, gated by its per-leg posterior std 2026-10-30 10:58:55 +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
cb401e6316 fix(leg_pattern): let cart_dim_tolerance widen the confidence score
The fit term divided the residual by the lidar noise only, so a trolley that
is a few cm off the profile (machining tolerance between carts of the same
type) scored a "poor fit" even though its pose was accurate: 3 legs seen and
a 3 cm error gave confidence 0.38 < 0.5 and the action timed out on the KIT
robot.

Add FitNoise::model_sigma and divide by sqrt(sigma^2 + model_sigma^2) when
scoring. The matcher passes cart_dim_tolerance / 2. Only the score changes:
the fit weights, the pose and the rms are bit-identical. A cart far outside
the tolerance is still rejected by the pair gates.

Tests: model_sigma changes the score but not the pose; a cart 3 cm narrower
and 2.5 cm longer than the profile is accepted with 4 and with 3 legs; a cart
15 cm wider is rejected. v/arc/circle tests unchanged.
2026-10-28 15:48:49 +07:00
c568e90c53 feat(leg_pattern): add LegPatternMatcher for 4-leg trolleys
Finds a 4-leg trolley in a raw LaserScan without line extraction:
shadow filter, leg clusters in ray order with free/occluded/attached edges,
pair hypotheses from cart_opening/cart_depth/diagonal, then a Gauss-Newton
pose fit over every leg point with an along-ray residual, Huber weights and
backtracking. Gates: pair spacing after the fit, see-through leg positions,
optional empty interior, entry side (entry tape / prior yaw / facing the
sensor), optional prior, confidence, and ambiguity between two carts.

LegProfile validates every key at load. Two gtests (7 + 23) run on a
synthetic ray-cast scan (test/leg_scan_sim.h). Used by trolley_detection_action.
2026-10-28 13:43:56 +07:00