feat: dai hanh lang theo route graph (Voronoi) cho goal xa, anytime ARA* dung ReplanParams, smoother path

- Anytime dung nghia (pha 0): replan() qua ReplanParams thay vi replan(double) - nghiem dau o
  initial_epsilon, ha dan eps_step toi final_epsilon trong repair_time; return_first_solution
  de bench. eps=1.0 (A* thuan) tren map rong gan chac chan het gio.
- Route graph corridor: nhan robot_sensor_ports::SensorConsumer, doc RouteGraph tu kho (host
  bien dich Voronoi tu map, day qua addRouteGraph), doi chieu map_hash voi static layer song.
  Goal >= min_range_m + co graph -> gan start/goal (BFS), Dijkstra ra tuyen, dong dau mask quanh
  tuyen; o NGOAI mask nhan cost inscribed (hard) hoac bi phat (soft) - search + heuristic 2D chi
  no trong dai (~3% map thay 100% tren sehc). Khong graph/lech/gan that bai = chay full nhu cu,
  log [debug/corridor] noi ly do; "route graph REJECTED" la LOI khong tat duoc. Nguong nghen ->
  noi rong (widen_factor, toi da max_widen) -> bo dai chay full voi thoi gian con lai.
- Path smoother (distance_map.h/.cpp, path_smoother.h/.cpp): keo day doan lattice di thang duoc
  tren costmap SONG (distance-transform giu khoang cach voi LETHAL, khong chi nhin cost), bo goc
  bang cung ban kinh co dinh khop bo mprim - giu nguyen doan lui (cusp). Do tren sehc: path
  lattice dai hon toi uu 2D 12%, 11 lan doi chieu re; smoother giam duoc phan lon.
- Log "metrics: ... detour= turn_deg= arcs= wiggles= plan_ms= corridor= corridor_ms= smooth=
  raw_m= smooth_ms= anchors= fillets=" moi lan plan thanh cong - so dai on/off, hard/soft, eps
  qua script tools/eval_plan_bag.py.
- Test moi: test/path_smoother_test.cpp (path_smoother la hinh hoc thuan, khong SBPL/costmap,
  chay duoc moi noi co gtest). CMakeLists them target catkin_add_gtest + nhanh standalone.
- Phu thuoc build moi: robot_sensor_ports, route_graph (repo rieng, da co remote).
- YAML: schema initial_epsilon/final_epsilon/eps_step/repair_time/return_first_solution,
  khoi voronoi_corridor (12 khoa) va smooth_path (7 khoa) trong cfg/sbpl_global_params.yaml
  (dong bo tu pnkx_nav_core c52cbe5 / move_base2 f4f9965).
This commit is contained in:
2026-09-22 15:51:26 +07:00
parent 34c74cb541
commit 3fff3b15cd
13 changed files with 2510 additions and 100 deletions

View File

@@ -72,6 +72,8 @@ if (NOT BUILDING_WITH_CATKIN)
robot_nav_core
robot_protocol_msgs
robot_cpp
robot_sensor_ports
route_graph
)
else()
@@ -91,6 +93,8 @@ else()
robot_nav_core
robot_protocol_msgs
robot_cpp
robot_sensor_ports
route_graph
)
find_library(TF3_LIBRARY NAMES tf3)
@@ -98,7 +102,7 @@ else()
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS robot_visualization_msgs robot_nav_msgs robot_std_msgs robot_geometry_msgs robot_tf3_geometry_msgs robot_time data_convert robot_costmap_2d robot_nav_core robot_protocol_msgs robot_cpp
CATKIN_DEPENDS robot_visualization_msgs robot_nav_msgs robot_std_msgs robot_geometry_msgs robot_tf3_geometry_msgs robot_time data_convert robot_costmap_2d robot_nav_core robot_protocol_msgs robot_cpp robot_sensor_ports route_graph
DEPENDS Eigen3 Boost SBPL
)
@@ -115,6 +119,8 @@ endif()
# ========================================================
add_library(${PROJECT_NAME} SHARED
src/sbpl_lattice_planner.cpp
src/path_smoother.cpp
src/distance_map.cpp
)
# Header sbpl phải là bản mà SBPL_DIR chọn, ĐỨNG TRƯỚC mọi include của catkin: /opt/ros/noetic/include
@@ -163,6 +169,35 @@ else()
endif()
# ========================================================
# Tests — path_smoother is pure geometry (no SBPL/costmap), runs anywhere gtest exists.
# catkin_add_gtest KHÔNG link gtest_main nên test tự có main(). Chạy tay:
# ./devel/lib/sbpl_lattice_planner/path_smoother_test (catkin)
# ========================================================
if(BUILDING_WITH_CATKIN)
if(CATKIN_ENABLE_TESTING)
catkin_add_gtest(path_smoother_test test/path_smoother_test.cpp src/path_smoother.cpp src/distance_map.cpp)
if(TARGET path_smoother_test)
# catkin_add_gtest đánh dấu EXCLUDE_FROM_ALL (chỉ ra khi chạy target `tests`); bỏ dấu để
# `catkin_make --pkg sbpl_lattice_planner` ra luôn ./devel/lib/sbpl_lattice_planner/path_smoother_test.
set_target_properties(path_smoother_test PROPERTIES EXCLUDE_FROM_ALL FALSE)
target_compile_options(path_smoother_test PRIVATE -Wall -Wextra)
target_include_directories(path_smoother_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(path_smoother_test pthread)
endif()
endif()
else()
option(BUILD_TESTS "Build sbpl_lattice_planner unit tests" OFF)
if(BUILD_TESTS)
find_package(GTest REQUIRED)
add_executable(path_smoother_test test/path_smoother_test.cpp src/path_smoother.cpp src/distance_map.cpp)
target_include_directories(path_smoother_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(path_smoother_test PRIVATE GTest::GTest pthread)
enable_testing()
add_test(NAME path_smoother_test COMMAND path_smoother_test)
endif()
endif()
# ========================================================
# Install
# ========================================================