State Monitoring Service
About 1533 wordsAbout 5 min
2025-05-29
Provides a robot state monitoring interface class. Through StateMonitor, you can perform state queries and related functions.
Interface Definition
StateMonitor
is the robot system state monitoring management class. This class is typically used for managing the robot's state and supports state queries.
GetCurrentState
Item | Description |
---|---|
Function Name | GetCurrentState |
Function Declaration | RobotState GetCurrentState(); |
Overview | Get the current aggregated robot state. |
Parameter Description | robot_state : Used to receive the state struct. |
Return Value | RobotState object. |
Remarks | Non-blocking interface. Retrieves the most recently monitored robot state data, including BMS battery status, fault information, etc. More features will be added in the future. |
RobotState
— Robot State Data Structure
Represents the overall state information of the robot:
Field Name | Type | Description |
---|---|---|
faults | std::vector<Fault> | List of fault information |
bms_data | BmsData | Battery Management System data |
BmsData
— Battery Management System Data Structure
Represents the battery status information:
Field Name | Type | Description |
---|---|---|
battery_percentage | float | Current battery remaining percentage (0~100) |
battery_health | float | Battery health status (higher value means better health) |
battery_state | BatteryState | Battery state (see enum below) |
power_supply_status | PowerSupplyStatus | Battery charge/discharge status (see enum below) |
Enum Type Definitions
BatteryState
— Battery State Enum
Represents the current state of the battery, used for determining and handling battery status in the system:
Enum Value | Value | Description |
---|---|---|
BatteryState::UNKNOWN | 0 | Unknown state |
BatteryState::GOOD | 1 | Battery is in good condition |
BatteryState::OVERHEAT | 2 | Battery overheated |
BatteryState::DEAD | 3 | Battery damaged |
BatteryState::OVERVOLTAGE | 4 | Battery overvoltage |
BatteryState::UNSPEC_FAILURE | 5 | Unknown failure |
BatteryState::COLD | 6 | Battery too cold |
BatteryState::WATCHDOG_TIMER_EXPIRE | 7 | Watchdog timer expired |
BatteryState::SAFETY_TIMER_EXPIRE | 8 | Safety timer expired |
PowerSupplyStatus
— Battery Charge/Discharge Status
Represents the current charge/discharge status of the battery:
Enum Value | Value | Description |
---|---|---|
PowerSupplyStatus::UNKNOWN | 0 | Unknown status |
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 (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 surface 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 surface 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 |