Commit Graph

4 Commits

Author SHA1 Message Date
1f04a95e1b feat: thêm mô hình động học differential và maneuver straight-pivot-straight
Hai thay đổi đi cùng một commit vì maneuver mới là hình dạng chính của base
differential, đồng thời là fallback của base Ackermann; tách ra sẽ tạo commit
trung gian không build được.

Mô hình động học (kinematics/kinematic_model):
- kAckermann là mặc định và giữ nguyên hành vi cũ, nên YAML chưa khai báo khoá
  này không đổi gì.
- kDifferential bỏ qua lookup axle TF. Base differential không publish frame
  trục lái, tra cứu sẽ ném exception và làm chết plugin ngay lúc initialize;
  bán kính quay nhỏ nhất do đó lấy thẳng từ kinematics/minimum_turning_radius.
- Bán kính 0 giờ là giá trị hợp lệ, nghĩa là robot xoay tại chỗ được. Chỉ giá
  trị âm hoặc không hữu hạn mới là lỗi cấu hình.

Maneuver straight-pivot-straight:
- Đỉnh xoay nằm giữa robot và dock nên không tốn thêm chiều sâu lối đi như
  cusp, vốn đẩy robot ra xa dock hơn chỗ đang đứng.
- Vòng xoay tại chỗ được ghi thẳng vào path thành một khối pose cùng vị trí,
  khác yaw. Base Ackermann không đổi hướng ở một góc gấp của polyline, nên
  trạng thái dừng-đánh-lái phải nằm trong plan chứ không để controller tự suy.
- maneuver/pivot_fallback_extension mở khoá hình dạng này cho Ackermann, đo
  bằng phần cusp đẩy robot RA XA dock hơn chỗ nó đang đứng. Ngưỡng tương đối
  là có chủ đích: bản trước đo chiều sâu lối đi tuyệt đối, cộng cả khoảng robot
  đang chiếm, nên loại bỏ mọi maneuver xuất phát từ khoảng cách tiếp cận bình
  thường. Mặc định 0 = tắt hoàn toàn.
- maneuver/pivot_safety_margin giữ khoảng hở giữa đường tròn thân xe quét khi
  xoay tại chỗ và mặt gần của dock. Xoay tại chỗ quay mọi điểm footprint quanh
  base_link nên kích thước liên quan là circumscribed radius, luôn lớn hơn
  mating extent dùng cho đoạn thẳng cuối.

Kiểm chứng: catkin_make --pkg dock_planner build sạch,
./devel/lib/dock_planner/dock_planner_test PASS.
2026-08-25 12:14:58 +07:00
5c0c5d96d7 update 2026-08-15 13:04:56 +07:00
2a16606c27 refactor & optimal 2026-08-14 14:04:47 +07:00
539fc5da16 Refactor DockPlanner: typed config, dock anchor, validated dock footprint
Split configuration out of the planner into DockPlannerConfig with explicit
load/validate, so a missing or malformed key fails at initialize() with a
message instead of silently defaulting to zero.

- initialize() now scopes its NodeHandle to the plugin name. The previous
  "~/<name>" form never resolved ("~" is not a key in the merged tree) and
  fell back to ROOT, so every parameter was read from the wrong place and
  cost_threshold silently dropped from 200 to 0.
- Replace robot_nav_2d_utils::footprintFromParams(), whose declaration and
  definition disagreed on the argument type. The symbol was never defined,
  and because the plugin is dlopen'd lazily the failure only surfaced at the
  call site on the robot, long after a clean build.
- Read footprint_dock, the dock object's polygon, with range and NaN checks.
  move_base2 copies it in per marker before the instance is built.
- dock_anchor selects whether the marker goal sits at the dock centre or on
  its approach face; the face case ignores footprint_dock entirely.
- makePlan() rejects start/goal outside the costmap global frame instead of
  planning across mismatched frames.
- Add dock_planner_test covering config validation, footprint parsing and
  path generation.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-12 21:52:52 +07:00