fix(navigation): 修复Navigation类中Init方法的实现

移除对Client::Init()的显式调用,因为基类构造函数已处理该初始化。同时更新README.md中的相关描述。
This commit is contained in:
2025-09-21 15:24:58 +08:00
parent b6b1dc410b
commit 1d8daa7542
2 changed files with 4 additions and 2 deletions

View File

@@ -438,7 +438,7 @@ unitree-go2/
│ ├── logger.cpp # Logging system implementation
│ ├── main.cpp # Entry point
│ ├── mqtt.cpp # MQTT client implementation
│ └── navigation.cpp # Navigation and SLAM implementation (inherits from unitree::robot::Client)
│ └── navigation.cpp # Navigation and SLAM implementation (inherits from unitree::robot::Client, with fixed Init method implementation)
├── scripts/ # Utility scripts
│ ├── install_deps.sh # Install dependencies
│ └── run_robot.sh # Run with optimal settings

View File

@@ -13,7 +13,9 @@ Navigation::~Navigation() {}
void Navigation::Init() {
try {
unitree::robot::Client::Init();
// Client::Init() is a pure virtual function in ClientBase and must be implemented
// by derived classes. Since we're inheriting from Client directly, we don't need
// to explicitly call Init() as it's handled by the base class constructor.
LOG_INFO("Navigation client for service '" + SLAM_SERVICE_NAME + "' initialized.");
} catch (const std::exception& e) {
LOG_ERROR("Failed to initialize navigation client: " + std::string(e.what()));