feat: tiep nhan route graph (Voronoi) cho global planner + anytime ARA* schema, don doc EnvMonitor
- navigation_server: them addRouteGraph(topic, RouteGraph), day vao sensor_store cung namespace addStaticMap; consumer (SBPLLatticePlanner) tu doi chieu map_hash. - PlannerRunner: them setSensorReader()/attachSensors() - trao SensorReader cho global planner nao ke thua robot_sensor_ports::SensorConsumer, goi TRUOC initialize() (dynamic_cast, giong co che ControllerRunner dang dung). - sensor_store_params.yaml: khai topic /route_graph (data_type RouteGraph, capacity 1). - sbpl_global_params.yaml (config/runtime): dong bo schema initial_epsilon/final_epsilon/ eps_step/repair_time/return_first_solution + khoi voronoi_corridor (xem pnkx_nav_core c52cbe5, Test/sbpl_lattice_planner cho code doc cac khoa nay). - launch: them arg launch_prefix (vd "stdbuf -oL" - robot::log_* dung printf khong flush, qua `| tee` bi block-buffer 8 KB lam log dung o dong cu du node con chay); them route_graph_maps_dir/route_graph_topic cho amr_node doc file voronoi.json theo map dang kich hoat. - docs: xoa PLAN_LIFECYCLE_CANCEL_PAUSE_RESUME.md (don sang Test/docs/move_base2/), sua duong dan ENV_MONITOR_PLAN.md trong comment cac header EnvMonitor lien quan.
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
#include <robot/plugin_loader_helper.h>
|
||||
#include <robot/robot.h>
|
||||
#include <robot_costmap_2d/costmap_2d_robot.h>
|
||||
#include <robot_sensor_ports/sensor_consumer.h>
|
||||
#include <robot_sensor_ports/sensor_reader.h>
|
||||
|
||||
namespace move_base2
|
||||
{
|
||||
@@ -152,6 +154,24 @@ bool PlannerRunner::configure(const robot::NodeHandle& nh,
|
||||
// Nạp plugin — chỉ control thread chạm
|
||||
// ================================================================================================
|
||||
|
||||
void PlannerRunner::attachSensors(robot_nav_core::BaseGlobalPlanner* planner) const
|
||||
{
|
||||
if (planner == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto* consumer = dynamic_cast<robot_sensor_ports::SensorConsumer*>(planner);
|
||||
if (consumer == nullptr)
|
||||
{
|
||||
return; // Planner không khai nhận kho. Đúng với phần lớn planner, không phải lỗi.
|
||||
}
|
||||
consumer->setSensorReader(sensors_);
|
||||
// Log vì cast qua ranh giới `.so` phụ thuộc RTTI khớp giữa hai bên, và build xanh không nói gì về
|
||||
// chuyện đó. Một planner khai kế thừa mà không bao giờ thấy dòng này nghĩa là RTTI lệch.
|
||||
robot::log_info("[move_base2] PlannerRunner: global planner accepts the shared sensor store (%s).\n",
|
||||
sensors_ != nullptr ? "store attached" : "no store configured");
|
||||
}
|
||||
|
||||
robot_nav_core::BaseGlobalPlanner* PlannerRunner::acquire(const std::string& name)
|
||||
{
|
||||
const auto cached = planners_.find(name);
|
||||
@@ -176,6 +196,7 @@ robot_nav_core::BaseGlobalPlanner* PlannerRunner::acquire(const std::string& nam
|
||||
"rebuilding for the new marker.\n", name.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
attachSensors(fresh.get());
|
||||
if (!fresh->initialize(name, costmap_))
|
||||
{
|
||||
robot::log_error("[move_base2] PlannerRunner: '%s' reported an initialize() failure while "
|
||||
@@ -272,6 +293,8 @@ robot_nav_core::BaseGlobalPlanner* PlannerRunner::acquire(const std::string& nam
|
||||
bool initialized = false;
|
||||
try
|
||||
{
|
||||
// Reader TRƯỚC initialize(): consumer đọc kho ngay trong initialize() (graph tiêm cùng lúc với map).
|
||||
attachSensors(loaded.instance.get());
|
||||
initialized = loaded.instance->initialize(name, costmap_);
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
|
||||
Reference in New Issue
Block a user