HMS Management
Overview
HMS (Health Management System) is a monitoring system for the operational health status of various aircraft modules. An interactive interface is already provided on the remote controller to check if any module's working state has abnormalities. PSDK provides basic interfaces to retrieve error messages from the various modules, making it easier for PSDK programs to know the health status of aircraft modules.
Basic Concepts
HMS Error Information
Each HMS error message contains an error ID, an index for the error, and a severity level. After subscribing to the HMS information, these error messages are packaged and sent to the PSDK. PSDK parses the error data into strings and prints it on the terminal.
Using HMS Features
1. Initialize the HMS Module
Before using the HMS-related interfaces, the UAV_HmsManager_Init
function must be called to initialize the HMS module.
returnCode = UAV_HmsManager_Init();
if (returnCode != 0) {
USER_LOG_ERROR("Hms sample init error, error code:0x%08llX", returnCode);
goto out;
}
2. Register the HMS Information Callback
Developers can register a callback for receiving real-time HMS error information through the UAVHmsManager_RegHmsInfoCallback
interface. When HMS errors occur, users can receive specific HMS information in the UAVHmsManager_RegHmsInfoCallback
callback function.
returnCode = UAV_HmsManager_RegHmsInfoCallback(UAVTest_HmsInfoCallback);
if (returnCode != 0) {
USER_LOG_ERROR("Register callback function of push HMS information failed, error code:0x%08llX", returnCode);
goto out;
}
3. Parsing HMS Information
Once the user receives the HMS error code, they need to look up the error string using the error code and differentiate whether the aircraft is in the air. Based on the error code, appropriate measures can be taken to ensure the safety of the aircraft's flight.
static void UAV_Test_HmsInfoCallback(T_UAVHmsInfoTable hmsInfoTable)
{
for (int i = 0; i < hmsInfoTable.hmsInfoNum; i++)
{
UAV_LOG_INFO("index %d: errorCode %d, componentIndex %d, errorLevel %d", i,
hmsInfoTable.hmsInfo[i].errorCode, hmsInfoTable.hmsInfo[i].componentIndex, hmsInfoTable.hmsInfo[i].errorLevel);
}
}