fix(state_machine): keep travel toward recovery_reset_min_travel across origin resets

The travel mark was reset to 0 whenever the oscillation origin was reset by a
recovery without a new path or by resume, so distance driven before a clear
recovery was lost and the next detour was denied a budget refill (robot 19/11:
0.245 m driven before clear). The mark now moves to the new origin, so travel
before and after the reset adds up. Tests cover the split-travel cases.
This commit is contained in:
2026-11-20 16:30:39 +07:00
parent 0788bc666e
commit 168af1ceec
3 changed files with 127 additions and 14 deletions

View File

@@ -569,12 +569,12 @@ private:
std::array<bool, 6> monitor_trigger_suppressed_{{ false, false, false, false, false, false }};
/**
* Mốc của `recovery_reset_min_travel`. Ghi tại lần recovery thành công + path mới gần nhất; xoá
* khi origin đo quãng đường được đặt lại (yêu cầu mới, hoặc đi quá oscillation_distance) vì lúc
* đó `travelled_since_oscillation_reset` về 0 và hiệu số với mốc cũ sẽ âm.
* Mốc của `recovery_reset_min_travel`, ghi khi recovery có path mới được nạp lại ngân sách. Xoá
* khi nhận yêu cầu mới hoặc đi đủ `oscillation_distance`; khi reset origin do recovery hoặc
* resume thì chuyển mốc sang origin mới để giữ quãng đã đi. Mốc có thể âm sau khi chuyển.
*/
bool has_path_reset_mark_ = false;
double travel_at_last_path_reset_ = 0.0; ///< [m] travelled_since_oscillation_reset tại mốc đó.
double travel_at_last_path_reset_ = 0.0; ///< [m] mốc theo origin hiện tại, có thể âm.
int planning_retries_ = 0;
/// D8 — hình dạng của yêu cầu hiện tại, chốt tại cycle nhận yêu cầu từ StateMachineInput.