This commit is contained in:
2026-08-09 19:21:50 +07:00
parent 84d4becbdf
commit 6fbc29f6d8
3 changed files with 193 additions and 197 deletions

View File

@@ -54,12 +54,27 @@ public:
* @param plan The plan... filled by the planner
* @return True if a valid plan was found, false otherwise
*/
virtual bool makePlan(const robot_geometry_msgs::PoseStamped& start,
const robot_geometry_msgs::PoseStamped& goal,
virtual bool makePlan(const robot_geometry_msgs::PoseStamped& start,
const robot_geometry_msgs::PoseStamped& goal,
std::vector<robot_geometry_msgs::PoseStamped>& plan);
/**
* @brief Nạp lưới NGOÀI thay cho lưới sống của costmap trong các lần makePlan kế tiếp.
*
* Dùng cho detour trên lưới gộp (global nền + local đè): bên gọi snapshot hai costmap dưới mutex
* rồi đưa bản chụp vào đây — makePlan đọc bản chụp, KHÔNG giữ mutex costmap nào trong lúc search.
*
* Ràng buộc: lưới ngoài phải CÙNG kích thước/resolution với costmap đã initialize() (bản chụp
* gộp lấy global làm nền nên tự thoả). Footprint/inflation/frame vẫn đọc từ costmap sống.
* Con trỏ non-owning, bên gọi giữ buffer sống qua lời gọi makePlan. `nullptr` = quay lại lưới sống.
*
* Không thuộc interface `BaseGlobalPlanner` — bên ngoài .so gọi qua alias Boost.DLL
* `SBPLLatticePlannerExternalGrid` (xem cuối sbpl_lattice_planner.cpp).
*/
void setExternalGrid(const robot_costmap_2d::Costmap2D* grid);
virtual ~SBPLLatticePlanner(){};
static robot_nav_core::BaseGlobalPlanner::Ptr create();
private:
@@ -110,8 +125,12 @@ private:
* plan lại một lần. Không ra nghiệm thì retry với heading thật. */
bool free_start_heading_;
/// @return lưới đang có hiệu lực: lưới ngoài nếu được nạp, không thì lưới sống của costmap.
const robot_costmap_2d::Costmap2D* activeGrid() const;
std::string name_;
robot_costmap_2d::Costmap2DROBOT* costmap_robot_; /**< manages the cost map for us */
const robot_costmap_2d::Costmap2D* external_grid_; /**< non-owning; NULL = dùng lưới sống */
std::vector<robot_geometry_msgs::Point> footprint_;
std::vector<robot_geometry_msgs::Point> footprint_prev_;
unsigned int current_env_width_;