From 1e4e5c39431d572958f5c403bc952a40118d6c8c Mon Sep 17 00:00:00 2001 From: Sucan126 <632190820@qq.com> Date: Mon, 22 Sep 2025 14:30:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=9C=8D=E5=8A=A1=E7=9B=91=E6=8E=A7):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=8D=E5=8A=A1=E7=8A=B6=E6=80=81=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=89=93=E5=8D=B0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当获取服务列表时,系统现在会自动打印每个服务的状态信息到日志中,包括服务名称、当前状态(ACTIVE/INACTIVE)和保护状态(YES/NO) --- README.md | 6 ++++++ src/custom_robot.cpp | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4120705..da02954 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ A high-performance C++ implementation for controlling Unitree GO2 robot with rea - **🎭 Special Actions**: Support for dances, tricks, and custom motions - **🚀 High Performance**: Optimized for real-time control with configurable frequencies - **🔧 Development Tools**: Built-in scripts and utilities for easy deployment +- **🔍 Service Status Monitoring**: Automatic printing of all robot service statuses ## Architecture @@ -329,6 +330,11 @@ Supported system commands: - `list`: Get list of available services - `switch`: Enable/disable a service +When the service list is retrieved (either through the `list` command or internally), the system automatically prints the status of each service to the logs. Each service entry includes: +- Service name +- Current status (ACTIVE/INACTIVE) +- Protection status (YES/NO) + ## Supported Actions ### Basic Motions diff --git a/src/custom_robot.cpp b/src/custom_robot.cpp index 64f4aad..1635ffe 100644 --- a/src/custom_robot.cpp +++ b/src/custom_robot.cpp @@ -132,7 +132,14 @@ bool CustomRobot::GetServiceList(std::vector& LOG_ERROR("Failed to get service list, error code: " + std::to_string(ret)); return false; } - // LOG_INFO("Successfully retrieved service list with " + std::to_string(serviceList.size()) + " services"); + + LOG_INFO("Successfully retrieved service list with " + std::to_string(serviceList.size()) + " services"); + for (const auto& service : serviceList) { + std::string statusStr = (service.status == 1) ? "ACTIVE" : "INACTIVE"; + LOG_INFO("Service: " + service.name + " | Status: " + statusStr + " | Protect: " + + (service.protect ? "YES" : "NO")); + } + return true; } catch (const std::exception& e) { LOG_ERROR("Exception in getServiceList: " + std::string(e.what()));