- RecoveryBehavior::cancel() now calls a new virtual onCancelRequested() synchronously, from whichever thread calls cancel(). Documents onCancel() as effectively dead in move_base2: it only ran on the next update() tick, and CANCELLING forces tick_recovery=false, so that tick never came. Every existing behavior's onCancel() was unreachable code. Velocity-only behaviors (wait/rotate/back_up/clear_costmap) still stop correctly via the arbiter zeroing cmd_vel; this only matters for a behavior that owns a long-running operation of its own (see Test/sbpl_recovery, separate commit). - recovery_abi.h (new) + RECOVERY_CORE_EXPORT_BEHAVIOR(factory, symbol) macro: exports an extra <symbol>_abi version symbol alongside the existing BOOST_DLL_ALIAS factory. recovery_registry.cpp probes it before calling the factory and refuses to load a .so whose version doesn't match (or is missing) instead of dlsym+reinterpret_cast blindly onto a vtable that just grew a virtual — the ABI hazard boost::dll plugins don't otherwise catch at load time. - All 4 in-tree behaviors switched to the export macro. - test/plugins/stale_abi_recovery.cpp (new): a plugin built against the old ABI, used to verify the registry actually refuses it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
63 lines
1.5 KiB
C++
63 lines
1.5 KiB
C++
/*********************************************************************
|
|
*
|
|
* Software License Agreement (BSD License)
|
|
*
|
|
* recovery_core — plugin GIẢ mô phỏng một behavior build với header cũ: export `_abi` = 1 (và một
|
|
* alias không có `_abi`). Chỉ để test ABI guard của RecoveryRegistry; không cài đặt.
|
|
*
|
|
* Author: DuongTD
|
|
*********************************************************************/
|
|
#include <memory>
|
|
|
|
#include <boost/dll/alias.hpp>
|
|
|
|
#include <recovery_core/recovery_behavior.h>
|
|
|
|
namespace recovery_core
|
|
{
|
|
namespace testing
|
|
{
|
|
|
|
class StaleAbiRecovery final : public RecoveryBehavior
|
|
{
|
|
public:
|
|
static RecoveryBehavior::RecoveryBehaviorPtr create()
|
|
{
|
|
return std::make_shared<StaleAbiRecovery>();
|
|
}
|
|
|
|
RecoveryOutputType outputKind() const override
|
|
{
|
|
return RecoveryOutputType::kNone;
|
|
}
|
|
|
|
protected:
|
|
bool onConfigure(robot::NodeHandle& /*nh*/) override
|
|
{
|
|
return true;
|
|
}
|
|
|
|
bool onStart(const RecoveryGoal& /*goal*/) override
|
|
{
|
|
return true;
|
|
}
|
|
|
|
RecoveryResult onUpdate(const robot::Time& /*now*/, double /*dt*/) override
|
|
{
|
|
return RecoveryResult::Succeeded();
|
|
}
|
|
};
|
|
|
|
/// Phiên bản ABI "cũ" — lệch với kRecoveryAbiVersion của runtime.
|
|
int staleAbiVersion()
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
} // namespace testing
|
|
} // namespace recovery_core
|
|
|
|
BOOST_DLL_ALIAS(recovery_core::testing::StaleAbiRecovery::create, StaleAbiRecovery)
|
|
BOOST_DLL_ALIAS(recovery_core::testing::staleAbiVersion, StaleAbiRecovery_abi)
|
|
BOOST_DLL_ALIAS(recovery_core::testing::StaleAbiRecovery::create, NoAbiRecovery)
|