temporary storage 7/9/2026 20:41
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
* recovery_core — interface (base class) cho recovery behaviors.
|
||||
*
|
||||
* Vòng đời hợp nhất, hướng-goal cho cả 3 họ recovery (path / none / velocity):
|
||||
* configure(name, ctx) -> start(goal) -> lặp update(dt) -> [cancel()]
|
||||
* Base lo phần chung (guard init/dt/timeout/cancel, đo elapsed, đẩy feedback); plugin chỉ
|
||||
* configure(name, ctx) -> start(goal) -> lặp update() -> [cancel()]
|
||||
* Base lo phần chung (guard init/cancel, đẩy feedback); plugin chỉ
|
||||
* override các hook nhỏ onConfigure()/onStart()/onUpdate().
|
||||
*
|
||||
* Author: DuongTD
|
||||
@@ -35,7 +35,7 @@ namespace recovery_core
|
||||
* và do base xử lý phần lặp lại; plugin chỉ triển khai các hook protected:
|
||||
* - onConfigure() : đọc param riêng từ ctx()/NodeHandle (tuỳ chọn).
|
||||
* - onStart(goal) : chốt mục tiêu lượt này (rad/m/pose), reset trạng thái tiến độ.
|
||||
* - onUpdate(dt) : một "tick"; họ one-shot (path/clear) hoàn tất ngay lần đầu.
|
||||
* - onUpdate() : một "tick"; họ one-shot (path/clear) hoàn tất ngay lần đầu.
|
||||
*
|
||||
* Ba họ hành vi:
|
||||
* - Họ A (trả path) : onUpdate() trả RecoveryResult::PathOut(...), kSucceeded ngay.
|
||||
@@ -73,10 +73,9 @@ public:
|
||||
RecoveryResult start(const RecoveryGoal& goal);
|
||||
|
||||
/**
|
||||
* @brief Một control cycle. Guard chưa start/dt<=0/timeout/cancel trước khi gọi onUpdate().
|
||||
* @param dt Khoảng thời gian control cycle (s), > 0.
|
||||
* @brief Một control cycle. Guard chưa start/cancel trước khi gọi onUpdate().
|
||||
*/
|
||||
RecoveryResult update(double dt);
|
||||
RecoveryResult update();
|
||||
|
||||
/**
|
||||
* @brief Yêu cầu huỷ: update() kế tiếp trả stop output + kCancelled.
|
||||
@@ -89,12 +88,6 @@ public:
|
||||
return status_;
|
||||
}
|
||||
|
||||
/// @brief Thời gian đã trôi từ start() (s).
|
||||
double elapsed() const
|
||||
{
|
||||
return elapsed_;
|
||||
}
|
||||
|
||||
const std::string& name() const
|
||||
{
|
||||
return name_;
|
||||
@@ -120,7 +113,7 @@ protected:
|
||||
virtual RecoveryResult onStart(const RecoveryGoal& goal) = 0;
|
||||
|
||||
/// @brief Một tick. Họ one-shot trả kSucceeded/kFailed ngay; họ velocity trả kRunning tới goal.
|
||||
virtual RecoveryResult onUpdate(double dt) = 0;
|
||||
virtual RecoveryResult onUpdate() = 0;
|
||||
|
||||
// Truy cập cho plugin (chỉ đọc ngữ cảnh/goal).
|
||||
const RecoveryContext& ctx() const { return ctx_; }
|
||||
@@ -130,8 +123,6 @@ protected:
|
||||
RecoveryContext ctx_;
|
||||
RecoveryGoal goal_;
|
||||
std::string name_;
|
||||
double timeout_ = 0.0; ///< s — 0 nghĩa là không timeout; đọc param "~/<name>/timeout".
|
||||
double elapsed_ = 0.0;
|
||||
bool configured_ = false;
|
||||
bool started_ = false;
|
||||
bool cancel_requested_ = false;
|
||||
|
||||
Reference in New Issue
Block a user