diff --git a/MQTT_SETUP_WINDOWS.md b/MQTT_SETUP_WINDOWS.md deleted file mode 100644 index 9e88693..0000000 --- a/MQTT_SETUP_WINDOWS.md +++ /dev/null @@ -1,85 +0,0 @@ -# Windows MQTT库安装指南 - -## 方法1: 使用vcpkg (推荐) - -### 1. 安装vcpkg -```cmd -git clone https://github.com/Microsoft/vcpkg.git -cd vcpkg -.\bootstrap-vcpkg.bat -``` - -### 2. 安装MQTT库 -```cmd -.\vcpkg install paho-mqtt:x64-windows -.\vcpkg install paho-mqttpp3:x64-windows -.\vcpkg install nlohmann-json:x64-windows -``` - -### 3. 集成到CMake -```cmd -.\vcpkg integrate install -``` - -### 4. 修改CMake命令 -在构建时添加vcpkg工具链: -```cmd -mkdir build -cd build -cmake .. -DCMAKE_TOOLCHAIN_FILE=[vcpkg根目录]/scripts/buildsystems/vcpkg.cmake -cmake --build . -``` - -## 方法2: 手动编译 - -### 1. 编译Paho MQTT C库 -```cmd -git clone https://github.com/eclipse/paho.mqtt.c.git -cd paho.mqtt.c -mkdir build -cd build -cmake .. -DPAHO_BUILD_STATIC=TRUE -DPAHO_BUILD_SHARED=FALSE -cmake --build . --config Release -cmake --install . --prefix C:/mqtt/c -``` - -### 2. 编译Paho MQTT C++库 -```cmd -git clone https://github.com/eclipse/paho.mqtt.cpp.git -cd paho.mqtt.cpp -mkdir build -cd build -cmake .. -DPAHO_MQTT_C_PATH=C:/mqtt/c -DPAHO_BUILD_STATIC=TRUE -cmake --build . --config Release -cmake --install . --prefix C:/mqtt/cpp -``` - -### 3. 修改CMakeLists.txt -添加库路径: -```cmake -set(CMAKE_PREFIX_PATH "C:/mqtt/cpp;C:/mqtt/c") -find_package(PahoMqttCpp REQUIRED) -``` - -## 验证安装 - -运行以下命令验证: -```cmd -cd build -cmake .. -``` - -如果没有错误,说明MQTT库已正确配置。 - -## 使用示例 - -在您的代码中导入MQTT: -```cpp -#include -#include "mqtt.hpp" - -// 创建MQTT客户端 -auto mqttClient = std::make_unique("localhost", 1883, "test_client"); -mqttClient->connect(); -mqttClient->subscribe("test/topic"); -``` diff --git a/include/navigation.hpp b/include/navigation.hpp index 61a3f0b..7cbec67 100644 --- a/include/navigation.hpp +++ b/include/navigation.hpp @@ -6,6 +6,8 @@ #include #include "unitree/robot/client/client.hpp" +namespace custom { + class Navigation { public: Navigation(); @@ -26,4 +28,6 @@ private: bool callSlamService(int api_id, const nlohmann::json& data); }; +} // namespace custom + #endif // NAVIGATION_HPP diff --git a/src/main.cpp b/src/main.cpp index 55e538e..bf0a4d5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,7 +19,7 @@ void signalHandler(int signal) { int main(int argc, char** argv) { Logger::getInstance().setLevel(LogLevel::INFO); - LOG_INFO("Starting Unitree GO2 System v0.0.1"); + LOG_INFO("Starting Unitree GO2 System v0.0.2"); signal(SIGINT, signalHandler); signal(SIGTERM, signalHandler); diff --git a/src/navigation.cpp b/src/navigation.cpp index 9c52702..9593cdb 100644 --- a/src/navigation.cpp +++ b/src/navigation.cpp @@ -5,6 +5,8 @@ const std::string SLAM_SERVICE_NAME = "slam_operate"; +namespace custom { + Navigation::Navigation() : client_(nullptr) {} Navigation::~Navigation() {} @@ -110,3 +112,5 @@ bool Navigation::closeSlam() { nlohmann::json data; return callSlamService(1901, data); } + +} // namespace custom