update ros

This commit is contained in:
2026-01-07 09:28:31 +07:00
parent 11b7c4a20d
commit ca9e100bd9
115 changed files with 1934 additions and 987 deletions

View File

@@ -41,7 +41,7 @@ robot::PluginLoaderHelper loader;
std::string lib_path = loader.findLibraryPath("CustomPlanner");
if (!lib_path.empty()) {
// Sử dụng với boost::dll::import_alias
auto planner_loader = boost::dll::import_alias<nav_core::BaseGlobalPlanner::Ptr()>(
auto planner_loader = boost::dll::import_alias<robot_nav_core2::BaseGlobalPlanner::Ptr()>(
lib_path, "CustomPlanner", boost::dll::load_mode::append_decorations);
planner_ = planner_loader();
}
@@ -53,14 +53,14 @@ Thay vì hardcode đường dẫn:
```cpp
// CŨ (hardcode):
std::string path_file_so = "/home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/build/libcustom_planner.so";
std::string path_file_so = "/home/robotics/AGV/Diff_Wheel_Prj/pnkx_robot_nav_core2/build/libcustom_planner.so";
// MỚI (từ config):
robot::PluginLoaderHelper loader;
std::string path_file_so = loader.findLibraryPath(global_planner);
if (path_file_so.empty()) {
// Fallback nếu không tìm thấy
path_file_so = "/home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/build/libcustom_planner.so";
path_file_so = "/home/robotics/AGV/Diff_Wheel_Prj/pnkx_robot_nav_core2/build/libcustom_planner.so";
}
```
@@ -97,7 +97,7 @@ plugin_libraries:
library_path: "/path/to/libpnkx_local_planner.so"
search_paths:
- "/home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/build"
- "/home/robotics/AGV/Diff_Wheel_Prj/pnkx_robot_nav_core2/build"
- "/path/to/other/libraries"
```
@@ -126,7 +126,7 @@ Helper sẽ tìm library theo thứ tự:
1. Đường dẫn trực tiếp (nếu absolute)
2. `$PNKX_NAV_CORE_CONFIG_DIR/boost_dll_plugins.yaml`
3. `$PNKX_NAV_CORE_DIR/config/boost_dll_plugins.yaml`
4. `/home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/config/boost_dll_plugins.yaml`
4. `/home/robotics/AGV/Diff_Wheel_Prj/pnkx_robot_nav_core2/config/boost_dll_plugins.yaml`
5. `../config/boost_dll_plugins.yaml` (relative paths)
- Symbol name có thể có namespace (ví dụ: `custom_planner::CustomPlanner`), helper sẽ tự động thử tìm cả tên đầy đủ và tên ngắn (`CustomPlanner`).

View File

@@ -877,7 +877,7 @@ namespace robot
// Try hardcoded fallback paths
std::vector<std::string> possible_paths = {
"/home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/config",
"/home/robotics/AGV/Diff_Wheel_Prj/pnkx_robot_nav_core2/config",
"../config",
"../../config",
"./config"};

View File

@@ -36,7 +36,7 @@ PluginLoaderHelper::PluginLoaderHelper(robot::NodeHandle nh, const std::string&
// Thêm các subdirectories thường dùng
search_paths_.push_back(build_dir + "/src/Algorithms/Packages/global_planners");
search_paths_.push_back(build_dir + "/src/Algorithms/Packages/local_planners");
search_paths_.push_back(build_dir + "/src/Navigations/Cores/nav_core_adapter");
search_paths_.push_back(build_dir + "/src/Navigations/Cores/robot_nav_core2_adapter");
search_paths_.push_back(build_dir + "/src/Libraries/robot_costmap_2d");
}
}
@@ -319,7 +319,7 @@ std::string PluginLoaderHelper::getBuildDirectory()
}
// Method 6: Hardcoded fallback
std::string fallback = "/home/robotics/AGV/Diff_Wheel_Prj/pnkx_nav_core/build";
std::string fallback = "/home/robotics/AGV/Diff_Wheel_Prj/pnkx_robot_nav_core2/build";
if (std::filesystem::exists(fallback)) {
return fallback;
}