State Monitor Service
About 2319 wordsAbout 8 min
2025-01-27
Provides robot state monitoring interface class. Through StateMonitor, you can provide state query and other interfaces.
Interface Definition
StateMonitor
is a robot system state monitoring management class, typically used to control robot state management and support state queries.
StateMonitor
Item | Content |
---|---|
Class Name | StateMonitor |
Constructor | controller = StateMonitor() |
Function Overview | Constructor, initializes controller object. |
Notes | Constructs internal state. |
initialize
Item | Content |
---|---|
Function Name | initialize |
Function Declaration | bool initialize() |
Function Overview | Initialize controller, including resource allocation and driver loading. |
Return Value | True indicates success, False indicates failure. |
Notes | Object must be constructed before calling. |
shutdown
Item | Content |
---|---|
Function Name | shutdown |
Function Declaration | void shutdown() |
Function Overview | Close all connections and release resources. |
Notes | Used in conjunction with initialize. |
get_current_state
Item | Content |
---|---|
Function Name | get_current_state |
Function Declaration | RobotState get_current_state() |
Function Overview | Get current robot aggregated state |
Return Value | RobotState object |
Notes | Non-blocking interface, gets recently monitored robot state data, including BMS/fault state monitoring, etc., will be iteratively expanded |
RobotState
— Robot State Data Structure
Used to represent overall robot state information:
Field Name | Type | Description |
---|---|---|
faults | list[Fault] | Fault information list |
bms_data | BmsData | Battery management system data |
BmsData
— Battery Management System Data Structure
Represents battery state information:
Field Name | Type | Description |
---|---|---|
battery_percentage | float | Current battery remaining charge (percentage, 0~100) |
battery_health | float | Battery health status (higher is better) |
battery_state | BatteryState | Battery state (see enumeration below) |
power_supply_status | PowerSupplyStatus | Battery charge/discharge state (see enumeration below) |
Enumeration Type Definitions
BatteryState
— Battery State Enumeration Type
Used to represent current battery state, for battery state judgment and processing in the system:
Enumeration Value | Value | Description |
---|---|---|
BatteryState.UNKNOWN | 0 | Unknown state |
BatteryState.GOOD | 1 | Battery state good |
BatteryState.OVERHEAT | 2 | Battery overheating |
BatteryState.DEAD | 3 | Battery damaged |
BatteryState.OVERVOLTAGE | 4 | Battery overvoltage |
BatteryState.UNSPEC_FAILURE | 5 | Unknown failure |
BatteryState.COLD | 6 | Battery overcooled |
BatteryState.WATCHDOG_TIMER_EXPIRE | 7 | Watchdog timer expired |
BatteryState.SAFETY_TIMER_EXPIRE | 8 | Safety timer expired |
PowerSupplyStatus
— Battery Charge/Discharge State
Used to represent current battery charge/discharge state:
Enumeration Value | Value | Description |
---|---|---|
PowerSupplyStatus.UNKNOWN | 0 | Unknown state |
PowerSupplyStatus.CHARGING | 1 | Battery charging |
PowerSupplyStatus.DISCHARGING | 2 | Battery discharging |
PowerSupplyStatus.NOTCHARGING | 3 | Battery not charging/discharging |
PowerSupplyStatus.FULL | 4 | Battery fully charged |
Error Code Mapping Table
Error Code (Hexadecimal) | Error Description |
---|---|
0x0000 | No fault |
0x1101 | Service invocation failed |
0x1301 | Central control node lost |
0x1302 | App node lost |
0x1303 | Audio node lost |
0x1304 | Stereo camera node lost |
0x1305 | LIDAR node lost |
0x1306 | SLAM node lost |
0x1307 | Navigation node lost |
0x1308 | AI node lost |
0x1309 | Head node lost |
0x130A | Point cloud node lost |
0x2201 | No LIDAR data received |
0x2202 | No stereo camera data received |
0x2203 | Stereo camera data error |
0x2204 | Stereo camera initialization failed |
0x220B | No odometry data received |
0x220C | No IMU data received |
0x2215 | Depth camera not detected |
0x3101 | Failed to connect robot to app |
0x3102 | Heartbeat lost - assertion failed |
0x4201 | Failed to open head serial port |
0x4202 | No head data received |
0x5201 | No navigation TF data |
0x5202 | No navigation map data |
0x5203 | No navigation localization data |
0x5204 | No navigation LIDAR data |
0x5205 | No navigation depth camera data |
0x5206 | No navigation multi-line LIDAR data |
0x5207 | No navigation odometry data |
0x6201 | SLAM localization error |
0x6102 | No SLAM LIDAR data |
0x6103 | No SLAM odometry data |
0x6104 | SLAM map data error |
0x7201 | LCM connection timeout |
0x8201 | Left leg hardware error |
0x8202 | Right leg hardware error |
0x8203 | Left arm hardware error |
0x8204 | Right arm hardware error |
0x8205 | Waist hardware error |
0x8206 | Head hardware error |
0x8207 | Hand hardware error |
0x8208 | Gripper hardware error |
0x8209 | IMU hardware error |
0x820A | Power system hardware error |
0x820B | Leg force sensor hardware error |
0x820C | Arm force sensor hardware error |
0x9201 | ECAT (EtherCAT) hardware error |
0xA201 | Motion posture error |
0xA202 | Foot position deviation during movement |
0xA203 | Joint velocity error during motion |