diff --git a/source/RobotAPI/components/RobotHealth/RobotHealth.cpp b/source/RobotAPI/components/RobotHealth/RobotHealth.cpp index 6f10dc4ababdb53dec8b75a617abc62ab39d406d..24bc96c94750cbe4e81cf668501970b7ac70b118 100644 --- a/source/RobotAPI/components/RobotHealth/RobotHealth.cpp +++ b/source/RobotAPI/components/RobotHealth/RobotHealth.cpp @@ -33,6 +33,7 @@ void RobotHealth::onInitComponent() defaultMaximumCycleTimeErr = getProperty<int>("MaximumCycleTimeErrMS").getValue(); usingTopic(getProperty<std::string>("RobotHealthTopicName").getValue()); reportErrorsWithSpeech = getProperty<bool>("ReportErrorsWithSpeech").getValue(); + speechMinimumReportInterval = getProperty<int>("SpeechMinimumReportInterval").getValue(); //robotUnitRequired = getProperty<bool>("RobotUnitRequired").getValue(); /*if(robotUnitRequired) @@ -88,8 +89,9 @@ void RobotHealth::monitorHealthTaskClb() if (e.isRunning) { ARMARX_ERROR << deactivateSpam(0.1, e.name) << "Component " << e.name << " has died."; - if (reportErrorsWithSpeech) + if (reportErrorsWithSpeech && (TimeUtil::GetTime() - lastSpeechOutput).toSecondsDouble() > speechMinimumReportInterval) { + lastSpeechOutput = TimeUtil::GetTime(); textToSpeechTopic->reportText("Oh no! Component " + e.name + " is no longer running."); } hasNewErr = true; diff --git a/source/RobotAPI/components/RobotHealth/RobotHealth.h b/source/RobotAPI/components/RobotHealth/RobotHealth.h index 65c086a350e108ded20560bb89081cfbad907fe3..cc50f09dea4beaec07ad637d3ac60ebdbbf1bd1c 100644 --- a/source/RobotAPI/components/RobotHealth/RobotHealth.h +++ b/source/RobotAPI/components/RobotHealth/RobotHealth.h @@ -54,6 +54,8 @@ namespace armarx defineOptionalProperty<std::string>("AggregatedRobotHealthTopicName", "AggregatedRobotHealthTopic", "Name of the AggregatedRobotHealthTopic"); defineOptionalProperty<std::string>("RequiredComponents", "", "Comma separated list of required components"); + defineOptionalProperty<int>("SpeechMinimumReportInterval", 60, "Time that has to pass between reported messages in seconds."); + //defineOptionalProperty<std::string>("RemoteGuiName", "RemoteGuiProvider", "Name of the remote GUI provider"); //defineOptionalProperty<std::string>("RobotUnitName", "Armar6Unit", "Name of the RobotUnit"); //defineOptionalProperty<bool>("RobotUnitRequired", true, "Wait for RobotUnit"); @@ -150,6 +152,8 @@ namespace armarx AggregatedRobotHealthInterfacePrx aggregatedRobotHealthTopicPrx; TextListenerInterfacePrx textToSpeechTopic; bool reportErrorsWithSpeech; + int speechMinimumReportInterval; + IceUtil::Time lastSpeechOutput; // RobotHealthInterface interface public: diff --git a/source/RobotAPI/gui-plugins/GuiHealthClient/GuiHealthClientWidgetController.cpp b/source/RobotAPI/gui-plugins/GuiHealthClient/GuiHealthClientWidgetController.cpp index ccad68123ca6a1ce944e3abffc2d3890385a83ec..4b588f433f2dfa75b02e75d26e487e2703fb5811 100644 --- a/source/RobotAPI/gui-plugins/GuiHealthClient/GuiHealthClientWidgetController.cpp +++ b/source/RobotAPI/gui-plugins/GuiHealthClient/GuiHealthClientWidgetController.cpp @@ -68,6 +68,9 @@ void GuiHealthClientWidgetController::onInitComponent() void GuiHealthClientWidgetController::healthTimerClb() { + RobotHealthHeartbeatArgs rhha; + rhha.maximumCycleTimeWarningMS = 250; + rhha.maximumCycleTimeErrorMS = 500; robotHealthTopicPrx->heartbeat(getName(), RobotHealthHeartbeatArgs()); } void GuiHealthClientWidgetController::updateSummaryTimerClb()