18 Commits

Author SHA1 Message Date
6eed3d8772 Merge origin/main into refactor/custom-planner-config
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>
2026-08-12 22:12:00 +07:00
728b65b97a 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>
2026-08-12 21:37:52 +07:00
c16f846136 Fix costmap-resize reinit leak: refresh snapshot instead of recreating planner state
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>
2026-08-12 21:17:45 +07:00
49ea9fe7f5 update v 2026-04-24 15:50:34 +07:00
d5ef0b1075 Hiep sửa bản kính R 2026-04-24 14:50:27 +07:00
62a493a892 update 2026-04-15 07:30:04 +00:00
78b9679049 update 2026-04-06 02:44:45 +00:00
7c84705ce7 update calcDirecPath 2026-03-23 03:02:29 +00:00
43810ce140 update tf3 2026-02-07 10:57:37 +07:00
e0f6738c31 optimal 2026-01-30 10:56:41 +07:00
49afcce5b2 update 2026-01-16 15:12:17 +07:00
a2bebb5be9 CustomPlanner 2026-01-09 10:38:55 +07:00
540d79321b update for ROS 2026-01-07 16:54:53 +07:00
0b01c22019 robot_nav_core 2026-01-07 09:19:10 +07:00
60e9c5673f HiepLM update 2025-12-30 10:22:16 +07:00
d6512018ef hiep sua ten file 2025-12-30 09:57:13 +07:00
6d55c6c4be Hiep update 2025-12-30 09:06:20 +07:00
377ebe3d6f first commit 2025-12-19 16:45:50 +07:00