State Monitoring Service
About 1930 wordsAbout 6 min
2025-01-27
Provides monitoring of the robot system's operational status, including fault detection, battery status, etc.
Interface Definition
StateMonitor
is responsible for monitoring the robot's operational status, including fault detection and battery status.
StateMonitor
— State Monitor
Item | Description |
---|---|
Class Name | StateMonitor |
Overview | Monitors the robot's operational status, including fault detection and battery status |
Main Functions | Status query, fault monitoring, health check |
Use Cases | System monitoring, fault diagnosis, status reporting |
initialize
Item | Description |
---|---|
Method Name | initialize |
Method Declaration | bool initialize() |
Overview | Initializes the state monitor. |
Return Value | true for success, false for failure. |
Note | Must be called before first use. |
shutdown
Item | Description |
---|---|
Method Name | shutdown |
Method Declaration | void shutdown() |
Overview | Shuts down the state monitor. |
Note | Used together with initialize. |
get_current_state
Item | Description |
---|---|
Method Name | get_current_state |
Method Declaration | RobotState get_current_state() |
Overview | Gets the current state information of the robot. |
Return Value | Robot state information, including battery status, fault information, etc. |
Note | Non-blocking interface, used to get the current state information of the robot. |
Error Code Mapping Table
Error Code (Hex) | Error Description |
---|---|
0x0000 | No error |
0x1101 | Failed to call ROS service |
0x1301 | Main control node lost |
0x1302 | APP node lost |
0x1304 | Audio node lost |
0x1305 | Motion node lost |
0x1306 | LCD node lost |
0x1307 | realsense node lost |
0x1308 | Stereo camera node lost |
0x1309 | LDS node lost |
0x130A | Sensor board node lost |
0x130B | Touch node lost |
0x130C | SLAM node lost |
0x130D | Navigation node lost |
0x130E | AI node lost |
0x130F | Head node lost |
0x1310 | Cloud processor node lost |
0x3201 | No laser data |
0x3202 | No stereo camera data |
0x3203 | Stereo camera data error |
0x3204 | Stereo camera initialization failed |
0x320B | No odometry data |
0x320C | No IMU data |
0x6101 | Robot failed to connect to APP |
0x6102 | Disconnected from APP |
0x9201 | Failed to open LCD serial port |
0x7201 | Failed to open head serial port |
0x7202 | No head data |
0x8201 | Failed to open sensor board serial port |
0x8202 | No sensor board data |
0x2201 | Error: Navigation did not receive tf data |
0x2202 | Error: Navigation did not receive map data |
0x2203 | Error: Navigation did not receive localization data |
0x2204 | Error: Navigation did not receive ultrasonic data |
0x2205 | Error: Navigation did not receive laser data |
0x2206 | Error: Navigation did not receive RGBD data |
0x2207 | Error: Navigation did not receive multi-line laser data |
0x2208 | Error: Navigation did not receive point TOF data |
0x2209 | Error: Navigation did not receive area TOF data |
0x220A | Error: Navigation did not receive odometry data |
0x2101 | Warning: Navigation did not receive tf data |
0x2102 | Warning: Navigation did not receive map data |
0x2103 | Warning: Navigation did not receive localization data |
0x2104 | Warning: Navigation did not receive ultrasonic data |
0x2105 | Warning: Navigation did not receive laser data |
0x2106 | Warning: Navigation did not receive RGBD TOF data |
0x2107 | Warning: Navigation did not receive multi-line laser data |
0x2108 | Warning: Navigation did not receive point TOF data |
0x2109 | Warning: Navigation did not receive area TOF data |
0x210A | Warning: Navigation did not receive odometry data |
0x4201 | SLAM localization error |
0x4102 | Error: SLAM did not receive laser data |
0x4103 | Error: SLAM did not receive odometry data |
0x4205 | SLAM map error |
Enum Type Definitions
BatteryState
— Battery State Enum
Enum Value | Value | Description |
---|---|---|
UNKNOWN | 0 | Unknown state |
GOOD | 1 | Good |
OVERHEAT | 2 | Overheat |
DEAD | 3 | Battery depleted |
OVERVOLTAGE | 4 | Overvoltage |
UNSPEC_FAILURE | 5 | Unspecified failure |
COLD | 6 | Too cold |
WATCHDOG_TIMER_EXPIRE | 7 | Watchdog timer expired |
SAFETY_TIMER_EXPIRE | 8 | Safety timer expired |
PowerSupplyStatus
— Power Supply Status Enum
Enum Value | Value | Description |
---|---|---|
UNKNOWN | 0 | Unknown state |
CHARGING | 1 | Charging |
DISCHARGING | 2 | Discharging |
NOTCHARGING | 3 | Not charging |
FULL | 4 | Fully charged |
Data Structure Definitions
FaultVector
— Fault Information Vector
Item | Description |
---|---|
Type | Python binding of std::vector<magic::dog::Fault> |
Overview | Dynamic array storing fault information, used for system status monitoring and error handling |
Main Methods | Supports standard Python list operations, each element is a Fault struct |
Use Cases | Fault diagnosis, system monitoring, error log recording |
Fault
— Fault Information Struct
Field Name | Type | Description |
---|---|---|
error_code | int | Error code |
error_message | str | Error message |
BmsData
— Battery Management System Data Struct
Field Name | Type | Description |
---|---|---|
battery_percentage | float | Battery percentage |
battery_health | float | Battery health |
battery_state | BatteryState | Battery state |
power_supply_status | PowerSupplyStatus | Power supply status |
RobotState
— Robot State Struct
Field Name | Type | Description |
---|---|---|
faults | FaultVector | Fault list |
bms_data | BmsData | Battery data |