Report why an action failed instead of a bare "action failed"
FrameSamplerActionHandler already builds a precise reason for each way it can fail: too few samples, detection too scattered, could not publish the output frame, raw frame never appeared. All four reached the log as the same four words, because control_loop read the tick, kept only the status, and dropped the message, while the state machine passed a hard-coded string to finish(). Three field runs in a row could not be diagnosed for that reason: the detector was healthy, the host confirmed pallet_raw was published and resolvable, and the only thing navigation said was "action failed". The handler message now travels through StateMachineInput into the terminal reason, so it reaches the host feedback as well as the log, and control_loop logs it directly - as an error when the action fails, as info when it succeeds, where it carries the sample count worth comparing against the next failure. StateMachineOutput::reason is a const char* and enter() stores the pointer rather than copying, so the composed string lives in a StateMachine member. Building it in a local would return a pointer into destroyed memory - every other reason in that class is a string literal, so nothing had hit this before. Two tests cover it: the message reaches the reason, and the reason survives the StateMachineInput that carried it. Config in this tree follows the same split as the robot: per-marker dock_anchor and footprint_dock in maker_sources.yaml, detect handlers separated into detect_charger and detect_pallet.
This commit is contained in:
@@ -175,5 +175,128 @@ StanleyLocalPlanner:
|
||||
# lines silently eat each other - never rely on it).
|
||||
# 3 produces >1800 lines/min at 30 Hz - field debugging only
|
||||
|
||||
# ==============================================================================
|
||||
# PROFILE DOCKING (docking_planner_name / docking.local_planner tro vao day).
|
||||
# CUNG code voi StanleyLocalPlanner (mot factory, hai BOOST_DLL_ALIAS) — chi khac
|
||||
# config. YAML namespace KHONG ke thua: block nay phai lap lai DU moi key, thieu
|
||||
# key nao la key do roi ve default trong struct C++, KHONG roi ve block tren.
|
||||
# Giai thich chi tiet tung tham so: xem block StanleyLocalPlanner o tren.
|
||||
# Khac biet docking (danh dau # DOCKING:):
|
||||
# - toc do thap (leg dock ~1.7 m, do chinh xac quan trong hon thoi gian)
|
||||
# - tolerance chat (xy 0.015 / yaw 0.010 thay vi 0.030 / 0.020)
|
||||
# ==============================================================================
|
||||
StanleyDockingLocalPlanner:
|
||||
library_path: libstanley_local_planner
|
||||
|
||||
# ================= Robot limits =================
|
||||
max_vel_x: 0.30 # [m/s] DOCKING: tran thap — leg dock ngan, uu tien chinh xac
|
||||
min_vel_x: -0.20 # [m/s] DOCKING: lui cham khi vao pallet
|
||||
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"
|
||||
|
||||
steer_limit_standstill: 1.5708 # [rad]
|
||||
steer_limit_at_max_vel: 0.5000 # [rad]
|
||||
align_steer_angle: 1.5708 # [rad]
|
||||
min_steer_angle: 0.20 # [rad]
|
||||
max_steer_rate: 1.00 # [rad/s]
|
||||
|
||||
steer_zero_offset: 0.0 # [rad] SIM: khong co zero servo
|
||||
|
||||
# ================= Goal tolerance =================
|
||||
xy_goal_tolerance: 0.015 # [m] DOCKING: 0.030 -> 0.015 (log 13/08: dung sat mep 0.024)
|
||||
yaw_goal_tolerance: 0.010 # [rad] DOCKING: 0.020 -> 0.010 (yaw 0.02 x 1.2 m pallet = 2.4 cm mui cang)
|
||||
goal_sq_dist_tol: 0.05 # [m^2]
|
||||
|
||||
# ================= Control law (Stanley) =================
|
||||
path_yaw_mode: "tangent"
|
||||
control_gain_e: 2.0
|
||||
control_gain_d: 1.5
|
||||
gain_cte_weight: 0.8
|
||||
gain_heading_weight: 0.5
|
||||
gain_min: 0.5
|
||||
gain_max: 1.8
|
||||
soft_min_vel: 0.20 # [m/s]
|
||||
alpha_gain: 0.0
|
||||
near_goal_heading_gain: 4.0 # DOCKING 13/08: het pivot cuoi — dong not ~0.03 rad heading tren 0.2 m thang chot (yaw-rate ~ v*tan(delta)/L sup o toc bo; gain thuong chi dong 0.005-0.015 rad). Chi an ngoai curve mode. Robot lac duoi cuoi thi giam 3.0.
|
||||
curve_gain_e_bonus: 0.0 # DOCKING 13/08: 4x heading gain nhan reference lead 0.23 rad dau chang thanh slam full-lock -90, robot xoay tai cho ~2 s truoc khi lan banh. ff da ganh cua; bo bonus de vao cua bang ff + gain 2.0. Neu giua cua e tang lai thi thu 1.0.
|
||||
tangent_window_pts: 1 # DOCKING 13/08: cua so 3 diem o SAT DAU path lech het ve phia truoc (chord 0..5 = 0.25 m cong) -> reference lead 0.23 thay vi 0.125 rad. Path dock la duong giai tich, 1 chord/5cm du sach. Path rang cua thi tra ve 3.
|
||||
heading_preview: 0.10 # [m] GIU 0.10. Trial 0.20 (13/08 run C) FAIL: ff doc kappa truoc 0.2 m nen tat som giua cua -> understeer, e max 0.071, th_e o dich 0.097. Combo tot nhat da do: align_to_path_start true + preview 0.10 (run B: max 0.031-0.033, mean 0.012-0.015).
|
||||
curve_feedforward_gain: 1.0
|
||||
|
||||
# ================= Heading bias =================
|
||||
# DOCKING: OFF co chu dich — leg dock lui + cong + ngan, estimator khong du mau
|
||||
# de hoc (instance nay KHONG thua huong bias instance position da hoc).
|
||||
heading_bias_mode: "off"
|
||||
heading_bias_tau: 30.0 # [s]
|
||||
heading_bias_min_vel: 0.45 # [m/s]
|
||||
heading_bias_clamp: 0.05 # [rad]
|
||||
heading_bias_min_samples: 60 # [cycles]
|
||||
|
||||
# ================= Steering bias =================
|
||||
steer_bias_gain: 0.0 # DOCKING + SIM: OFF (leg qua ngan de tich phan co nghia)
|
||||
steer_bias_clamp: 0.05 # [rad]
|
||||
steer_bias_decay: 0.9999
|
||||
steer_bias_min_vel: 0.30 # [m/s]
|
||||
steer_bias_max_heading_err: 0.10 # [rad]
|
||||
|
||||
# ================= Plan window / lookahead =================
|
||||
max_global_plan_lookahead_dist: 3.0 # [m]
|
||||
min_lookahead: 0.50 # [m]
|
||||
min_lookahead_near_goal: 0.40 # [m]
|
||||
dyn_lookahead_gain: 2.50 # [m/(m/s)]
|
||||
near_goal_freeze_dist: 0.50 # [m]
|
||||
max_advance_dist: 0.20 # [m]
|
||||
max_back_dist: 0.10 # [m]
|
||||
|
||||
# ================= Curvature =================
|
||||
high_curvature: 0.30 # [1/m]
|
||||
mid_curvature: 0.20 # [1/m]
|
||||
low_curvature: 0.10 # [1/m]
|
||||
straight_confirm_steps: 110
|
||||
|
||||
# ================= Speed profile =================
|
||||
speed_base: 0.20 # [m/s] DOCKING: 0.30 -> 0.20
|
||||
curve_max_speed: 0.20 # [m/s] DOCKING: cua dock R~1 m, di cham
|
||||
min_drive_speed: 0.07 # [m/s]
|
||||
accel_distance: 2.00 # [m]
|
||||
decel_min: 0.05 # [m/s per cycle]
|
||||
decel_max: 0.10 # [m/s per cycle]
|
||||
collision_horizon_factor: 2.0
|
||||
goal_decel_limit: 0.40 # [m/s^2]
|
||||
min_approach_speed: 0.05 # [m/s] DOCKING: 0.06 -> 0.05, bo cham vao tolerance chat hon
|
||||
|
||||
# ================= Align / phase =================
|
||||
align_to_path_start: true # DOCKING: pivot ve dung heading POSE DAU path. Da thu false 13/08 (run C, kem preview 0.20): khong bam — giu true.
|
||||
# khong phai heading reference cua control law (nearest + preview
|
||||
# 0.10 m, trung binh 3 diem) — tren cua K~1.4 reference do di truoc
|
||||
# diem dau path ~0.14 rad
|
||||
align_pivot_toward_curve: true # DOCKING 13/08: pivot do banh ve PHIA cua sap toi (ff pose 0 < -0.30 rad -> -90). Truoc do do +90 roi phai quet 2.6-3.1 rad tai cho ~2.4 s truoc khi lan banh. ROBOT THAT: kiem tra drive nhan lenh -90 truoc khi bat.
|
||||
heading_eps: 0.010 # [rad] DOCKING: 0.020 -> 0.010. Path dock vao cua K~1.4 ngay
|
||||
# pose 0; align dung o 0.0185 rad la mang san 1 do lech vao cua
|
||||
# (sim 13/08: e vot 0.034 m ngay sau align)
|
||||
steer_eps: 0.020 # [rad]
|
||||
heading_align_tol: 0.050 # [rad]
|
||||
near_goal_dist: 1.00 # [m]
|
||||
steer_realign_off: 0.503 # [rad]
|
||||
steer_realign_on: 0.080 # [rad] DOCKING: 0.150 -> 0.080. Steer quet 2.6 rad tu pivot sang
|
||||
# goc cua mat ~2.2 s; tha drive khi con lech 0.111 rad la chay
|
||||
# voi banh lai chua toi noi — cho settle gan hon roi moi tha
|
||||
steering_active: 0.094 # [rad]
|
||||
segment_transition_threshold: 0.010 # [m]
|
||||
segment_end_ratio: 0.05
|
||||
xy_reached_gate_factor: 3.0
|
||||
|
||||
# ================= TF guard =================
|
||||
tf_lookup_at_pose_stamp: true
|
||||
transform_tolerance: 0.20 # [s]
|
||||
max_plan_tf_jump_rate: 1.50 # [m/s] SIM (robot that: 0.60)
|
||||
max_plan_tf_jump_abs: 1.00 # [m]
|
||||
max_plan_tf_yaw_jump: 0.20 # [rad]
|
||||
tf_reject_window_cycles: 30
|
||||
tf_reject_ratio: 0.5
|
||||
|
||||
# ================= Debug =================
|
||||
debug_tf: false
|
||||
debug_offset: true
|
||||
debug_level: 2
|
||||
|
||||
Reference in New Issue
Block a user