From 31c5b218cbb5af9f6000215dd94da973e1000557 Mon Sep 17 00:00:00 2001 From: duongtd Date: Sat, 15 Aug 2026 13:37:50 +0700 Subject: [PATCH] =?UTF-8?q?docs:=20vi=E1=BA=BFt=20l=E1=BA=A1i=20comment=20?= =?UTF-8?q?c=C3=A1c=20file=20config=20b=E1=BA=B1ng=20ti=E1=BA=BFng=20Vi?= =?UTF-8?q?=E1=BB=87t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit File YAML là thứ người vận hành mở ra sửa khi đứng cạnh robot, nên comment phải đọc hiểu ngay. Mỗi tham số ghi đủ đơn vị, ý nghĩa và hệ quả khi tăng/giảm. Tên key, plugin, frame, topic và thuật ngữ đã chuẩn hoá giữ nguyên tiếng Anh. Không đổi một giá trị nào. --- config/runtime/costmap_common_params.yaml | 5 +- config/runtime/dock_global_params.yaml | 100 +++++++------ .../runtime/hybrid_local_planner_params.yaml | 106 ++++++++------ config/runtime/mppi_local_planner_params.yaml | 10 +- config/runtime/pnkx_local_planner_params.yaml | 136 +++++++++--------- .../runtime/priest_local_planner_params.yaml | 100 +++++++------ 6 files changed, 248 insertions(+), 209 deletions(-) diff --git a/config/runtime/costmap_common_params.yaml b/config/runtime/costmap_common_params.yaml index 30fb35e..128514b 100755 --- a/config/runtime/costmap_common_params.yaml +++ b/config/runtime/costmap_common_params.yaml @@ -96,5 +96,6 @@ obstacles: frustum_min_range: 0.20 frustum_max_range: 3.5 - # Depth camera clearing is handled by VoxelLayer frustum clearing from - # /camera/depth/image_raw + /camera/depth/camera_info. /camera_right/depth/data + # Việc xoá vật cản (clearing) của camera depth do VoxelLayer đảm nhiệm bằng + # frustum clearing, lấy dữ liệu từ /camera/depth/image_raw + + # /camera/depth/camera_info. Nhánh /camera_right/depth/data cũng đi đường đó. diff --git a/config/runtime/dock_global_params.yaml b/config/runtime/dock_global_params.yaml index c1c6a00..5501d04 100644 --- a/config/runtime/dock_global_params.yaml +++ b/config/runtime/dock_global_params.yaml @@ -1,70 +1,84 @@ -# DockPlanner: one curved lead-in away from the dock, one direction change, then -# a straight terminal leg along the goal yaw. +# DockPlanner — global planner sinh đường vào dock. # -# Which robot edge mates with the dock is DERIVED per plan from the side the -# robot stands on, not configured: -# robot on the +X side of the goal -> lead-in forward, terminal REVERSE -# (rear edge docks: forks into a pallet) -# robot on the -X side of the goal -> lead-in reverse, terminal FORWARD -# (front edge docks: charging contact) -# This works because the goal pose is already offset upstream so that base_link -# lands exactly on it for the intended maneuver. +# Hình dạng đường: một đoạn cua rời xa dock (lead-in), một điểm đổi chiều (cusp), +# rồi một đoạn THẲNG cuối trùng hướng yaw của goal. Đoạn cuối luôn thẳng để robot +# đã đạt đúng hướng trước khi chui vào dock — đi cong vào gầm trolley rất dễ va. # -# Collision/free-space checking is intentionally not configured here yet: -# DockPlanner currently generates geometry only. Do not add cost_threshold, -# allow_unknown, or check_free_space until the collision checker is implemented. +# Mép nào của robot áp vào dock được SUY RA theo từng lần lập plan, dựa vào phía +# robot đang đứng so với goal. Không khai báo bằng tham số: +# robot ở phía +X của goal -> lead-in đi TIẾN, đoạn cuối đi LÙI +# (mép sau áp dock: càng nâng chui vào pallet) +# robot ở phía -X của goal -> lead-in đi LÙI, đoạn cuối đi TIẾN +# (mép trước áp dock: chấu sạc ở đầu xe) +# Suy được như vậy vì goal đã được offset sẵn từ tầng trên, sao cho base_link +# dừng đúng tại goal khi manơ hoàn tất. +# +# Kiểm tra va chạm / vùng trống CỐ Ý chưa cấu hình ở đây: DockPlanner hiện chỉ +# sinh hình học. Đừng thêm cost_threshold, allow_unknown hay check_free_space +# cho tới khi phần kiểm va chạm được hiện thực. DockPlanner: - # Boost.DLL library containing the exported symbol "DockPlanner". + # Thư viện Boost.DLL chứa symbol export tên "DockPlanner". library_path: libdock_planner kinematics: - # Axle frames used to measure wheel_base from TF, matching StanleyControl. + # Hai frame trục bánh, dùng để ĐO wheel_base từ TF. Phải trùng với cặp frame + # StanleyControl đang dùng, nếu lệch thì bán kính cua tính ra sai. front_axle_frame: "steer_link" rear_axle_frame: "base_link" - # [rad] Maximum equivalent bicycle steering angle while driving the - # approach curve. Measure this on the real robot; this is not a servo tick, - # steering-wheel angle, or the special standstill-pivot angle. + # [rad] Góc lái lớn nhất của mô hình xe đạp tương đương khi chạy đoạn cua. + # PHẢI đo trên robot thật. Đây KHÔNG phải tick servo, KHÔNG phải góc vô lăng, + # cũng KHÔNG phải góc pivot tại chỗ. + # Quyết định bán kính cua nhỏ nhất: R_min = wheel_base / tan(góc này). + # Khai lớn hơn thực tế -> planner sinh cung robot bám không nổi, robot lệch + # path. Khai nhỏ hơn thực tế -> đường vòng rộng, tốn không gian. max_steering_angle: 0.80 maneuver: - # [m] The cusp is placed at least this far from the start, measured away - # from the dock. This guarantees a real lead-in leg before the terminal. + # [m] Cusp được đặt cách điểm xuất phát ít nhất khoảng này, đo theo hướng RỜI + # XA dock. Bảo đảm luôn có một đoạn lead-in thật trước khi đổi chiều, thay vì + # cusp trùng ngay vị trí robot. minimum_forward_distance: 0.25 - # [m] Reject a maneuver whose cusp has to sit farther than this from the - # start to satisfy the turning-radius and dock-clearance constraints. + # [m] Từ chối lập plan nếu cusp phải nằm xa hơn khoảng này so với điểm xuất + # phát để thoả ràng buộc bán kính cua và khoảng hở với dock. + # Tăng lên nếu robot đứng lệch nhiều mà vẫn muốn ra được plan; giảm xuống nếu + # muốn chặn sớm những manơ chiếm quá nhiều không gian. maximum_forward_extension: 3.0 - # [m] Plan a NO-CUSP entry (one arc onto the dock axis, then the straight - # terminal in the same travel direction) when the room left for the arc -- - # the start distance along the approach axis minus the straight terminal - # length -- exceeds this. The arc radius is still checked against the - # Ackermann limit; the single-cusp maneuver is planned whenever either test - # fails, so this only ever removes a direction change, never adds one. - # 0 disables it and always plans a cusp. + # [m] Bật kiểu vào dock KHÔNG CÓ CUSP (một cung hội tụ vào trục goal rồi đi + # thẳng vào, giữ nguyên một chiều chạy) khi khoảng chỗ còn lại cho cung — + # tức khoảng cách dọc trục từ robot tới goal trừ đi độ dài đoạn thẳng cuối — + # vượt ngưỡng này. + # Bán kính cung VẪN được kiểm với giới hạn Ackermann. Trượt bất kỳ phép kiểm + # nào thì quay về đường có cusp, nên tham số này chỉ có thể BỚT một lần đổi + # chiều, không bao giờ thêm. + # Đặt 0 = tắt hẳn, luôn lập đường có cusp. direct_entry_min_curve_room: 0.5 terminal: - # [m] Extra straight-terminal distance beyond the mating robot extent - # (rear_extent when the terminal reverses, front_extent when it drives - # forward) and, for dock_anchor=center, the dock near-face extent. + # [m] Khoảng hở CỘNG THÊM cho đoạn thẳng cuối, ngoài phần thân robot nhô ra ở + # mép áp dock (rear_extent khi đoạn cuối đi lùi, front_extent khi đi tiến) và, + # nếu dock_anchor=center, ngoài nửa thân dock phía tiếp cận. + # Tăng lên nếu thấy robot dừng quá sát dock. reverse_distance_padding: 0.0 - # [m] Requested length of the straight terminal leg. The effective length is - # max(this, mating extent + dock near extent + padding), so 0 keeps the - # clearance-only behaviour. Raising it gives the robot a longer straight run - # to settle its heading before it enters the dock, but it eats into the room - # left for the entry arc, so a large value pushes the plan back to a cusp. + # [m] Độ dài đoạn thẳng cuối MONG MUỐN. Giá trị thực tế là + # max(giá trị này, phần nhô mép áp dock + nửa thân dock + padding), nên đặt 0 + # là chỉ dùng khoảng hở tối thiểu. + # Tăng lên thì robot có quãng thẳng dài hơn để chỉnh hết sai số hướng trước + # khi vào dock, ĐỔI LẠI ăn vào chỗ dành cho cung, nên đặt lớn quá sẽ đẩy plan + # quay về kiểu có cusp. straight_length: 0.0 sampling: - # [m] Maximum target spacing along both the forward arc and reverse line. + # [m] Khoảng cách lớn nhất giữa hai điểm liên tiếp trên đường, áp dụng cho cả + # đoạn cung lẫn đoạn thẳng. Nhỏ hơn = đường mượt hơn nhưng nhiều điểm hơn. path_point_spacing: 0.05 - # footprint_dock and dock_anchor are selected per marker by move_base2 and - # copied into this namespace before the plugin is constructed. + # footprint_dock và dock_anchor KHÔNG khai ở đây. move_base2 chọn theo từng + # marker rồi rót vào namespace này trước khi khởi tạo plugin. # - # dock_anchor: 'center' (default) — goal is the dock footprint center; the - # near-face extent of footprint_dock contributes to cusp clearance. - # 'face' — goal already sits on the approach face; footprint_dock is ignored. + # dock_anchor: 'center' (mặc định) — goal nằm ở tâm dock; nửa thân dock phía + # tiếp cận (lấy từ footprint_dock) được cộng vào khoảng hở cusp. + # 'face' — goal đã nằm sẵn trên mặt tiếp cận; footprint_dock bị bỏ qua. diff --git a/config/runtime/hybrid_local_planner_params.yaml b/config/runtime/hybrid_local_planner_params.yaml index 321000b..117cdf2 100644 --- a/config/runtime/hybrid_local_planner_params.yaml +++ b/config/runtime/hybrid_local_planner_params.yaml @@ -1,55 +1,69 @@ +# HybridLocalPlanner — local planner lai Pure Pursuit + DWA. +# Bám path bằng Pure Pursuit khi đường trống, chuyển sang DWA khi gặp vật cản, +# rồi nhập lại (rejoin) về path cũ. HybridLocalPlanner: # base_local_planner: "hybrid_local_planner/HybridLocalPlanner" # HybridLocalPlanner: library_path: libhybrid_local_planner - # Robot - max_forward_velocity: 1.0 - max_reverse_velocity: 0.25 # [m/s], positive magnitude - avoidance_max_velocity: 0.4 - max_angular_velocity: 0.6 - min_in_place_angular_velocity: 0.3 - acc_lim_x: 0.1 - decel_lim_x: 0.5 - acc_lim_theta: 2.0 - min_turn_radius: 0.0 - robot_radius: 0.1 - footprint_padding: 0.08 - use_footprint: true - # GoalTolerance - xy_goal_tolerance: 0.02 - yaw_goal_tolerance: 0.02 + # ===== Giới hạn động học robot ===== + max_forward_velocity: 1.0 # [m/s] trần vận tốc tiến + max_reverse_velocity: 0.25 # [m/s] trần vận tốc lùi, ghi bằng ĐỘ LỚN DƯƠNG + avoidance_max_velocity: 0.4 # [m/s] trần vận tốc khi đang né vật cản, thấp hơn để an toàn + max_angular_velocity: 0.6 # [rad/s] trần tốc độ quay + min_in_place_angular_velocity: 0.3 # [rad/s] tốc độ quay tối thiểu khi quay tại chỗ, + # đặt quá thấp thì servo không thắng nổi ma sát tĩnh + acc_lim_x: 0.1 # [m/s^2] trần gia tốc khi tăng tốc + decel_lim_x: 0.5 # [m/s^2] trần gia tốc khi giảm tốc (độ lớn dương) + acc_lim_theta: 2.0 # [rad/s^2] trần gia tốc góc + min_turn_radius: 0.0 # [m] bán kính cua nhỏ nhất. 0 = không ràng buộc (vi sai) + robot_radius: 0.1 # [m] bán kính robot, chỉ dùng khi use_footprint = false + footprint_padding: 0.08 # [m] nới footprint thêm để có biên an toàn + use_footprint: true # true = kiểm va chạm theo footprint đa giác, + # false = coi robot là hình tròn robot_radius - # Trajectory - max_global_plan_lookahead_dist: 3.0 - global_plan_viapoint_sep: 0.5 - global_plan_goal_sep: 0.05 - predict_time: 3.0 - sim_period: 0.1 - sim_time_samples: 10 + # ===== Dung sai tới đích ===== + xy_goal_tolerance: 0.02 # [m] sai số vị trí chấp nhận là đã tới goal + yaw_goal_tolerance: 0.02 # [rad] sai số góc chấp nhận là đã tới goal - # Optimization - w_omega: 2.5 - obs_cost_gain: 1.3 - path_cost_gain: 0.5 - to_goal_cost_gain: 0.8 - speed_cost_gain: 0.5 + # ===== Quỹ đạo và cách đọc path toàn cục ===== + max_global_plan_lookahead_dist: 3.0 # [m] chỉ lấy phần path trong tầm này để bám + global_plan_viapoint_sep: 0.5 # [m] khoảng cách giữa các điểm trung gian trích ra từ path + global_plan_goal_sep: 0.05 # [m] khoảng cách lấy mẫu dày hơn ở đoạn gần goal + predict_time: 3.0 # [s] DWA mô phỏng quỹ đạo trước bao lâu + sim_period: 0.1 # [s] bước thời gian khi mô phỏng + sim_time_samples: 10 # số bước mô phỏng trên mỗi quỹ đạo ứng viên - # Obstacles - obs_range: 2.5 + # ===== Trọng số hàm chi phí DWA ===== + # Tăng một trọng số tức là giảm tương đối tất cả những cái còn lại. + w_omega: 2.5 # phạt quay nhiều, giữ robot đi thẳng khi có thể + obs_cost_gain: 1.3 # phạt tiến gần vật cản + path_cost_gain: 0.5 # phạt lệch khỏi path toàn cục + to_goal_cost_gain: 0.8 # thưởng cho quỹ đạo tiến gần goal + speed_cost_gain: 0.5 # thưởng cho quỹ đạo chạy nhanh - #GeneralSetting - segment_transition_threshold: 0.03 # [m], also used as DWA stop distance for intermediate segments - rotation_segment_yaw_threshold: 0.05 # [rad], ignore tiny yaw noise at duplicate positions - direction_change_hysteresis: 0.15 # normalized dot product - use_obstacle_avoidance: true - slow_velocity_th: 0.1 - turn_direction_th: 0.1 - avoidance_clear_hold_time: 0.5 # [s] - rejoin_blend_time: 0.8 # [s] - rejoin_max_velocity: 0.25 # [m/s] - rejoin_heading_tolerance: 0.35 # [rad] - rejoin_path_tolerance: 0.20 # [m] - pp_max_omega_correction: 0.15 # [rad/s] - rejoin_acc_lim_theta: 1.0 # [rad/s^2] - rejoin_lookahead_distance: 0.8 # [m] + # ===== Vật cản ===== + obs_range: 2.5 # [m] bán kính quét vật cản quanh robot + + # ===== Thiết lập chung ===== + segment_transition_threshold: 0.03 # [m] ngưỡng coi là đã tới hết một chặng path; + # cũng là khoảng cách DWA dừng ở chặng trung gian + rotation_segment_yaw_threshold: 0.05 # [rad] bỏ qua nhiễu yaw nhỏ hơn ngưỡng này khi hai + # điểm path trùng vị trí, tránh quay vặt vô nghĩa + direction_change_hysteresis: 0.15 # tích vô hướng chuẩn hoá. Trễ để robot không lật + # tiến/lùi liên tục quanh điểm đổi chiều + use_obstacle_avoidance: true # false = tắt nhánh DWA, chỉ chạy Pure Pursuit + slow_velocity_th: 0.1 # [m/s] dưới ngưỡng này coi như robot đang bò chậm + turn_direction_th: 0.1 # [rad] ngưỡng xác định robot đang rẽ hướng nào + + # ----- Giai đoạn nhập lại path sau khi né vật cản ----- + avoidance_clear_hold_time: 0.5 # [s] phải thấy đường thông liên tục bấy lâu mới thôi né, + # tránh nhấp nháy né/không né + rejoin_blend_time: 0.8 # [s] thời gian pha trộn mượt khi chuyển về bám path + rejoin_max_velocity: 0.25 # [m/s] trần vận tốc trong lúc nhập lại + rejoin_heading_tolerance: 0.35 # [rad] lệch hướng nhỏ hơn ngưỡng này mới cho nhập lại + rejoin_path_tolerance: 0.20 # [m] lệch ngang nhỏ hơn ngưỡng này mới cho nhập lại + pp_max_omega_correction: 0.15 # [rad/s] trần lượng hiệu chỉnh quay của Pure Pursuit + rejoin_acc_lim_theta: 1.0 # [rad/s^2] trần gia tốc góc riêng cho giai đoạn nhập lại + rejoin_lookahead_distance: 0.8 # [m] cự ly nhìn trước khi nhập lại. Lớn = vào mượt nhưng + # cắt cua; nhỏ = bám sát nhưng dễ lắc diff --git a/config/runtime/mppi_local_planner_params.yaml b/config/runtime/mppi_local_planner_params.yaml index bc90f9d..2f165b6 100644 --- a/config/runtime/mppi_local_planner_params.yaml +++ b/config/runtime/mppi_local_planner_params.yaml @@ -7,7 +7,7 @@ LocalPlannerAdapter: MPPILocalPlanner: library_path: libmppi_local_planner - # Robot limits [m/s, rad/s] + # ===== Giới hạn robot [m/s, rad/s] ===== min_velocity: 0.0 # Cao hon reference_velocity mot khoang dem (headroom). Neu de sat ref thi # nua tren cua nhieu sampling bi clamp o max, keo van toc trung binh xuong @@ -19,7 +19,7 @@ MPPILocalPlanner: obstacle_point_radius: 0.08 footprint_padding: 0.05 - # MPPI core + # ===== Lõi MPPI ===== # Horizon = model_dt * time_steps = 3.6 s ~ 1.8 m @0.5 m/s. # Truoc day 1.4 s (0.7 m) qua ngan: robot chi "thay" vat can khi da sat, khong con # cho de vong qua -> hoac ket hoac lang nhang. Do thuc te: 0.7m/1.2m khong toi dich; @@ -38,14 +38,14 @@ MPPILocalPlanner: wz_std: 0.25 reference_velocity: 0.48 - # Path and goal + # ===== Path và goal ===== # Phai lon hon horizon (1.8 m), neu khong terminal goal_weight se keo robot ve # diem cat cua reference path va lam no giam toc moi chu ky. max_global_plan_lookahead_dist: 3.0 xy_goal_tolerance: 0.10 yaw_goal_tolerance: 0.10 - # Costmap and cost weights + # ===== Costmap và trọng số hàm chi phí ===== obstacle_range: 2.5 obstacle_cost_threshold: 150 obstacle_cell_step: 2 @@ -77,7 +77,7 @@ MPPILocalPlanner: stuck_omega_threshold: 0.05 stuck_patience_cycles: 40 - # --- Covariance thich nghi (giai doan 2) --- + # ===== Covariance thích nghi (giai đoạn 2) ===== # Moi chu ky fit lai do rong nhieu cho TUNG buoc thoi gian tu chinh batch. # vx_std/wz_std o tren chi con la gia tri khoi tao va gia tri sau reset. adaptive_covariance: true diff --git a/config/runtime/pnkx_local_planner_params.yaml b/config/runtime/pnkx_local_planner_params.yaml index 1ec345b..128fd04 100644 --- a/config/runtime/pnkx_local_planner_params.yaml +++ b/config/runtime/pnkx_local_planner_params.yaml @@ -5,37 +5,37 @@ min_approach_linear_velocity: 0.05 LocalPlannerAdapter: library_path: liblocal_planner_adapter PNKXLocalPlanner: - # Algorithm + # Thuật toán library_path: libpnkx_local_planner trajectory_generator_name: LimitedAccelGenerator algorithm_nav_name: MKTAlgorithmDiffPredictiveTrajectory algorithm_rotate_name: MKTAlgorithmDiffRotateToGoal - # Goal checking + # Bộ kiểm tra đã tới goal goal_checker_name: GoalChecker PNKXDockingLocalPlanner: - # Algorithm + # Thuật toán library_path: libpnkx_local_planner trajectory_generator_name: LimitedAccelGenerator algorithm_nav_name: MKTAlgorithmDiffPredictiveTrajectory algorithm_rotate_name: MKTAlgorithmDiffRotateToGoal - # Goal checking + # Bộ kiểm tra đã tới goal goal_checker_name: GoalChecker PNKXGoStraightLocalPlanner: - # Algorithm + # Thuật toán library_path: libpnkx_local_planner trajectory_generator_name: LimitedAccelGenerator algorithm_nav_name: MKTAlgorithmDiffGoStraight - # Goal checking + # Bộ kiểm tra đã tới goal goal_checker_name: GoalChecker PNKXRotateLocalPlanner: - # Algorithm + # Thuật toán library_path: libpnkx_local_planner algorithm_rotate_name: MKTAlgorithmDiffRotateToGoal trajectory_generator_name: LimitedAccelGenerator - # Goal checking + # Bộ kiểm tra đã tới goal goal_checker_name: SimpleGoalChecker stateful: true @@ -44,23 +44,23 @@ LimitedAccelGenerator: max_vel_x: 1.2 min_vel_x: -1.2 - max_vel_y: 0.0 # diff drive robot - min_vel_y: 0.0 # diff drive robot + max_vel_y: 0.0 # robot vi sai: không có chuyển động ngang + min_vel_y: 0.0 # robot vi sai: không có chuyển động ngang - max_speed_xy: 2.0 # max_trans_vel: 0.8 # choose slightly less than the base's capability - min_speed_xy: 0.25 # min_trans_vel: 0.1 # this is the min trans velocity when there is negligible rotational velocity + max_speed_xy: 2.0 # [m/s] trần tốc độ tịnh tiến. Đặt thấp hơn khả năng thật của base một chút + min_speed_xy: 0.25 # [m/s] tốc độ tịnh tiến tối thiểu khi gần như không quay - max_vel_theta: 0.4 # max_rot_vel: 1.0 # choose slightly less than the base's capability - min_vel_theta: 0.05 # min_rot_vel: 0.1 default: 0.4 # this is the min angular velocity when there is negligible translational velocity + max_vel_theta: 0.4 # [rad/s] trần tốc độ quay. Đặt thấp hơn khả năng thật của base một chút + min_vel_theta: 0.05 # [rad/s] tốc độ quay tối thiểu khi gần như không tịnh tiến acc_lim_x: 3.0 - acc_lim_y: 0.0 # diff drive robot + acc_lim_y: 0.0 # robot vi sai: không có chuyển động ngang acc_lim_theta: 1.5 decel_lim_x: -3.0 decel_lim_y: -0.0 decel_lim_theta: -2.0 - # Whether to split the path into segments or not + # Có cắt path thành từng chặng hay không split_path: true sim_time: 1.5 vx_samples: 15 @@ -69,7 +69,7 @@ LimitedAccelGenerator: discretize_by_time: true angular_granularity: 0.05 linear_granularity: 0.1 - # sim_period + # sim_period: lấy theo chu kỳ điều khiển include_last_point: true MKTAlgorithmDiffPredictiveTrajectory: @@ -79,7 +79,8 @@ MKTAlgorithmDiffPredictiveTrajectory: index_samples: 60 follow_step_path: true - # Kalman filter tuning (filters v and w commands) + # Chỉnh bộ lọc Kalman (lọc lệnh v và w trước khi gửi xuống base). + # q_* = nhiễu quá trình, r_* = nhiễu đo. Tăng r_* -> lọc mạnh, lệnh mượt nhưng chậm đáp ứng kf_q_v: 0.25 kf_q_w: 0.8 kf_r_v: 0.05 @@ -87,25 +88,26 @@ MKTAlgorithmDiffPredictiveTrajectory: kf_p0: 0.5 kf_filter_angular: false - # Lookahead - use_velocity_scaled_lookahead_dist: true # Whether to use the velocity scaled lookahead distances or constant lookahead_distance. (default: false) - # only when false: - lookahead_dist: 0.5 # The lookahead distance (m) to use to find the lookahead point. (default: 0.6) - # only when true: - min_lookahead_dist: 0.6 # The minimum lookahead distance (m) threshold. (default: 0.3) - max_lookahead_dist: 2.0 # The maximum lookahead distance (m) threshold. (default: 0.9) - lookahead_time: 1.9 # The time (s) to project the velocity by, a.k.a. lookahead gain. (default: 1.5) - min_journey_squared: 0.2 # Minimum squared journey to consider for goal (default: 0.2) - max_journey_squared: 0.5 # Maximum squared journey to consider for goal (default: 0.2) - max_lateral_accel: 0.9 # Max lateral accel for speed reduction on curves (m/s^2) + # ----- Điểm nhìn trước (lookahead) ----- + use_velocity_scaled_lookahead_dist: true # true = cự ly nhìn trước co giãn theo vận tốc; false = dùng cố định lookahead_dist. (mặc định: false) + # chỉ có tác dụng khi cờ trên = false: + lookahead_dist: 0.5 # [m] cự ly nhìn trước cố định để chọn điểm bám. (mặc định: 0.6) + # chỉ có tác dụng khi cờ trên = true: + min_lookahead_dist: 0.6 # [m] cận dưới của cự ly nhìn trước. Nhỏ quá thì robot lắc ở tốc độ thấp. (mặc định: 0.3) + max_lookahead_dist: 2.0 # [m] cận trên của cự ly nhìn trước. Lớn quá thì robot cắt cua. (mặc định: 0.9) + lookahead_time: 1.9 # [s] nhân với vận tốc hiện tại ra cự ly nhìn trước, tức hệ số lookahead. (mặc định: 1.5) + min_journey_squared: 0.2 # [m^2] quãng đường bình phương tối thiểu mới xét tới goal (mặc định: 0.2) + max_journey_squared: 0.5 # [m^2] quãng đường bình phương tối đa còn xét tới goal (mặc định: 0.2) + max_lateral_accel: 0.9 # [m/s^2] trần gia tốc ngang, dùng để tự giảm tốc khi vào cua - # Rotate to heading param - onle one of use_rotate_to_heading and allow_reversing can be set to true - use_rotate_to_heading: true # Whether to enable rotating to rough heading and goal orientation when using holonomic planners. Recommended on for all robot types that can rotate in place. (default: true) - # only when true: - rotate_to_heading_min_angle: 0.03 # The difference in the path orientation and the starting robot orientation (radians) to trigger a rotate in place. (default: 0.785) + # ----- Quay tại chỗ về đúng hướng ----- + # Chỉ được bật MỘT trong hai: use_rotate_to_heading hoặc allow_reversing + use_rotate_to_heading: true # Cho phép quay tại chỗ về hướng path và về hướng goal. Nên bật với mọi robot quay tại chỗ được. (mặc định: true) + # chỉ có tác dụng khi cờ trên = true: + rotate_to_heading_min_angle: 0.03 # [rad] lệch hướng giữa path và robot vượt ngưỡng này thì quay tại chỗ trước khi chạy. (mặc định: 0.785) angular_decel_zone: 0.1 - # stoped + # Ngưỡng coi robot là ĐÃ DỪNG rot_stopped_velocity: 0.03 trans_stopped_velocity: 0.03 @@ -124,25 +126,26 @@ MKTAlgorithmDiffGoStraight: index_samples: 60 follow_step_path: true - # Lookahead - use_velocity_scaled_lookahead_dist: true # Whether to use the velocity scaled lookahead distances or constant lookahead_distance. (default: false) - # only when false: - lookahead_dist: 0.5 # The lookahead distance (m) to use to find the lookahead point. (default: 0.6) - # only when true: - min_lookahead_dist: 0.6 # The minimum lookahead distance (m) threshold. (default: 0.3) - max_lookahead_dist: 2.0 # The maximum lookahead distance (m) threshold. (default: 0.9) - lookahead_time: 2.0 # The time (s) to project the velocity by, a.k.a. lookahead gain. (default: 1.5) - min_journey_squared: 1.0 # Minimum squared journey to consider for goal (default: 0.2) - max_journey_squared: 1.0 # Maximum squared journey to consider for goal (default: 0.2) - max_lateral_accel: 0.9 # Max lateral accel for speed reduction on curves (m/s^2) + # ----- Điểm nhìn trước (lookahead) ----- + use_velocity_scaled_lookahead_dist: true # true = cự ly nhìn trước co giãn theo vận tốc; false = dùng cố định lookahead_dist. (mặc định: false) + # chỉ có tác dụng khi cờ trên = false: + lookahead_dist: 0.5 # [m] cự ly nhìn trước cố định để chọn điểm bám. (mặc định: 0.6) + # chỉ có tác dụng khi cờ trên = true: + min_lookahead_dist: 0.6 # [m] cận dưới của cự ly nhìn trước. Nhỏ quá thì robot lắc ở tốc độ thấp. (mặc định: 0.3) + max_lookahead_dist: 2.0 # [m] cận trên của cự ly nhìn trước. Lớn quá thì robot cắt cua. (mặc định: 0.9) + lookahead_time: 2.0 # [s] nhân với vận tốc hiện tại ra cự ly nhìn trước, tức hệ số lookahead. (mặc định: 1.5) + min_journey_squared: 1.0 # [m^2] quãng đường bình phương tối thiểu mới xét tới goal (mặc định: 0.2) + max_journey_squared: 1.0 # [m^2] quãng đường bình phương tối đa còn xét tới goal (mặc định: 0.2) + max_lateral_accel: 0.9 # [m/s^2] trần gia tốc ngang, dùng để tự giảm tốc khi vào cua - # Rotate to heading param - onle one of use_rotate_to_heading and allow_reversing can be set to true - use_rotate_to_heading: true # Whether to enable rotating to rough heading and goal orientation when using holonomic planners. Recommended on for all robot types that can rotate in place. (default: true) - # only when true: - rotate_to_heading_min_angle: 0.03 # The difference in the path orientation and the starting robot orientation (radians) to trigger a rotate in place. (default: 0.785) + # ----- Quay tại chỗ về đúng hướng ----- + # Chỉ được bật MỘT trong hai: use_rotate_to_heading hoặc allow_reversing + use_rotate_to_heading: true # Cho phép quay tại chỗ về hướng path và về hướng goal. Nên bật với mọi robot quay tại chỗ được. (mặc định: true) + # chỉ có tác dụng khi cờ trên = true: + rotate_to_heading_min_angle: 0.03 # [rad] lệch hướng giữa path và robot vượt ngưỡng này thì quay tại chỗ trước khi chạy. (mặc định: 0.785) angular_decel_zone: 0.1 - # stoped + # Ngưỡng coi robot là ĐÃ DỪNG rot_stopped_velocity: 0.03 trans_stopped_velocity: 0.03 @@ -161,25 +164,26 @@ MKTAlgorithmDiffRotateToGoal: index_samples: 60 follow_step_path: true - # Lookahead - use_velocity_scaled_lookahead_dist: true # Whether to use the velocity scaled lookahead distances or constant lookahead_distance. (default: false) - # only when false: - lookahead_dist: 0.5 # The lookahead distance (m) to use to find the lookahead point. (default: 0.6) - # only when true: - min_lookahead_dist: 0.6 # The minimum lookahead distance (m) threshold. (default: 0.3) - max_lookahead_dist: 2.0 # The maximum lookahead distance (m) threshold. (default: 0.9) - lookahead_time: 1.9 # The time (s) to project the velocity by, a.k.a. lookahead gain. (default: 1.5) - min_journey_squared: 0.2 # Minimum squared journey to consider for goal (default: 0.2) - max_journey_squared: 0.8 # Maximum squared journey to consider for goal (default: 0.2) - max_lateral_accel: 0.9 # Max lateral accel for speed reduction on curves (m/s^2) + # ----- Điểm nhìn trước (lookahead) ----- + use_velocity_scaled_lookahead_dist: true # true = cự ly nhìn trước co giãn theo vận tốc; false = dùng cố định lookahead_dist. (mặc định: false) + # chỉ có tác dụng khi cờ trên = false: + lookahead_dist: 0.5 # [m] cự ly nhìn trước cố định để chọn điểm bám. (mặc định: 0.6) + # chỉ có tác dụng khi cờ trên = true: + min_lookahead_dist: 0.6 # [m] cận dưới của cự ly nhìn trước. Nhỏ quá thì robot lắc ở tốc độ thấp. (mặc định: 0.3) + max_lookahead_dist: 2.0 # [m] cận trên của cự ly nhìn trước. Lớn quá thì robot cắt cua. (mặc định: 0.9) + lookahead_time: 1.9 # [s] nhân với vận tốc hiện tại ra cự ly nhìn trước, tức hệ số lookahead. (mặc định: 1.5) + min_journey_squared: 0.2 # [m^2] quãng đường bình phương tối thiểu mới xét tới goal (mặc định: 0.2) + max_journey_squared: 0.8 # [m^2] quãng đường bình phương tối đa còn xét tới goal (mặc định: 0.2) + max_lateral_accel: 0.9 # [m/s^2] trần gia tốc ngang, dùng để tự giảm tốc khi vào cua - # Rotate to heading param - onle one of use_rotate_to_heading and allow_reversing can be set to true - use_rotate_to_heading: true # Whether to enable rotating to rough heading and goal orientation when using holonomic planners. Recommended on for all robot types that can rotate in place. (default: true) - # only when true: - rotate_to_heading_min_angle: 0.03 # The difference in the path orientation and the starting robot orientation (radians) to trigger a rotate in place. (default: 0.785) + # ----- Quay tại chỗ về đúng hướng ----- + # Chỉ được bật MỘT trong hai: use_rotate_to_heading hoặc allow_reversing + use_rotate_to_heading: true # Cho phép quay tại chỗ về hướng path và về hướng goal. Nên bật với mọi robot quay tại chỗ được. (mặc định: true) + # chỉ có tác dụng khi cờ trên = true: + rotate_to_heading_min_angle: 0.03 # [rad] lệch hướng giữa path và robot vượt ngưỡng này thì quay tại chỗ trước khi chạy. (mặc định: 0.785) angular_decel_zone: 0.1 - # stoped + # Ngưỡng coi robot là ĐÃ DỪNG rot_stopped_velocity: 0.03 trans_stopped_velocity: 0.03 diff --git a/config/runtime/priest_local_planner_params.yaml b/config/runtime/priest_local_planner_params.yaml index d2c579c..de465a6 100644 --- a/config/runtime/priest_local_planner_params.yaml +++ b/config/runtime/priest_local_planner_params.yaml @@ -1,56 +1,62 @@ PriestLocalPlanner: library_path: libpriest_local_planner - # ================= Horizon / optimizer ================= - t_fin: 7.0 # [s] planning horizon - num_steps: 30 # trajectory samples over the horizon - num_batch: 60 # trajectories per CEM iteration - initial_up_sampling: 5 # candidate oversampling factor - ellite_num: 40 # elites ranked by projection residual - num_warm: 20 # warm-started trajectories between cycles - max_proj_iter: 8 # alternating projection iterations - max_cem_iter: 4 # CEM iterations per control cycle - optimizer_threads: 4 # bounded workers; avoid severe overhead from using all CPU cores - solve_time_warn_ms: 30.0 # [ms] leaves margin inside the 30 Hz controller period - lateral_std: 0.8 # [m] std of lateral waypoint perturbations + # ================= Tầm nhìn / bộ tối ưu ================= + t_fin: 7.0 # [s] tầm nhìn dự báo, robot lập kế hoạch trước bao lâu + num_steps: 30 # số điểm mẫu trên mỗi quỹ đạo trong tầm nhìn đó + num_batch: 60 # số quỹ đạo sinh ra mỗi vòng lặp CEM. Tăng = tìm kỹ hơn, tốn CPU hơn + initial_up_sampling: 5 # hệ số sinh dư ứng viên ở vòng đầu trước khi lọc + ellite_num: 40 # số quỹ đạo "tinh hoa" giữ lại, xếp hạng theo sai số chiếu + num_warm: 20 # số quỹ đạo mang từ chu kỳ trước sang để khởi động nóng + max_proj_iter: 8 # số vòng lặp chiếu luân phiên (alternating projection) + max_cem_iter: 4 # số vòng lặp CEM mỗi chu kỳ điều khiển + optimizer_threads: 4 # số thread giới hạn. Đừng lấy hết số core — overhead nuốt hết lợi ích + solve_time_warn_ms: 30.0 # [ms] cảnh báo khi giải lâu hơn ngưỡng này, chừa biên trong chu kỳ 30 Hz + lateral_std: 0.8 # [m] độ lệch chuẩn khi nhiễu loạn waypoint theo phương ngang. + # Lớn = khám phá rộng, dễ tìm đường vòng; nhỏ = bám sát path toàn cục - # ================= Robot limits (differential drive) ================= - max_velocity: 0.5 # [m/s] forward velocity limit - max_angular_velocity: 0.4 # [rad/s] also enforced inside the optimizer as a - # lateral-acceleration clamp |a_n| <= omega_max * v - max_acceleration: 0.5 # [m/s^2] used in the trajectory projection - reference_velocity: 0.4 # [m/s] desired cruise speed along the path - v_eps: 0.05 # [m/s] below this speed the curvature clamp/cost is skipped - v_min_seed: 0.05 # [m/s] initial-velocity seed along yaw when the robot is stopped + # ================= Giới hạn robot (dẫn động vi sai) ================= + max_velocity: 0.5 # [m/s] trần vận tốc tiến + max_angular_velocity: 0.4 # [rad/s] đồng thời được ép bên trong bộ tối ưu dưới dạng + # chặn gia tốc ngang |a_n| <= max_angular_velocity * v + max_acceleration: 0.5 # [m/s^2] dùng trong phép chiếu quỹ đạo + reference_velocity: 0.4 # [m/s] tốc độ hành trình mong muốn dọc path + v_eps: 0.05 # [m/s] chậm hơn ngưỡng này thì bỏ qua phần chặn/phạt độ cong, + # tránh chia cho số gần 0 khi robot gần đứng yên + v_min_seed: 0.05 # [m/s] vận tốc mồi theo hướng yaw khi robot đang đứng yên, + # để bộ tối ưu có điểm xuất phát khác 0 - # Trajectory -> differential (v, omega) conversion with curvature feedforward: - # omega = clamp(omega_traj, +-max_angular_velocity) - heading_gain * heading_error - heading_gain: 1.5 # [1/s] feedback gain on the heading error - heading_error_stop: 1.2 # [rad] above this, rotate in place (v = 0) - min_in_place_yawrate: 0.2 # [rad/s] + # Đổi quỹ đạo -> lệnh vi sai (v, omega), có feedforward theo độ cong: + # omega = clamp(omega_traj, +-max_angular_velocity) - heading_gain * sai_số_hướng + heading_gain: 1.5 # [1/s] hệ số phản hồi trên sai số hướng. + # Tăng = bẻ về path nhanh hơn nhưng dễ dao động + heading_error_stop: 1.2 # [rad] lệch hướng lớn hơn ngưỡng này thì quay tại chỗ (v = 0) + min_in_place_yawrate: 0.2 # [rad/s] tốc độ quay tối thiểu khi quay tại chỗ, tránh quay quá chậm # ================= Goal / plan ================= - xy_goal_tolerance: 0.10 # [m] - yaw_goal_tolerance: 0.10 # [rad] - max_global_plan_lookahead_dist: 3.0 # [m] + xy_goal_tolerance: 0.10 # [m] sai số vị trí chấp nhận là đã tới goal + yaw_goal_tolerance: 0.10 # [rad] sai số góc chấp nhận là đã tới goal + max_global_plan_lookahead_dist: 3.0 # [m] chỉ lấy phần path toàn cục trong tầm này để bám - # ================= Obstacles (from local costmap) ================= - num_obs: 40 # obstacles in the CEM cost - num_obs_proj: 30 # closest obstacles inside the projection - obstacle_range: 2.5 # [m] costmap scan radius around the robot - robot_radius: 0.50 # [m] - obstacle_point_radius: 0.08 # [m] - footprint_padding: 0.05 # [m] - obstacle_cost_threshold: 150 - obstacle_cell_step: 2 - max_obstacle_points: 150 + # ================= Vật cản (lấy từ local costmap) ================= + num_obs: 40 # số vật cản đưa vào hàm chi phí CEM + num_obs_proj: 30 # số vật cản gần nhất đưa vào phép chiếu + obstacle_range: 2.5 # [m] bán kính quét costmap quanh robot + robot_radius: 0.50 # [m] bán kính robot dùng cho phép kiểm va chạm + obstacle_point_radius: 0.08 # [m] bán kính quy ước cho mỗi điểm vật cản + footprint_padding: 0.05 # [m] nới footprint thêm để có biên an toàn + obstacle_cost_threshold: 150 # ô costmap có cost >= ngưỡng này mới coi là vật cản + obstacle_cell_step: 2 # bước nhảy khi quét ô costmap. Lớn = nhanh hơn, bỏ sót nhiều hơn + max_obstacle_points: 150 # trần số điểm vật cản, chặn chi phí tính toán khi môi trường dày - # ================= Cost weights ================= - weight_smoothness: 0.1 - weight_track: 0.2 - weight_obs: 1.2 - weight_clearance: 3.0 # bounded proximity term in (0,1]: 1 at an obstacle - # centre, 0.5 on the collision boundary, 0 out of range - weight_angular: 0.5 # hinge penalty on |omega| > max_angular_velocity - cem_lamda: 0.9 # CEM temperature - cem_alpha: 0.7 # CEM mean/cov blending factor + # ================= Trọng số hàm chi phí ================= + # Chỉnh các trọng số này là chỉnh "tính cách" của planner. Tăng một cái tức là + # giảm tương đối tất cả những cái còn lại. + weight_smoothness: 0.1 # phạt quỹ đạo gãy khúc + weight_track: 0.2 # phạt lệch khỏi path toàn cục + weight_obs: 1.2 # phạt tiến gần vật cản + weight_clearance: 3.0 # phần thưởng giữ khoảng hở, giá trị trong (0,1]: bằng 1 ngay tại + # tâm vật cản, 0.5 tại biên va chạm, 0 khi ngoài tầm + weight_angular: 0.5 # phạt kiểu bản lề khi |omega| vượt max_angular_velocity + cem_lamda: 0.9 # nhiệt độ CEM. Thấp = chỉ tin nhóm tinh hoa, hội tụ nhanh nhưng dễ kẹt + cem_alpha: 0.7 # hệ số pha trộn mean/cov giữa hai vòng CEM. Cao = đổi chậm, ổn định hơn