diff --git a/src/config.hpp b/src/config.hpp index caa55a2..cfb02bd 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -70,7 +70,7 @@ /** * SLAM建图脚本路径 */ - constexpr const char *SLAM_SCRIPT_PATH = "/unitree/module/graph_pid_ws"; + constexpr const char *SLAM_SCRIPT_PATH = "/unitree/module/graph_pid_ws/0_unitree_slam.sh"; /** * SLAM建图log路径 diff --git a/src/config.hpp b/src/config.hpp index caa55a2..cfb02bd 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -70,7 +70,7 @@ /** * SLAM建图脚本路径 */ - constexpr const char *SLAM_SCRIPT_PATH = "/unitree/module/graph_pid_ws"; + constexpr const char *SLAM_SCRIPT_PATH = "/unitree/module/graph_pid_ws/0_unitree_slam.sh"; /** * SLAM建图log路径 diff --git a/src/slam_wrapper.cpp b/src/slam_wrapper.cpp index be4bf9d..2feba0b 100644 --- a/src/slam_wrapper.cpp +++ b/src/slam_wrapper.cpp @@ -24,13 +24,11 @@ static std::string trim(const std::string &s) { auto start = s.begin(); while (start != s.end() && std::isspace(*start)) ++start; - auto end = s.end(); do { --end; } while (std::distance(start, end) > 0 && std::isspace(*end)); - - return std::string(start, end + 1); + return {start, end + 1}; } static std::string generate_multipart_form(const std::string &file_path, const std::string &boundary, @@ -150,13 +148,11 @@ std::string line; std::string current_section; - CommandAttribute current_command; + CommandAttribute current_command{}; while (std::getline(config_file, line)) { line = trim(line); if (line.empty()) continue; // 忽略空行 - std::cout << line << std::endl; - if (line[0] == '[') { // 处理节名 [section] size_t end_bracket = line.find(']'); diff --git a/src/config.hpp b/src/config.hpp index caa55a2..cfb02bd 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -70,7 +70,7 @@ /** * SLAM建图脚本路径 */ - constexpr const char *SLAM_SCRIPT_PATH = "/unitree/module/graph_pid_ws"; + constexpr const char *SLAM_SCRIPT_PATH = "/unitree/module/graph_pid_ws/0_unitree_slam.sh"; /** * SLAM建图log路径 diff --git a/src/slam_wrapper.cpp b/src/slam_wrapper.cpp index be4bf9d..2feba0b 100644 --- a/src/slam_wrapper.cpp +++ b/src/slam_wrapper.cpp @@ -24,13 +24,11 @@ static std::string trim(const std::string &s) { auto start = s.begin(); while (start != s.end() && std::isspace(*start)) ++start; - auto end = s.end(); do { --end; } while (std::distance(start, end) > 0 && std::isspace(*end)); - - return std::string(start, end + 1); + return {start, end + 1}; } static std::string generate_multipart_form(const std::string &file_path, const std::string &boundary, @@ -150,13 +148,11 @@ std::string line; std::string current_section; - CommandAttribute current_command; + CommandAttribute current_command{}; while (std::getline(config_file, line)) { line = trim(line); if (line.empty()) continue; // 忽略空行 - std::cout << line << std::endl; - if (line[0] == '[') { // 处理节名 [section] size_t end_bracket = line.find(']'); diff --git a/src/slam_wrapper.hpp b/src/slam_wrapper.hpp index 23b27ea..8e694ce 100644 --- a/src/slam_wrapper.hpp +++ b/src/slam_wrapper.hpp @@ -46,7 +46,7 @@ struct CommandAttribute { std::vector command; - bool enabled; + bool enabled{}; }; class SlamWrapper {