feat(服务监控): 添加服务状态自动打印功能
当获取服务列表时,系统现在会自动打印每个服务的状态信息到日志中,包括服务名称、当前状态(ACTIVE/INACTIVE)和保护状态(YES/NO)
This commit is contained in:
@@ -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
|
- **🎭 Special Actions**: Support for dances, tricks, and custom motions
|
||||||
- **🚀 High Performance**: Optimized for real-time control with configurable frequencies
|
- **🚀 High Performance**: Optimized for real-time control with configurable frequencies
|
||||||
- **🔧 Development Tools**: Built-in scripts and utilities for easy deployment
|
- **🔧 Development Tools**: Built-in scripts and utilities for easy deployment
|
||||||
|
- **🔍 Service Status Monitoring**: Automatic printing of all robot service statuses
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
@@ -329,6 +330,11 @@ Supported system commands:
|
|||||||
- `list`: Get list of available services
|
- `list`: Get list of available services
|
||||||
- `switch`: Enable/disable a service
|
- `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
|
## Supported Actions
|
||||||
|
|
||||||
### Basic Motions
|
### Basic Motions
|
||||||
|
|||||||
@@ -132,7 +132,14 @@ bool CustomRobot::GetServiceList(std::vector<unitree::robot::go2::ServiceState>&
|
|||||||
LOG_ERROR("Failed to get service list, error code: " + std::to_string(ret));
|
LOG_ERROR("Failed to get service list, error code: " + std::to_string(ret));
|
||||||
return false;
|
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;
|
return true;
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
LOG_ERROR("Exception in getServiceList: " + std::string(e.what()));
|
LOG_ERROR("Exception in getServiceList: " + std::string(e.what()));
|
||||||
|
|||||||
Reference in New Issue
Block a user