feat: bring the move_base2 cancel/pause/resume lifecycle fix onto new-1.0

Bumps 7 submodule pointers to the same fix already on T800_ws (branch
dev_recovery_and_manager_mission there, this repo is on new-1.0 — the two
branches share no common history, so this is a submodule pull + a manual
reapply of two new headers, not a merge or cherry-pick):

  sbpl                 ca1ba36 -> bd89924  (SBPLPlanner abort flag)
  sbpl_lattice_planner 9c1667e -> 7456e99  (Preemptable + shared search budget)
  recovery_core        c03d16f -> 254c7fc  (onCancelRequested + ABI guard)
  sbpl_recovery        8f9326b -> ea79686  (detour search on a worker thread)
  action_core          a6bc3df -> 669c3f7  (pause/resume + kCancelled + ABI guard)
  dock_pattern_action  302dd11 -> cc1ea74  (pause/resume)
  move_base2           7d00c5a -> 8bc4895  (the lifecycle contract itself)

pnkx_nav_core's own two new in-tree headers (robot_nav_core::Preemptable,
move_base_core::component_status_probe.h) are added here by hand, same
content as T800_ws commit 2b0993b — required for sbpl_lattice_planner and
move_base2 (now pulled above) to even compile; not a cherry-pick since
new-1.0 and dev_recovery_and_manager_mission have no common ancestor.

config/runtime/move_base_common_params.yaml: added the new keys only, every
existing value (planner_patience 2.0, max_planning_retries 0, twist
semantics, recovery_behavior_enabled false, ...) is untouched.
settle_timeout: 2.0 and the two stopped_measured_*_eps keys are on, same as
the dev tree — this is the correctness fix itself (cancel/pause now wait
for real quiescence instead of reporting done while a component is still
unwinding), and it changes report timing only, not any commanded velocity.
The watchdog block is added but left OFF (watchdog_period: 0.0, dev tree
has 0.1) — allocated_time: 10.0 in this tree's own sbpl_global_params.yaml
means a legitimate long search could trip a naive planner_timeout as a
false "hung"; leaving a brand-new diagnostic capability off until it's
calibrated against real search/recovery/action timing on this robot matches
the policy for new features in this config tree.

Not brought over (flagged for a separate decision, see chat):
nav_c_api_2.h/.cpp changes from T800_ws commit 2b0993b — this repo has no
config/move_base_common_params.yaml at the top level (only config/runtime/),
so it may not run the standalone c_api tree at all; and the two branches'
disjoint history makes a blind reapply of an EXISTING file's diff riskier
than the two brand-new headers above. Needs a decision, not a mechanical
pull.

Not pushed to origin/new-1.0 — local commit only, pending confirmation.
This commit is contained in:
2026-09-12 22:20:57 +07:00
parent 418686ff29
commit 9095e58dec
10 changed files with 165 additions and 7 deletions

View File

@@ -0,0 +1,51 @@
/*********************************************************************
*
* Software License Agreement (BSD License)
*
* move_base_core — optional capability: per-component liveness of a navigation runtime.
*
* Author: DuongTD
*********************************************************************/
#ifndef MOVE_BASE_CORE_COMPONENT_STATUS_PROBE_H
#define MOVE_BASE_CORE_COMPONENT_STATUS_PROBE_H
#include <cstddef>
namespace robot
{
namespace move_base_core
{
class BaseNavigation;
/**
* One row of the runtime's component status board, flattened for a C/.NET host.
*
* Deliberately NOT a virtual on BaseNavigation: that would change the vtable every host binary was
* built against. Instead the navigation plugin .so exports a free function under the Boost.DLL
* alias @ref kComponentStatusProbeAlias and a host that wants it dlsym()s it (nav_c_api_2:
* navigation_get_component_status). Runtimes without the alias simply do not offer it.
*
* `phase` values: 0 idle, 1 busy, 2 stopping, 3 paused, 4 hung (mirrors move_base2::ComponentPhase).
* `hung` is the watchdog's verdict — busy for longer than the component's budget without progress.
*/
struct ComponentStatusEntry
{
char name[32];
unsigned char phase;
unsigned char hung;
double seconds_in_phase;
double seconds_since_progress;
};
/// Fills up to @p max entries for @p navigation; returns how many rows the runtime has (may exceed max).
using ComponentStatusProbeFn = std::size_t (*)(BaseNavigation* navigation, ComponentStatusEntry* out,
std::size_t max);
/// Boost.DLL alias name the navigation plugin exports the probe under (added 2026-09-11).
constexpr const char* kComponentStatusProbeAlias = "MoveBaseComponentStatus";
} // namespace move_base_core
} // namespace robot
#endif // MOVE_BASE_CORE_COMPONENT_STATUS_PROBE_H

View File

@@ -0,0 +1,44 @@
/*********************************************************************
*
* Software License Agreement (BSD License)
*
* robot_nav_core — optional mixin for plugins whose work can be interrupted from another thread.
*
* Author: DuongTD
*********************************************************************/
#ifndef ROBOT_NAV_CORE_PREEMPTABLE_H
#define ROBOT_NAV_CORE_PREEMPTABLE_H
namespace robot_nav_core {
/**
* @class Preemptable
* @brief A plugin that can cut short a long-running call (makePlan, a recovery attempt) when asked.
*
* Deliberately a separate interface instead of a new virtual on BaseGlobalPlanner /
* BaseLocalPlanner: adding a slot to those vtables would force every already-built plugin .so to be
* rebuilt in lock-step, and a stale one would crash on load. A plugin opts in by inheriting this
* class as well; the runtime discovers support with `dynamic_cast<Preemptable*>` and falls back to
* "discard the result when it arrives" for plugins that do not.
*
* Contract for implementers:
* - preempt() is called from ANOTHER thread than the one inside the long call. It must be
* lock-free, allocation-free and return immediately — typically one atomic store.
* - The long call must poll the flag often (per expansion / per iteration) and return promptly,
* reporting failure; a partial result must not be handed back as a success.
* - Every new call must start with the flag cleared, so a preempt aimed at the previous call
* cannot kill the next one.
*
* Added 2026-09-11 for the move_base2 cancel/pause path (SBPLLatticePlanner, DetourPathRecovery).
*/
class Preemptable {
public:
virtual ~Preemptable() = default;
/// Request that the call currently running on the plugin's worker returns as soon as possible.
virtual void preempt() = 0;
};
} // namespace robot_nav_core
#endif // ROBOT_NAV_CORE_PREEMPTABLE_H