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()));