DetourPathRecovery was the one recovery behavior that mattered for the
onCancelRequested() fix in recovery_core (commit 254c7fc): it calls
SBPLDetourPlanner::makePlan() synchronously from update(), which runs on
the control thread — cancel arriving mid-search had nothing to preempt it
with, and the control loop itself would stall for the remainder of
allocated_time.
- Moves the search to a per-attempt worker thread (startWorker/workerBody/
planInto/finishAttempt/waitWorker/joinWorker/requestWorkerStop); update()
only polls.
- onCancelRequested() (new override): preempts via
robot_nav_core::Preemptable if the inner planner supports it (see
Test/sbpl_lattice_planner), then waits up to cancel_join_timeout (0.2 s)
and joins — cancel now actually blocks until the worker is gone, not
just until a flag is set.
- onStart() joins a stale worker from a previous attempt before starting a
new one; destructor joins too.
- async_planning param (default true) so tests can force the old
synchronous path when they need deterministic single-thread timing.
- Uses RECOVERY_CORE_EXPORT_BEHAVIOR for the ABI version symbol.
- test/plugins/test_line_planner.cpp: added plan_delay (simulate a slow
search) and made it Preemptable, exported as TestSlowPlanner, to drive
the new worker-thread cancel tests.
Depends on recovery_core commit 254c7fc (onCancelRequested hook + ABI
macro) and Test/sbpl_lattice_planner commit 7456e99 (Preemptable pattern
this follows).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Behavior cũ quét plan tìm một ĐIỂM NỐI rồi vá đoạn vòng vào tuyến cũ. Bốn điều
kiện xếp chồng làm nó sinh đường khép kín (audit trên /tmp/crowd2.log mission
cuối): điểm nối bị ràng buộc phải nằm trên tuyến cũ, mprim cũ định giá xoay tại
chỗ đắt gấp 5 lần cung nên SBPL luôn vẽ vòng, và mỗi lượt vá lại ăn mòn tuyến
(rejoin 106/305 -> 130/289 -> 132/273) nên robot không bao giờ về tuyến.
Giờ nó làm đúng việc của global planner nhưng chạy trong recovery: makePlan từ
pose hiện tại tới plan_.back() trên lưới đã chọn, trả NGUYÊN đường vừa lập.
Đo trên sim: nhanh hơn 5 lần và thẳng (arc/chord 1.01-1.04, winding +9 độ,
self_cross 0) so với bản vá đoạn (1.05-1.98).
Gỡ theo: buildCandidates / classifyPose / classifyOn / classifyMergedPoint /
inLocalView / ScanStats / candidates_, và bốn khoá config chỉ phục vụ việc chọn
điểm nối (planning_distance, sample_step, rejoin_clearance,
max_rejoin_distance). Số lượt vẫn chặn bằng attempts_per_run.
Test: bỏ 9 ca về ứng viên điểm nối, viết lại 2, sửa 2, thêm 2 — 17/17 xanh.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013rayqed51UoUzE7QDRmM9K
find_package(catkin REQUIRED ...) sat at top level, so a build without catkin
died at configure time - and it died pointing at a package that IS present:
Could not find a package configuration file provided by "recovery_core"
recovery_core is in the tree and was added before this package. What is absent
is recovery_coreConfig.cmake, which only a catkin workspace produces. The error
sends you looking for a missing package instead of a missing build mode.
Standalone names the CMake targets directly rather than searching for them. The
root CMakeLists adds every package before this one, so their include
directories arrive through each target's PUBLIC interface - the order in that
file is the real constraint, not anything expressed here.
The plugin also goes to the top of the build tree in standalone mode. It is
loaded by boost::dll under a filename that PluginLoaderHelper resolves against
the build directory; left in its own subdirectory, it builds and is then
invisible at runtime.
Separately: catkin_add_gtest marks the test EXCLUDE_FROM_ALL, so catkin_make
never built it and ctest then failed with
/bin/sh: 1: .../devel/lib/sbpl_recovery/detour_path_recovery_test: not found
which reads as a broken test rather than a missing binary. Every other package
in this repository opens the target back up; this one did not. It does now, and
the 24 tests pass.