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.
38 lines
1.9 KiB
XML
38 lines
1.9 KiB
XML
<!--
|
|
Dựng một máng cong LÕM vào world Gazebo đang chạy.
|
|
|
|
Chạy SAU khi world đã lên:
|
|
roslaunch dock_pattern_action spawn_dock_cradle.launch x:=3.0 y:=0.0 yaw:=3.14159
|
|
|
|
⚠ Gazebo TỪ CHỐI spawn đè lên model cùng tên: "SpawnModel: Failure - entity already exists".
|
|
Đã spawn một lần rồi thì phải xoá trước, nếu không thứ nằm trong world vẫn là BẢN CŨ:
|
|
|
|
rosservice call /gazebo/delete_model "model_name: 'dock_cradle_arc'"
|
|
|
|
KHÁC `spawn_dock_plate.launch` ở một điểm đáng nhớ: gốc model của máng đặt ĐÚNG TẠI ĐIỂM SÂU
|
|
NHẤT. Bộ dò báo toạ độ điểm sâu nhất, nên nó trùng luôn với `x`/`y` khai ở đây — không phải trừ
|
|
đi một khoảng như với tấm chữ V (gốc tấm V lệch 0.2121 m so với đỉnh).
|
|
|
|
`yaw` quay máng; lòng máng mở về phía -X của chính nó, nên mặc định 3.14159 để lòng hướng về +X
|
|
của world, tức robot đứng phía +X nhìn vào.
|
|
|
|
Hình học của model KHỚP một profile `pattern: arc` với `arc_radius: 0.40` và `arc_span: 2.0`.
|
|
Đổi model thì phải đổi profile theo, nếu không cổng `arc_radius` sẽ loại đúng cái máng vừa dựng.
|
|
-->
|
|
<launch>
|
|
<arg name="x" default="3.0" />
|
|
<arg name="y" default="0.0" />
|
|
<arg name="z" default="0.0" />
|
|
<arg name="yaw" default="3.14159" />
|
|
<arg name="name" default="dock_cradle_arc" />
|
|
|
|
<!-- Gazebo tìm model theo GAZEBO_MODEL_PATH; trỏ thẳng vào thư mục sim/models của gói này. -->
|
|
<env name="GAZEBO_MODEL_PATH"
|
|
value="$(find dock_pattern_action)/sim/models:$(optenv GAZEBO_MODEL_PATH)" />
|
|
|
|
<node name="spawn_$(arg name)" pkg="gazebo_ros" type="spawn_model" output="screen"
|
|
args="-sdf -file $(find dock_pattern_action)/sim/models/dock_cradle_arc/model.sdf
|
|
-model $(arg name)
|
|
-x $(arg x) -y $(arg y) -z $(arg z) -Y $(arg yaw)" />
|
|
</launch>
|