hiep update

This commit is contained in:
2026-11-23 16:07:27 +07:00
parent d10bfd0ee3
commit cdcdb4f31c
6 changed files with 35 additions and 9 deletions

View File

@@ -17,15 +17,20 @@ Hướng dẫn chi tiết để build project `pnkx_nav_core` sử dụng CMake
## Yêu cầu hệ thống
### Hệ điều hành
- Linux (Ubuntu 18.04+ hoặc tương đương)
### Compiler
- **GCC**: phiên bản 7.0 trở lên (hỗ trợ C++17)
- **Clang**: phiên bản 5.0 trở lên
### CMake
- **CMake**: phiên bản 3.10 trở lên
Kiểm tra phiên bản:
```bash
cmake --version
g++ --version
@@ -177,6 +182,7 @@ make install
```
Cấu trúc sau khi install:
```
/usr/local/
├── include/
@@ -226,6 +232,7 @@ target_link_libraries(my_app
Xem hướng dẫn chi tiết trong `examples/README.md` và `examples/QUICK_START.md`.
Tóm tắt:
```bash
# Copy shared library
cp build/src/APIs/c_api/libnavigation_c_api.so /path/to/your/project/
@@ -269,6 +276,7 @@ sudo apt-get install libyaml-cpp-dev
### Lỗi: "undefined reference"
Đảm bảo tất cả dependencies đã được build theo đúng thứ tự:
1. Core libraries (tf3, robot_time, xmlrpcpp, robot_cpp)
2. Geometry và messages (geometry2, common_msgs)
3. Navigation cores (nav_core, nav_core2)
@@ -276,6 +284,7 @@ sudo apt-get install libyaml-cpp-dev
5. Main packages (move_base)
Build lại từ đầu:
```bash
cd build
rm -rf *

View File

@@ -53,9 +53,7 @@ void pnkx_local_planner::PNKXDockingLocalPlanner::initialize(robot::NodeHandle &
info_.origin_x = costmap_->getOriginX();
info_.origin_y = costmap_->getOriginY();
if (!costmap_robot_->isCurrent())
throw robot_nav_core2::CostmapDataLagException("Costmap2DROBOT is out of date somehow.");
// Costmap freshness is enforced per cycle in prepare(); layers may still be pending at load time.
parent_ = parent;
planner_nh_ = robot::NodeHandle(parent_, name);
robot::log_info_at(__FILE__, __LINE__, "Planner namespace: %s, parent namespace: %s", planner_nh_.getNamespace().c_str(), parent_.getNamespace().c_str());

View File

@@ -57,9 +57,7 @@ void pnkx_local_planner::PNKXGoStraightLocalPlanner::initialize(robot::NodeHandl
info_.origin_x = costmap_->getOriginX();
info_.origin_y = costmap_->getOriginY();
if (!costmap_robot_->isCurrent())
throw robot_nav_core2::CostmapDataLagException("Costmap2DROBOT is out of date somehow.");
// Costmap freshness is enforced per cycle in prepare(); layers may still be pending at load time.
parent_ = parent;
planner_nh_ = robot::NodeHandle(parent_, name);
robot::log_info_at(__FILE__, __LINE__, "Planner namespace: %s, parent namespace: %s", planner_nh_.getNamespace().c_str(), parent_.getNamespace().c_str());

View File

@@ -67,9 +67,7 @@ void pnkx_local_planner::PNKXLocalPlanner::initialize(robot::NodeHandle &parent,
info_.origin_x = costmap_->getOriginX();
info_.origin_y = costmap_->getOriginY();
if (!costmap_robot_->isCurrent())
throw robot_nav_core2::CostmapDataLagException("Costmap2DROBOT is out of date somehow.");
// Costmap freshness is enforced per cycle in prepare(); layers may still be pending at load time.
parent_ = parent;
planner_nh_ = robot::NodeHandle(parent_, name);
robot::log_info_at(__FILE__, __LINE__, "Planner namespace: %s, parent namespace: %s", planner_nh_.getNamespace().c_str(), parent_.getNamespace().c_str());

View File

@@ -539,6 +539,18 @@ namespace robot
*/
int loadYamlFilesFromDirectory(const std::string &directory_path);
/**
* @brief Replace the shared parameter tree with the YAML files of a directory.
*
* Sets the static config directory, clears the shared root tree and reloads it.
* Existing NodeHandle instances keep their previous scope; create new handles
* after reloading. Not thread-safe: callers must serialize with tree readers.
*
* @param config_dir Directory containing .yaml/.yml files.
* @return true if config_dir is a directory and was loaded.
*/
static bool reload(const std::string &config_dir);
/**
* @brief Get the namespace of this NodeHandle.
*

View File

@@ -880,6 +880,17 @@ namespace robot
return loaded_count;
}
bool NodeHandle::reload(const std::string &config_dir)
{
std::error_code ec;
if (!std::filesystem::is_directory(config_dir, ec))
return false;
config_directory_ = config_dir;
root_ = YAML::Node(YAML::NodeType::Map);
NodeHandle loader("~"); // empty root_ -> constructor auto-loads config_directory_
return true;
}
std::string NodeHandle::findConfigDirectory()
{
// If config directory is already set, use it