A run in simulation matched the pattern 23 times in 15 seconds out of roughly
435 scans - about five percent - and every miss reported the right vertex angle
with the wrong wing length. Measuring it: noise is not the cause (93 to 100
percent at the sensor's own 3 mm sigma) and neither is range (clean detections
out to 5 m). Viewing angle is. Turn the plate and the far wing goes nearly
edge-on to the beam, so few rays land on it and the extracted segment comes out
short. Past thirty degrees the detection rate falls to zero.
Requiring both wings at full length only works when the robot happens to face
the plate squarely, which is not something the approach guarantees. Occlusion
only ever shortens a wing; it cannot lengthen one. So the rule is no longer
symmetric: no wing may be LONGER than wing_length + tolerance, and at least one
must be within tolerance of it. A pallet corner still fails, because a pallet
has both sides long - that gate is untouched, and the test that covers it still
passes.
Confidence scores the length of the long wing rather than the short one. The
short wing is allowed to be short by the rule above, so penalising it again is
charging twice for the same thing, and it created a cliff: candidates cleared
the length gate only to fall at min_confidence. "Too little of it is visible to
trust" is already carried by the support term, which counts the rays on the
thinner wing and degrades smoothly.
With min_wing_points at 5, thirty degrees at 2.5 m goes from 0 to 77 percent,
forty degrees at 1.2 m from 0 to 80, fifty degrees from 0 to 82.
The rejection message also carries the measured vertex angle, both wing lengths
and the apex position now. Without them, "a wing 0.22 m because something is in
the way" and "a wing 0.80 m because that is a pallet" print the same line.
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.
A first run in simulation reported "1 candidate(s) matched the shape but fell
outside the search gate" every second for fifteen seconds. That says the
detector found the plate and something else threw it away, which is useful,
but not useful enough: the only question worth asking at that moment is
whether to widen the gate or turn the robot, and a count cannot answer it.
The reason now carries the position, bearing and range of the nearest rejected
candidate along with the gate that rejected it, so the number to put in the
config is read off the log instead of guessed. That is what the run needed and
did not have.
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.