main carried four commits made after this branch was cut, including field
tuning that must not be lost. Resolutions:
- merge_path_calc.cpp: take main's tuned constants (MIN_SCALE 0.2 -> 0.5,
MAX_ANGLE_THRESHOLD 0.77pi -> 0.9pi, TURNING_GAIN, CALIB_VAL). Auto-merged;
no behaviour from this branch touched them.
- makePlan(): keep this branch's snapshot refresh. main reinitialised the
planner whenever the costmap resized, which leaked the previous Spline_Inf
and Curve_common allocations; refreshing the snapshot covers the same case.
makePlanWithOrder() still runs, now after the refresh so the request sees
the current costmap. main's per-call yaw debug log is dropped.
- checkYawEdgeEnd(): keep this branch's form. main normalised both angles to
[0, 2pi) before subtracting and wrapping, which only adds multiples of 2pi
and yields the same result. The threshold is unchanged in value:
backward_decision_angle defaults to 0.5*pi, the constant main hard-coded.
main's per-call warning log is dropped - this runs inside planning.
Pre-existing on main and left alone: the second angle_threshold in
merge_path_calc.cpp (goal side) still uses the untuned 0.5*pi form while the
start side uses TURNING_GAIN. Worth a look, but not part of this merge.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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>
makePlan() no longer tears down and reallocates Spline_Inf/Curve_common when
the costmap size or footprint changes — the snapshot is only used to detect
the change, so refresh it in place. Destructor now frees the two allocations.
initialize() validates the costmap pointer before use.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>