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>
This commit is contained in:
@@ -1184,6 +1184,11 @@ namespace custom_planner
|
||||
// fabs(|a|-|b|): nó xoá dấu nên 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.
|
||||
//
|
||||
// Bản trên `main` chuẩn hoá cả hai góc về [0, 2pi) trước khi trừ rồi mới
|
||||
// wrapToPi. Chuẩn hoá chỉ cộng bội 2pi nên kết quả sau wrapToPi y hệt —
|
||||
// giữ dạng ngắn ở đây. Ngưỡng cũng giữ nguyên trị: mặc định của
|
||||
// `backward_decision_angle` là 0.5*pi, đúng con số `main` gắn cứng.
|
||||
double delta_angle = std::fabs(wrapToPi(yaw_goal - angle));
|
||||
return (delta_angle > config_.backward_decision_angle);
|
||||
}
|
||||
|
||||
@@ -171,9 +171,11 @@ namespace custom_planner {
|
||||
// Các hằng số chung cho cả START và GOAL
|
||||
static const double MAX_DISTANCE = 1.0; // Ngưỡng khoảng cách tối đa (m)
|
||||
static const double MIN_DISTANCE = 0.1; // Khoảng cách tối thiểu (m)
|
||||
static const double MIN_SCALE = 0.2; // Giá trị tối thiểu của hệ số
|
||||
static const double MIN_SCALE = 0.5; // Giá trị tối thiểu của hệ số
|
||||
static const double MAX_SCALE = 1.0; // Giá trị tối đa của hệ số
|
||||
static const double MAX_ANGLE_THRESHOLD = 0.77 * M_PI; // Ngưỡng góc tối đa
|
||||
static const double MAX_ANGLE_THRESHOLD = 0.9 * M_PI; // Ngưỡng góc tối đa
|
||||
static const double TURNING_GAIN = 0.8;
|
||||
static const double CALIB_VAL = 0.5;
|
||||
|
||||
int nearest_idx = 0;
|
||||
|
||||
@@ -212,7 +214,7 @@ namespace custom_planner {
|
||||
(MAX_DISTANCE - MIN_DISTANCE);
|
||||
|
||||
// === BƯỚC 3: TÍNH TOÁN NGƯỠNG GÓC ===
|
||||
double angle_threshold = (0.5 + std::abs(scale)) * 0.5 * M_PI;
|
||||
double angle_threshold = (CALIB_VAL + std::abs(scale)) * TURNING_GAIN * M_PI;
|
||||
if(angle_threshold >= MAX_ANGLE_THRESHOLD)
|
||||
angle_threshold = MAX_ANGLE_THRESHOLD;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user