Refactor: cắt dead code, khai báo config đầy đủ, sửa quyết định tiến/lùi

Cắt bỏ (~2400 dòng):
- plan_for_retry.cpp: file ROS1 legacy (ros/ros.h, tf/tf.h), không nằm trong
  CMakeLists, không compile được trong stack này.
- pathway.{h,cc}, pose.cc, color.h, conversion.h: class Pathway/Edge/Point,
  Pose file-IO, agv_visualization::Color, Eigen conversion — 0 nơi dùng.
- Curve_common tỉa còn đúng API đang dùng (ReadSplineInf x2,
  CalculateCurvePoint); bỏ Generate_*/ShowDiscreatePoint*/Curvature* chết —
  nhờ đó bỏ dependency robot_visualization_msgs, robot_nav_msgs,
  robot_std_msgs khỏi CMakeLists + package.xml.
- Xoá 7 method declare-only/định nghĩa không ai gọi trong CustomPlanner
  (publishStats, loadPathwayData, findNearestPoseOfPath, computeDeltaAngle,
  divideSegment x2, transformFootprintToEdges, isThetaValid), member mutex_,
  khối gui_path build xong không publish.

Config (trước đây planner không đọc bất kỳ param nào — toàn bộ yaml là key
SBPL copy nhầm, mọi tunable hard-code):
- CustomPlannerConfig: 11 param có default = giá trị hard-code cũ (giữ nguyên
  hành vi khi yaml thiếu key), validate range + log giá trị chốt.
- Viết lại config/custom_global_params.yaml đủ key kèm đơn vị.
- FIX: NodeHandle("~/" + name) không resolve segment "~", âm thầm rơi về
  root nên getParam luôn trả default. Đổi sang NodeHandle(name).

Sửa đúng đắn:
- checkYawEdgeEnd: fabs(|a|-|b|) xoá dấu — cặp góc trái dấu cùng độ lớn
  (vd ±pi/2, lệch thật pi) cho delta=0, planner chọn nhầm đi tiến và robot
  quay đầu thay vì lùi. Thay bằng fabs(wrapToPi(yaw_goal - angle)), ngưỡng
  thành param backward_decision_angle (đồng bộ công thức với bản rb_ws).
- Bỏ new/delete thô: Spline_Inf/Curve_common thành member by-value ở cả
  CustomPlanner lẫn MergePathCalc.
- Bỏ using namespace std khỏi header; EPSILON toàn cục -> kEpsilon trong
  namespace; makePlan(start,goal) log qua robot::log_warning.
- package.xml viết lại (bản cũ copy nguyên metadata của tf2).

Verify:
- catkin_make --pkg custom_planner: PASS, symbol BOOST_DLL_ALIAS
  CustomPlanner còn trong libcustom_planner.so.
- Smoke test nạp config: đọc đúng 11 key từ cây pnkx_nav_core/config và
  Test/move_base2/config/runtime; override ăn; giá trị ngoài range bị kẹp
  kèm warning.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-12 21:37:52 +07:00
parent c16f846136
commit 728b65b97a
18 changed files with 352 additions and 2760 deletions

View File

@@ -1,55 +1,27 @@
<package>
<?xml version="1.0"?>
<package format="2">
<name>custom_planner</name>
<version>0.7.10</version>
<version>1.0.0</version>
<description>
custom_planner is the second generation of the transform library, which lets
the user keep track of multiple coordinate frames over time. custom_planner
maintains the relationship between coordinate frames in a tree
structure buffered in time, and lets the user transform points,
vectors, etc between any two coordinate frames at any desired
point in time.
Global planner materializes a VDA5050 Order (nodes/edges with NURBS
trajectories) into a dense plan for robot_nav_core. It is a route
materializer, not a search planner: the plain makePlan(start, goal)
contract is intentionally unsupported so the runtime falls back to a
search-based backup planner for bare goals.
</description>
<author>Tully Foote</author>
<author>Eitan Marder-Eppstein</author>
<author>Wim Meeussen</author>
<maintainer email="tfoote@osrfoundation.org">Tully Foote</maintainer>
<license>BSD</license>
<maintainer email="xroboticdevs@gmail.com">duongtd</maintainer>
<license>Proprietary</license>
<url type="website">http://www.ros.org/wiki/custom_planner</url>
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>robot_costmap_2d</build_depend>
<run_depend>robot_costmap_2d</run_depend>
<build_depend>robot_nav_core</build_depend>
<run_depend>robot_nav_core</run_depend>
<build_depend>robot_geometry_msgs</build_depend>
<run_depend>robot_geometry_msgs</run_depend>
<build_depend>robot_nav_msgs</build_depend>
<run_depend>robot_nav_msgs</run_depend>
<build_depend>robot_std_msgs</build_depend>
<run_depend>robot_std_msgs</run_depend>
<build_depend>robot_tf3_geometry_msgs</build_depend>
<run_depend>robot_tf3_geometry_msgs</run_depend>
<build_depend>robot_cpp</build_depend>
<run_depend>robot_cpp</run_depend>
<build_depend>robot_protocol_msgs</build_depend>
<run_depend>robot_protocol_msgs</run_depend>
<build_depend>robot_time</build_depend>
<run_depend>robot_time</run_depend>
<build_depend>robot_visualization_msgs</build_depend>
<run_depend>robot_visualization_msgs</run_depend>
<build_depend>data_convert</build_depend>
<run_depend>data_convert</run_depend>
</package>
<depend>robot_costmap_2d</depend>
<depend>robot_nav_core</depend>
<depend>robot_geometry_msgs</depend>
<depend>robot_tf3_geometry_msgs</depend>
<depend>robot_cpp</depend>
<depend>robot_protocol_msgs</depend>
<depend>robot_time</depend>
<depend>data_convert</depend>
<depend>eigen</depend>
<depend>boost</depend>
</package>