Files
move_base2/config/runtime/stanley_local_planner_params.yaml
2026-08-09 19:17:02 +07:00

180 lines
12 KiB
YAML

LocalPlannerAdapter:
library_path: liblocal_planner_adapter
yaw_goal_tolerance: 0.017
xy_goal_tolerance: 0.03
min_approach_linear_velocity: 0.06
StanleyLocalPlanner:
library_path: libstanley_local_planner
# ============================================================================
# PROFILE MO PHONG (move_base2 runtime). Khac profile robot that
# (stanley_local_planner/cfg/...) dung 3 diem:
# steer_zero_offset 0.0 | heading_bias_mode "off" | steer_bias_gain 0.0
# (sim khong co zero servo / IMU anchor -> cac bo bu tat het)
# max_plan_tf_jump_rate 1.5 (dynamic TF sim jitter chu dich, 0.6 gay reset oan)
# ============================================================================
# ================= Robot limits =================
max_vel_x: 0.50 # [m/s] forward, > 0
min_vel_x: -0.25 # [m/s] reverse, < 0
wheel_base: 0.0 # [m] 0 = derive from TF front_axle_frame -> rear_axle_frame
front_axle_frame: "steer_link"
rear_axle_frame: "base_link"
# Two SEPARATE steering limits.
# Path tracking must not use a large angle: forward_vel_ scales with cos(delta) so it
# collapses to speed_base, and vel_steer = v/cos(steer) is guarded to 0 as cos -> 0.
# Pivoting in place uses the full 90 deg the hardware has.
steer_limit_standstill: 1.5708 # [rad] TO BE MEASURED - ceiling at |v| ~ 0
steer_limit_at_max_vel: 0.5000 # [rad] TO BE MEASURED - ceiling at |v| = max_vel_x
align_steer_angle: 1.5708 # [rad] steering while pivoting. Literal number, NOT M_PI/2
min_steer_angle: 0.20 # [rad] threshold for "steering is engaged"
max_steer_rate: 1.00 # [rad/s] measured by [DBG-STEER] 07/08: servo peak 1.08-1.35
# Measured zero offset of the steering channel, ADDED to every command.
# 05/08 log: robot driving straight while the encoder read +0.0373 rad (2.1 deg)
# -> the proportional law paid for it with a standing 5-8 cm cross-track error.
# BRIDGE until the servo encoder zero is calibrated; set back to 0.0 after that.
steer_zero_offset: 0.0 # [rad]
# ================= Goal tolerance =================
xy_goal_tolerance: 0.030 # [m] should match LocalPlannerAdapter
yaw_goal_tolerance: 0.020 # [rad]
goal_sq_dist_tol: 0.05 # [m^2] early exit of the closest-point scan
# ================= Control law (Stanley) =================
path_yaw_mode: "tangent" # tangent | bearing - "bearing" is the old behaviour, kept for rollback
control_gain_e: 2.0 # heading gain (path tangent - robot yaw)
control_gain_d: 1.5 # base cross-track gain
gain_cte_weight: 0.8 # added to k per |cross-track error| [1/m]
gain_heading_weight: 0.5 # added to k per |heading error| [1/rad]
gain_min: 0.5 # lower clamp of k
gain_max: 1.8 # upper clamp of k
soft_min_vel: 0.20 # [m/s] FLOOR of the atan2(k*e, v) denominator. NO ceiling
alpha_gain: 0.0 # steering low-pass [0..1]; 0 = off, max_steer_rate is used instead
curve_gain_e_bonus: 2.0 # added to control_gain_e in curve mode
tangent_window_pts: 3 # points averaged for the tangent when the plan carries no yaw
# Curve tracking rework (08/08): cross-track error is measured at the BASE in both
# directions (front-axle variants manufacture an L^2/2R curve phantom - the robot
# cut INSIDE curves forward and drifted OUTSIDE in reverse); the heading reference
# previews a short distance ahead symmetrically; the curve itself is carried by an
# explicit atan(L*kappa) feedforward. Swept optimum in sim (R=1.5/3.0, both
# directions): max error 0.013-0.016 m vs 0.061/0.129 before.
heading_preview: 0.10 # [m] heading (tangent) reference ahead of the base anchor
curve_feedforward_gain: 1.0 # atan(L*kappa) gain; 0 = OFF (rollback), 1.0 = geometric nominal
# ================= Heading bias (yawR - course, measured +0.030 rad 07/08) =========
# The yaw estimate leads the actual course by a constant that RE-ANCHORS differently
# every session (IMU absolute anchor), so it is learned online from course-over-ground
# instead of configured. A steering offset cannot compensate this: the heading
# REFERENCE is wrong, not the actuator.
heading_bias_mode: "off" # off = disabled
# log = estimate only, [DBG-YAWBIAS] prints the calib number
# apply= subtract the learned bias from the yaw being controlled
# (rollback in the field: switch to "log", no rebuild)
heading_bias_tau: 30.0 # [s] EMA time constant
heading_bias_min_vel: 0.45 # [m/s] below this the course is too noisy to learn from
heading_bias_clamp: 0.05 # [rad] ceiling of the APPLIED correction
heading_bias_min_samples: 60 # [cycles] learned samples required before applying
# ================= Steering bias (integrator, cleans up the residue) =============
# With heading_bias_mode: apply the main disturbance is handled above; the
# integrator only sweeps up what is left. Do NOT run both at full strength.
steer_bias_gain: 0.0 # [rad/(m*s)] SIM: 0 = OFF — plant sim khong co zero servo hay
# heading bias, integrator bat len chi tich nhieu.
# ROBOT THAT: 0.10 khi mode != apply, 0.02 khi mode = apply.
steer_bias_clamp: 0.05 # [rad] anti-windup ceiling
steer_bias_decay: 0.9999 # per-cycle bleed when the integrate conditions do not hold
# (robot that dung 0.9999 de bias song qua cac quang dung 30-60 s)
steer_bias_min_vel: 0.30 # [m/s] below this, do not integrate
steer_bias_max_heading_err: 0.10 # [rad] above this, do not integrate
# ================= Plan window / lookahead =================
max_global_plan_lookahead_dist: 3.0 # [m] window ceiling
min_lookahead: 0.50 # [m] window floor
min_lookahead_near_goal: 0.40 # [m] separate floor near the goal
dyn_lookahead_gain: 2.50 # [m/(m/s)] lookahead = min + gain*|v|
near_goal_freeze_dist: 0.50 # [m] below this: freeze yaw_path, run theta_d only
# Index continuity thresholds, given in METRES and converted to indices with the
# point spacing measured at runtime - the plan resolution is the global planner's
# choice, not a constant.
# The old code used fixed indices (back=3, fwd=15 ~ 0.75 m on a 0.05 m/point plan) and
# therefore never fired: at 1.2 m/s the robot covers 0.04 m = 0.8 index per 33 ms cycle.
# Applied to BOTH closest (window anchor) and target_idx_ (inside the core).
max_advance_dist: 0.20 # [m] forward travel allowed along the plan per cycle
max_back_dist: 0.10 # [m] backward travel allowed along the plan per cycle
# ================= Curvature =================
high_curvature: 0.30 # [1/m] above: shrink lookahead
mid_curvature: 0.20 # [1/m] above: cut the transform window
low_curvature: 0.10 # [1/m] above: enter curve mode
straight_confirm_steps: 110 # consecutive straight cycles before leaving curve mode
# ================= Speed profile =================
speed_base: 0.30 # [m/s] base of the cosine steering profile
curve_max_speed: 0.25 # [m/s] ceiling while curving
min_drive_speed: 0.07 # [m/s] floor while driving
accel_distance: 2.00 # [m] ramp length after leaving a curve
decel_min: 0.05 # [m/s per cycle] deceleration on predicted collision
decel_max: 0.10 # [m/s per cycle]
collision_horizon_factor: 2.0 # multiplies max_vel_x to get the collision check distance
# Braking-distance governor: v <= sqrt(2*a*d_to_stop). The horizon profile alone
# starts braking ~v*horizon out (1.5 m at 1.2 m/s, demanding ~1 m/s^2) — the drive
# cannot follow and the robot overshot 30 cm. The old build was saved by an
# accident (the bearing blow-up tripped the steer gate and cut the drive early).
goal_decel_limit: 0.40 # [m/s^2] TO BE MEASURED — must stay BELOW the drive's real brake.
# Braking starts at v^2/(2a): 1.8 m @ 1.2 m/s, 0.3 m @ 0.5 m/s
min_approach_speed: 0.06 # [m/s] approach floor so the sqrt profile still reaches the goal
# ================= Align / phase =================
heading_eps: 0.020 # [rad] heading error accepted as aligned
steer_eps: 0.020 # [rad] steering error accepted as "servo arrived"
heading_align_tol: 0.050 # [rad] gate for the final straight-line approach (was 0.01 = too tight)
near_goal_dist: 1.00 # [m] below this: enable the final straight mode
steer_realign_off: 0.503 # [rad] above this: CUT drive (0.16*pi)
steer_realign_on: 0.150 # [rad] below this: RESUME drive - must be smaller than _off
steering_active: 0.094 # [rad] above this the steering counts as active (0.03*pi)
segment_transition_threshold: 0.010 # [m]
segment_end_ratio: 0.05 # fraction of the segment left before advancing
xy_reached_gate_factor: 3.0 # multiplies xy_goal_tolerance; a 1-point window may only latch inside this
# ================= TF guard =================
# Measured on the robot: 225 map->odom jumps, max 12.381 m, coinciding with the
# localisation FinishTrajectory(1) 10:41:18 / AddTrajectory(2) 10:41:21. The source is
# outside this package; this is containment, not a cure.
tf_lookup_at_pose_stamp: true # true = look up at pose.header.stamp instead of "latest".
# "latest" returns a different entry each call when the
# buffer holds two map->odom transforms
transform_tolerance: 0.20 # [s] accepted age when looking up by timestamp
max_plan_tf_jump_rate: 1.50 # [m/s] threshold as a RATE, multiplied by the real elapsed time.
# SIM: 1.5 — dynamic TF sim jitter 0.02-0.065 m/chu ky; de 0.6
# thi budget ~0.02 m -> reject don 30/30, reset giua duong
# (log 08/08: 8 reset trong 2 luot lui). ROBOT THAT: 0.60.
max_plan_tf_jump_abs: 1.00 # [m] hard cap of the accepted step: the rate budget grows while
# the transform sits still, and without the cap a multi-metre
# step after a long static stretch would be accepted outright
max_plan_tf_yaw_jump: 0.20 # [rad] rotation threshold - the old code checked translation only
tf_reject_window_cycles: 30 # sliding window; exceeding it means a real relocalisation
tf_reject_ratio: 0.5 # reject fraction inside the window that triggers the reset
# ================= Debug =================
debug_tf: false # nhom log TF (accepted-step, authority, chi tiet reject, fallback).
# SIM: dynamic_tf nhieu chu dich -> tat cho log doc duoc.
# ROBOT THAT: bat lai (true) khi san TF that.
# Reset do reject keo dai van LUON duoc log bat ke cong tac nay.
debug_offset: true # [DBG-OFF] 5 Hz bam path + thong ke max/mean |e| moi luot cua
# (in kem dong DBG-CURVE exit) — soi lech trong duong cong.
debug_level: 2 # 0=off 1=on state change 2=throttled 1 Hz 3=every cycle
# 2 is safe as the operating default: this package throttles with
# its own per-purpose clocks (robot_cpp's log_*_throttle shares ONE
# static timer per function for the whole process, so its throttled
# lines silently eat each other - never rely on it).
# 3 produces >1800 lines/min at 30 Hz - field debugging only
StanleyDockingLocalPlanner:
library_path: libstanley_local_planner