feat: EvadeRecovery plugin (back up or turn to the free side)
- plugins/evade_core.h: pure geometry (polygon footprint, reverse sweep, rotation-arc sweep, free-side choice), tested with point lists - plugins/evade_recovery.cpp: reads raw scans through RecoveryContext::sensors; holds on a short view loss, never drives on stale data - RecoveryContext / behavior ABI additions for the sensor reader
This commit is contained in:
@@ -24,8 +24,9 @@ namespace recovery_core
|
||||
*
|
||||
* 1 — trước 2026-09-11 (không có symbol; registry coi là "không khai").
|
||||
* 2 — 2026-09-11: thêm virtual `onCancelRequested()`.
|
||||
* 3 — 2026-11-26: thêm `RecoveryContext::sensors` (EvadeRecovery đọc scan lidar) — đổi layout struct.
|
||||
*/
|
||||
constexpr int kRecoveryAbiVersion = 2;
|
||||
constexpr int kRecoveryAbiVersion = 3;
|
||||
|
||||
/// Hàm được export kèm mỗi plugin qua @ref RECOVERY_CORE_EXPORT_BEHAVIOR; trả @ref kRecoveryAbiVersion.
|
||||
inline int recoveryAbiVersion()
|
||||
|
||||
@@ -197,6 +197,13 @@ protected:
|
||||
return cancel_requested_;
|
||||
}
|
||||
|
||||
/// @brief Mốc `now` của `start()` — đã đặt TRƯỚC khi gọi @ref onStart, để plugin đo tuổi dữ liệu
|
||||
/// theo cùng đồng hồ của caller thay vì tự gọi `robot::Time::now()` (sim time ≠ wall time).
|
||||
const robot::Time& startTime() const
|
||||
{
|
||||
return start_time_;
|
||||
}
|
||||
|
||||
/// @brief Stop output đúng họ của behavior này, kèm @p status.
|
||||
RecoveryResult stopResult(RecoveryStatus status) const;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace robot_costmap_2d { class Costmap2DROBOT; }
|
||||
|
||||
// Forward declare: chỉ plugin nào thật sự đổi frame mới include tf3; recovery_core không link tf3.
|
||||
namespace tf3 { class BufferCore; }
|
||||
namespace robot_sensor_ports { class SensorReader; }
|
||||
|
||||
namespace recovery_core
|
||||
{
|
||||
@@ -187,6 +188,9 @@ struct RecoveryContext
|
||||
* `action_core::ActionContext::tf`.
|
||||
*/
|
||||
tf3::BufferCore* tf = nullptr;
|
||||
|
||||
/// Kho sensor của host (non-owning). nullptr = host không cấp sensors; plugin cần scan phải từ chối start.
|
||||
const robot_sensor_ports::SensorReader* sensors = nullptr;
|
||||
};
|
||||
|
||||
} // namespace recovery_core
|
||||
|
||||
Reference in New Issue
Block a user