feat(control_loop): reserve backup_global_planner for the position profile
A failed primary global planner on a docking, go_straight or rotate request no longer swaps to backup_global_planner. It goes straight to the planning_failed recovery route and aborts. Only the position profile may use the backup planner. Update STATE_MACHINE.md and add test NonPositionPlannerFailureSkipsBackup.
This commit is contained in:
@@ -655,10 +655,27 @@ void ControlLoop::collectPlannerResult()
|
||||
// Fallback thuộc policy của control loop, không phải recovery: planner chính đã kết thúc nên
|
||||
// worker rảnh để nạp/chạy SBPL ngay cycle này. Chỉ thử một lần cho cả request; backup fail thì
|
||||
// giữ kFailed để state machine đi đúng đường recovery hiện có.
|
||||
//
|
||||
// Backup CHỈ dành cho profile position: goal trần không có edge làm CustomPlanner fail, và SBPL
|
||||
// là đường lùi hợp lệ cho một chặng đi tới pose. Docking/go_straight/rotate thì SBPL không giữ
|
||||
// được hình học của chặng — đo 26/10 trên robot KIT: DockPlanner fail vì robot đứng quá gần
|
||||
// dock, SBPL dựng đường thẳng tới pose tiếp xúc, robot bám đường đó vào dock không qua cusp và
|
||||
// đoạn lùi thẳng. Ba profile đó fail thì đi thẳng route planning_failed như khi không có backup.
|
||||
if (!backup_global_planner_active_ && !config_.backup_global_planner_name.empty())
|
||||
{
|
||||
const std::string failed_planner = deps_.planner->activePlanner();
|
||||
if (deps_.planner->swapPlanner(config_.backup_global_planner_name))
|
||||
if (active_request_.profile != MotionProfile::kPosition)
|
||||
{
|
||||
// Không gắn [debug], không tắt được: đây là bằng chứng duy nhất trong log rằng lỗi planner
|
||||
// của chặng này cố ý không được cứu bằng backup.
|
||||
robot::log_warning("[move_base2] global planner '%s' failed for mission %llu (profile %s); "
|
||||
"backup '%s' is reserved for profile position; starting recovery.\n",
|
||||
failed_planner.c_str(),
|
||||
static_cast<unsigned long long>(active_request_.mission_sequence_id),
|
||||
toString(active_request_.profile),
|
||||
config_.backup_global_planner_name.c_str());
|
||||
}
|
||||
else if (deps_.planner->swapPlanner(config_.backup_global_planner_name))
|
||||
{
|
||||
backup_global_planner_active_ = true;
|
||||
planner_feedback_ = PlannerFeedback::kIdle;
|
||||
@@ -669,11 +686,13 @@ void ControlLoop::collectPlannerResult()
|
||||
config_.backup_global_planner_name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
// Không có backup chạy được thì failure gốc vẫn phải đi recovery, không được để robot chờ.
|
||||
robot::log_error("[move_base2] global planner '%s' failed and backup '%s' could not be "
|
||||
"loaded; starting recovery.\n",
|
||||
failed_planner.c_str(), config_.backup_global_planner_name.c_str());
|
||||
else
|
||||
{
|
||||
// Không có backup chạy được thì failure gốc vẫn phải đi recovery, không được để robot chờ.
|
||||
robot::log_error("[move_base2] global planner '%s' failed and backup '%s' could not be "
|
||||
"loaded; starting recovery.\n",
|
||||
failed_planner.c_str(), config_.backup_global_planner_name.c_str());
|
||||
}
|
||||
}
|
||||
planner_feedback_ = PlannerFeedback::kFailed;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user