Commit Graph

3 Commits

Author SHA1 Message Date
efa8f4bb48 feat: route a profile to the matcher its pattern names, and add an arc dock model
The handler held one concrete VPatternMatcher, so a profile declaring
pattern: arc could not reach the arc matcher at all. It now picks by pattern at
start(), reads the arc_* keys from YAML, and calls whichever matcher the
profile named.

An explicit switch, not a virtual interface: the set of patterns is a closed
enum, each matcher weighs one DockProfile, and adding a shape is one member and
two branches - cheaper than an abstraction layer over two implementations. Each
matcher refuses a profile that is not its own, so a branch missing from that
switch shows up at BOOT with the pattern named, not at runtime as "it never
detects".

Intensities go only to the V matcher. findTape walks the ray span of a fitted
line segment and an arc produces none, so an arc profile that sets tape_enabled
is already refused when the config loads.

sim/models/dock_cradle_arc is a concave cradle, radius 0.40 m over 2.0 rad, for
testing this in Gazebo. Its origin sits ON the deepest point, unlike
dock_plate_v whose origin is 0.2121 m off the apex and has caused confusion:
the detector reports the deepest point, so here that is the same number you
spawn at, with nothing to subtract.

It is 24 flat facets rather than a mesh, because Gazebo classic has no arc
primitive and a mesh means a binary file in the repo. The approximation error
is the sagitta of one chord, 0.35 mm - an order below the 3 mm range noise, so
the circle fit cannot tell it from a real curve.

Two tests pin the routing rather than the matching rules, which have their own
tests in dock_pattern_detector: a cradle under an arc profile writes the goal
frame at the deepest point, and a V plate under the same arc profile is
rejected. Without the second one, a change that broke arc detection outright
would look exactly like the gate doing its job.
2026-08-26 20:15:05 +07:00
duongtd
9dc31e9b88 Warn that Gazebo will not spawn over an existing plate
Spawning the plate a second time fails with "entity already exists" and leaves
the previous one in the world. Edit the model, spawn again, and nothing
changes - which reads as a broken model rather than a refused spawn. It cost a
round trip here: the tape was added, the plate was respawned, and intensities
stayed at zero because the plate standing in the world was the one from before
the tape existed.

The launch and the README now say to delete first, and the README lists the
stale-plate case ahead of the two real ways intensities can come back empty, in
the order worth checking them.
2026-08-26 15:34:12 +07:00
duongtd
4ca57355ba Add a V plate model so the detector has something to find in simulation
The chain was testable but not runnable: simulation fakes the dock entirely
(use_simulated_goal writes an invented pose 1.6 m ahead of base_link), so no
physical object exists for a laser to see. Nothing in the worlds under
Test/simulators is a dock either.

This is the missing half - an SDF plate whose geometry matches the v_std
profile exactly: 90 degree interior angle, 0.30 m wings. 0.02 m thick so
min_split_dist does not read the two faces of one wing as two segments, and
0.6 m tall from the floor so a planar laser at any plausible mounting height
cuts through it.

The plate and the profile have to agree. Change the model and the wing_length
gate rejects the very object that was just spawned, which is the kind of
failure that looks like a broken detector.
2026-08-26 13:14:02 +07:00