diff --git a/src/custom_planner.cpp b/src/custom_planner.cpp index eef6806..e6b207e 100755 --- a/src/custom_planner.cpp +++ b/src/custom_planner.cpp @@ -51,6 +51,7 @@ namespace custom_planner plan.clear(); // Check for reinitialization needs + robot::log_error("yaw goal: %f", data_convert::getYaw(goal.pose.orientation)); bool do_init = false; if(!makePlanWithOrder(msg, start, goal)) return false; if (current_env_width_ != costmap_robot_->getCostmap()->getSizeInCellsX() || diff --git a/src/merge_path_calc.cpp b/src/merge_path_calc.cpp index f764ce0..fe659d8 100755 --- a/src/merge_path_calc.cpp +++ b/src/merge_path_calc.cpp @@ -179,7 +179,9 @@ namespace custom_planner { static const double MIN_DISTANCE = 0.1; // Khoảng cách tối thiểu (m) 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.95 * 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; @@ -218,7 +220,7 @@ namespace custom_planner { (MAX_DISTANCE - MIN_DISTANCE); // === BƯỚC 3: TÍNH TOÁN NGƯỠNG GÓC === - double angle_threshold = (1.0 + 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;