feat: implement ActionHandler pause/resume + ABI export macro

Follows action_core commit 669c3f7 (ActionHandler pause/resume contract +
ACTION_CORE_EXPORT_HANDLER for the ABI version guard). This handler now
honours pause/resume instead of running through it silently.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-12 22:07:05 +07:00
parent 302dd113f3
commit cc1ea74445

View File

@@ -17,7 +17,7 @@
#include <string>
#include <vector>
#include <boost/dll/alias.hpp>
#include <action_core/action_abi.h>
#include <yaml-cpp/yaml.h>
#include <robot/robot.h>
@@ -183,6 +183,7 @@ public:
bool start(const robot_protocol_msgs::Action& action, const robot::Time& now) override
{
started_at_ = now;
paused_ = false;
action_id_ = action.actionId;
scan_cursor_ = 0;
pending_valid_ = false;
@@ -282,6 +283,27 @@ public:
return tick;
}
/**
* @brief Tạm dừng: ghi mốc để resume() dịch started_at_ — quãng đứng không tính vào timeout.
*/
void pause(const robot::Time& now) override
{
if (!paused_)
{
paused_ = true;
paused_at_ = now;
}
}
void resume(const robot::Time& now) override
{
if (paused_)
{
started_at_ += (now - paused_at_);
paused_ = false;
}
}
void cancel() override
{
filter_.reset();
@@ -682,6 +704,8 @@ private:
PoseSampleFilter filter_;
robot::Time started_at_;
robot::Time paused_at_; ///< Mốc pause() gần nhất; chỉ có nghĩa khi paused_.
bool paused_ = false;
std::string action_id_;
std::string profile_name_;
@@ -707,4 +731,4 @@ private:
} // namespace action_core
BOOST_DLL_ALIAS(action_core::DockPatternActionHandler::create, DockPatternActionHandler)
ACTION_CORE_EXPORT_HANDLER(action_core::DockPatternActionHandler::create, DockPatternActionHandler)