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).
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.
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.
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.
New profile key v_shape (any | concave | convex), default any = old behaviour. A corner of a cabinet or pallet with the same vertex_angle and wing_length passes every other gate; only the opening direction tells it from a dock that wraps the robot. v_shape is rejected on a non-v pattern. A rejection by orientation has its own reason string. Tests added.
The target point was the point on the fitted circle furthest from the sensor,
and yaw was the direction from there back to the sensor. Both are defined
against WHERE YOU ARE STANDING, so the detector always reported that the dock
faces exactly where the robot happens to be. Measured on one fixed cradle from
five positions:
view offset 0 10 20 30 40 deg
yaw error -0.0 -10.0 -20.0 -30.0 -40.0 deg
The yaw error equals the viewing offset exactly, and the target slid along the
arc with it, from (0.400, 0.000) to (0.306, -0.257). Nothing in the log looked
wrong. It surfaced because the goal moved between missions while the cradle had
not been touched.
A CIRCLE has no axis. Only the physical ARC does, and it is the bisector of the
two endpoint radii. fitCircle now reports mid_angle, and the pose comes from
that: target = C + R*(cos mid, sin mid), yaw = mid + pi. Same five positions:
yaw error -0.2 -0.2 -0.3 -2.4 -3.9 deg
I had written the old definition up as a feature - stable when part of the arc
is hidden. It was stable, at the wrong value, by not looking at the shape.
The residual at 30-40 degrees is real and has to be gated, not hidden: an
occluded edge moves the observed midpoint, and the measured relationship is
yaw error ~= (true span - observed span) / 2. So arc_span is now checked on
BOTH sides with its own arc_span_tolerance, rather than being an upper bound
borrowing slack from arc_radius_tolerance. Seeing too little of the arc is as
dangerous as seeing too much, and only one of those was being caught.
This reverses the earlier reasoning that copied the V's asymmetric wing rule.
The analogy does not hold: a V's apex and bisector survive one wing being
short because they are intrinsic, and an arc's axis does not exist at all
without both edges.
ThePoseFollowsTheDockNotTheRobot pins it, and pins it by rotating the DOCK, not
the world. The first draft rotated the whole scene about the sensor, which
leaves the sensor-to-dock relationship unchanged and passes under the old
definition too - it guarded nothing. Rotating the dock in place fails the old
code by 20.05 degrees.
RefusesAnArcWithAnEdgeHiddenBecauseTheAxisWouldBeWrong replaces a test that
asserted the opposite. That test was pinning the bug.
Grouping segments into an arc candidate keyed only on ray index, and that is
not the same question as whether they lie on one surface: the next ray along
can land on something several metres away.
Found in Gazebo, not in a synthesized scene. The four segments of a cradle sat
two rays away from a 6.6 m wall behind it, so the wall was absorbed into the
group; the circle fitted over all of it came out at radius 3.2 m with a 0.11 m
residual, and the real cradle was rejected because of something that was not
part of it. The regression test reproduces the same signature - radius 1.38 m,
residual 0.20 m - and passes once the gap is checked.
arc_max_point_gap is the euclidean distance between the two facing endpoints,
and it belongs at or below the extractor's max_line_gap. Set it higher and the
matcher rejoins exactly what the extractor just separated, which it separated
for a reason.
Second shape after the V. Same output contract - a pose in the scan frame - so
dock_target and everything downstream of it are untouched.
CircleFit uses Taubin rather than Kasa, and that is the whole reason it is
worth writing rather than reaching for the four-line linear fit. Kasa is biased
on a SHORT arc, and a short arc is the normal case: the dock is partly hidden,
or the robot approaches at an angle. Measured on a true 0.40 m arc, 18 points,
3 mm noise, averaged over 200 seeds:
arc span Taubin Kasa
180 deg +0.0 mm -0.0 mm
90 deg +0.1 mm -1.4 mm
45 deg +1.9 mm -24.3 mm
30 deg +8.6 mm -101.6 mm <- Kasa reads 0.40 m as 0.298 m
20 deg +25.4 mm -256.7 mm
With Kasa a 0.40 m dock seen at an angle is scored as 0.30 m, falls outside
radius_tolerance, and the symptom is "it never detects" - indistinguishable
from the dock not being in range. arc_min_span defaults to 30 degrees off that
same table, because below it even Taubin starts to drift.
The matcher takes line segments as input even though it is looking for a curve.
The extractor breaks a curved surface into short straight pieces - correct
behaviour, and convenient here: those pieces are adjacent by ray number, so
their combined support is the arc's point run. That reuses the gap splitting
and outlier rejection that already ran instead of adding a second segmenter
beside the first. A short shallow arc can come out as one segment, looking
straight under min_split_dist, and still fits: the circle fit reads raw points
and does not care what the extractor called them.
Grouping keys on this_start >= prev_end, not >. On a distance split the
extractor SHARES the corner point between both halves, so two pieces of one
surface meet at the same ray number. Requiring strictly greater grouped
nothing, and every 0.5 rad fragment then failed arc_min_span - a real arc
rejected on a fragment's arithmetic. The shared point is also skipped when
gathering, so it does not get double weight at the joint.
The gates, in order:
- fit residual first, because EVERY set of points fits some circle, a right
angle included. Residual is the only thing separating an arc from a bend,
so radius and span only mean something after it passes.
- span has a floor (numerical: trust the fit) and a ceiling (geometric: a
longer arc is a different object). Not an equality - occlusion only ever
shortens an arc, the same asymmetry as the V's wing lengths.
- concavity: the centre must lie between the sensor and the surface. A convex
cylinder is the same circle curving the other way, and taking one for the
other puts the target pose behind the surface - the robot is told to drive
into the object.
The target is the deepest point, C * (1 + R/|C|), which depends only on centre
and radius and so does not move when part of the arc is hidden. The midpoint of
the observed arc would be easier and would shift the moment one side is
occluded.
tape_enabled is refused on an arc profile rather than ignored. findTape walks
the ray span of a fitted line and an arc produces none, so accepting the flag
would leave someone believing a gate is protecting them.
Measured end to end, 200 runs per cell, 3 mm noise, 690 rays: 100% detection at
1.4-2.0 rad of span out to 3 m, apex within 1-2 mm, radius read as 0.399-0.401
against a true 0.400. It thins out at 0.7 rad (77-80% near, 26% at 5 m), which
is arc_min_span doing its job.
Geometry alone cannot answer the question that matters in a warehouse. Every
wall corner and every pair of pallets stacked at a right angle is a V of some
size, and enough of them are the right size. None of them carry two strips of
reflective tape at the expected spacing.
Off by default: with tape_enabled false the matcher never reads the intensity
array and nothing about the existing behaviour changes.
On, it is an extra criterion, not a fifth pattern type. Shape still decides
where the apex is and the pose that comes out is still entirely from shape;
the tape only answers whether this is the dock. The check runs after every
geometric gate, because it is the expensive one and geometry has already
thrown out nearly every candidate by then - measured at +0.11 us per scan
against the 508 us the line extraction ahead of it already costs.
On each wing it takes the longest consecutive run of bright rays, then:
- the two run centres must be tape_spacing apart;
- each run must be tape_width long, checked only when the run has 2 or more
rays. One ray tells you it is bright but not how wide, and at the range
where that happens the tape is what you needed most, so the criterion is
skipped rather than guessed.
Runs are searched across the whole ray span the wing covers, not only the rays
that supported the fitted line: tape that stands proud of the wing surface can
be split off into its own segment, and then the very rays being looked for no
longer belong to any wing.
The measured width is always short - the outermost bright rays land inside the
strip, not on its edges, so the span between them misses up to one ray spacing.
At 3 m one nanoscan3 ray spacing is 0.021 m, 17% of a 0.12 m strip. That is
systematic, not noise, so it is corrected: n bright rays span exactly n-1 gaps,
and adding one gap adds half a gap at each edge. The gap comes from the run
itself, so it self-calibrates for range and for how obliquely the plate is
seen, with no extra parameter. On a deliberately coarse 200-ray scan it reads
0.119 m against a true 0.120 m.
tape_min_intensity carries each sensor's own units and has no common scale -
Gazebo passes laser_retro straight through, a real nanoscan3 does not. When the
profile asks for tape and the scan carries no intensities at all, the reason
says so, because that symptom is otherwise identical to "the dock is not in
range" and only one of the two is fixable in config.
A run reported "10 pair(s) of lines cross but do not end at the crossing" over
and over. Ten pairs implies five segments, which is a very different scene from
two, and the message did not say which. A scan fragmenting into a dozen short
pieces and a scan holding only the two far walls print the same line today, yet
they need opposite adjustments: min_split_dist and min_line_length for the
first, a different place to stand for the second.
Every refusal now ends with the segment count, and Detection carries it so a
caller can act on it rather than parse a string.
The split existed to stop a footprint change from silently discarding a field
correction tuned into the same number. Two knobs per axis is a cost paid on
every read of the config, and the person tuning these is the one who knows
which part is which, so the simpler shape wins.
The derivation stays where it matters: the formula for offset_x - half the
robot, the padding, the wing projection, the clearance - is written out in the
runtime config next to the value, so recomputing it after a footprint change
does not start from a guess.
offset_x/y/yaw carried two different things at once. Part of it is geometry
that can be worked out on paper - half the robot, the footprint padding, how
far the wings project toward the robot, the clearance. The rest is whatever
the real station turns out to need: a laser mounted slightly off, odometry
bias, a systematic lean in the detection.
Folded into one number, changing the footprint silently discards the field
correction that was tuned into it, and nobody can look at the value later and
say which half is which. The first time someone re-derives the geometry, the
calibration is gone and nothing says so.
calib_x/y/yaw are added on top, in the same frame, defaulting to zero. Dock,
measure how far base_link ended up from where it should have, subtract it
here. The geometry stays derivable and the correction stays visible.
They are bounded to 0.30 m and 0.20 rad. Field calibration is centimetres and
degrees; needing half a metre means offset_x is wrong, and taping over that
with a calibration term hides the cause until the next footprint change makes
it worse.
The detection chain had a gap between line segments and a navigation goal.
This is that step: segments plus the geometry of one charger, out comes the
pose base_link has to reach, in the scan's own frame.
Pure geometry, no TF and no action, so it is testable the same way the line
extractor is - build the world, cast the rays, and the answer is known before
the code runs. The tests exercise the real chain end to end, from synthetic
world through robot_line_extraction into the matcher.
The output is the goal pose, not the charger's pose. dock_planner deliberately
carries no standoff key: it derives which edge of the robot meets the dock from
which side of the goal the robot stands on, and that only works because the
goal already is where base_link must end up. The standoff is also a property of
the charger - how deep its contacts sit - so it belongs to the profile.
apex_x/apex_y keep the pre-offset vertex, because a wrong offset and a wrong
detection look identical from the final pose alone.
Matching a V:
The vertex is the intersection of the two fitted lines, not the midpoint of
their endpoints. A line is a least-squares fit over tens of rays; an endpoint
is one ray and much noisier.
Both segments must END near that intersection. Any two non-parallel walls cross
somewhere, and without this gate a corridor corner reads as a dock.
The vertex angle is measured between the two wing vectors from the apex, not
between the two normals. The two agree at exactly 90 degrees and diverge
everywhere else, so confusing them is a silent error at every other opening.
Wing length is what rejects a pallet corner: a pallet has a perfect right
angle, it just has metre-long sides.
Yaw is the bisector pointing back at the sensor, and its sign is chosen by
comparing against the sensor position rather than by the order of the two
wings. That order flips with which side the robot approaches from, and being
180 degrees out here means reversing into the plate instead of driving in.
Confidence is the worst of the three criteria, not their mean. A mean lets a
shape with a badly wrong angle through on the strength of the other two.
The search gate is not optional in a warehouse: any two perpendicular pallets
are a V. candidate_count reports how many survived every gate, so an ambiguous
scene is visible to the layer above rather than silently resolved.
A failed detection reports which gate it failed. "Nothing there" and "something
there but the wrong length" need opposite responses, and one failure line
cannot carry that.
Declaring a pattern that is not implemented is refused at configure time.
Accepting it would produce a detector that never finds anything, which looks
exactly like a charger out of range.