fix(env_monitor): stand-down của kContact không bao giờ được vũ trang — đọc trigger ở cycle tick

ControlLoop truyền `output.recovery_trigger == kCollision` vào onRecoveryFinished ở cycle tick, mà
StateMachineOutput::recovery_trigger chỉ được điền ở cycle khởi động recovery (và khi trừ ngân sách);
cycle tick là mặc định kPlanningFailed nên from_contact luôn false. Run 6/9 16:30 (đám đông): người
đứng 7 cm trước mũi → 4 cờ collision cùng chỗ → route cạn → ABORT, JSONL contact_standdown = 0.

- ControlLoop::running_recovery_trigger_ ghi ở start_recovery, dùng ở tick kết thúc.
- FakeRecoveryPort::setSucceedWithPath; test walking skeleton
  DetourFromContactThatDidNotMoveTheRobotArmsTheStandDown (cờ → detour có path → chạm lại tại chỗ
  → không RECOVERING thứ hai trong 1,5 s, lệnh về controller).

Test: walking_skeleton 58/58, env_monitor 47/47, các bộ khác pass. Sim 18:07 và 20:26 không hồi quy
(chưa có ca cờ collision thứ hai để kiểm sống).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xXjFjr2DQ6rhmhHSW4fk4
This commit is contained in:
2026-09-06 20:36:40 +07:00
parent 67cc877de8
commit efd090a506
4 changed files with 61 additions and 1 deletions

View File

@@ -606,6 +606,11 @@ public:
break;
case RecoveryScript::kSucceeded:
tick.status = RecoveryTick::Status::kSucceeded;
if (succeed_with_path_)
{
tick.has_path = true;
tick.path = success_path_;
}
active_ = false;
break;
case RecoveryScript::kFailed:
@@ -616,6 +621,13 @@ public:
return tick;
}
/// @brief Thành công thì kèm một detour path (như 'detour_path' thật) — cần cho stand-down của kContact.
void setSucceedWithPath(std::vector<robot_geometry_msgs::PoseStamped> path)
{
succeed_with_path_ = true;
success_path_ = std::move(path);
}
void cancel() override
{
++cancel_count_;
@@ -699,6 +711,8 @@ private:
std::size_t index_ = 0;
bool start_succeeds_ = true;
bool succeed_with_path_ = false;
std::vector<robot_geometry_msgs::PoseStamped> success_path_;
bool active_ = false;
bool emits_velocity_ = false;
double recovery_speed_ = -0.1; ///< [m/s], âm = lùi