From 1d8daa7542f6bf972a7f7a6eef813e0012030ca1 Mon Sep 17 00:00:00 2001 From: Sucan126 <632190820@qq.com> Date: Sun, 21 Sep 2025 15:24:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(navigation):=20=E4=BF=AE=E5=A4=8DNavigation?= =?UTF-8?q?=E7=B1=BB=E4=B8=ADInit=E6=96=B9=E6=B3=95=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除对Client::Init()的显式调用,因为基类构造函数已处理该初始化。同时更新README.md中的相关描述。 --- README.md | 2 +- src/navigation.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 16fe266..4120705 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/navigation.cpp b/src/navigation.cpp index ea57524..f2ca482 100644 --- a/src/navigation.cpp +++ b/src/navigation.cpp @@ -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()));