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.
5.1 KiB
5.1 KiB