This commit is contained in:
2026-08-06 15:17:59 +07:00
parent 701d25f952
commit 5375a9da9e
33 changed files with 3199 additions and 137 deletions

View File

@@ -436,6 +436,34 @@ void NavigationServer::initialize(robot::TFListenerPtr tf)
// vòng ngược lên xoá hàng đợi của nó.
runtime_->mission().setCancelCallback([this]() { requestLoopCancel(); });
// Behavior recovery họ path (DetourPathRecovery) cần plan hiện hành để chọn điểm nối lại tuyến.
// Callback chạy trên CONTROL THREAD — recovery chỉ được start/tick từ đó — cùng thread với
// latestPlan(), nên không cần lock.
runtime_->recoveryRunner().setPlanSource(
[this](std::vector<robot_geometry_msgs::PoseStamped>& out) {
const std::vector<robot_geometry_msgs::PoseStamped>& plan = loop_.latestPlan();
if (plan.empty())
{
return false;
}
out = plan;
return true;
});
// Tuyến THAM CHIẾU: plan gần nhất do PLANNER sinh, recovery không thay được. Detour nối lại vào
// nó nên robot tự quay về tuyến order thay vì trôi dần theo từng đường vòng chồng lên nhau, và
// hành lang `max_deviation` được đo với đúng tuyến mà fleet đã duyệt (contract 2026-08-05e).
runtime_->recoveryRunner().setReferencePlanSource(
[this](std::vector<robot_geometry_msgs::PoseStamped>& out) {
const std::vector<robot_geometry_msgs::PoseStamped>& plan = loop_.orderPlan();
if (plan.empty())
{
return false;
}
out = plan;
return true;
});
// start() sau cùng: cho thread cập nhật costmap chạy khi mọi thứ khác đã lắp xong.
runtime_->start();