From b6dc3412265b98b6d5ee586a45ad413af264589d Mon Sep 17 00:00:00 2001
From: Simon Ottenhaus <simon.ottenhaus@kit.edu>
Date: Mon, 17 Dec 2018 17:30:15 +0100
Subject: [PATCH] speech output is configurable

---
 source/RobotAPI/components/RobotHealth/RobotHealth.cpp | 6 +++++-
 source/RobotAPI/components/RobotHealth/RobotHealth.h   | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/source/RobotAPI/components/RobotHealth/RobotHealth.cpp b/source/RobotAPI/components/RobotHealth/RobotHealth.cpp
index 0d001ba47..6f10dc4ab 100644
--- a/source/RobotAPI/components/RobotHealth/RobotHealth.cpp
+++ b/source/RobotAPI/components/RobotHealth/RobotHealth.cpp
@@ -32,6 +32,7 @@ void RobotHealth::onInitComponent()
     defaultMaximumCycleTimeWarn = getProperty<int>("MaximumCycleTimeWarnMS").getValue();
     defaultMaximumCycleTimeErr = getProperty<int>("MaximumCycleTimeErrMS").getValue();
     usingTopic(getProperty<std::string>("RobotHealthTopicName").getValue());
+    reportErrorsWithSpeech = getProperty<bool>("ReportErrorsWithSpeech").getValue();
 
     //robotUnitRequired = getProperty<bool>("RobotUnitRequired").getValue();
     /*if(robotUnitRequired)
@@ -87,7 +88,10 @@ void RobotHealth::monitorHealthTaskClb()
             if (e.isRunning)
             {
                 ARMARX_ERROR << deactivateSpam(0.1, e.name) << "Component " << e.name << " has died.";
-                textToSpeechTopic->reportText("Oh no! Component " + e.name + " is no longer running.");
+                if (reportErrorsWithSpeech)
+                {
+                    textToSpeechTopic->reportText("Oh no! Component " + e.name + " is no longer running.");
+                }
                 hasNewErr = true;
                 e.isRunning = false;
             }
diff --git a/source/RobotAPI/components/RobotHealth/RobotHealth.h b/source/RobotAPI/components/RobotHealth/RobotHealth.h
index 989d6170b..65c086a35 100644
--- a/source/RobotAPI/components/RobotHealth/RobotHealth.h
+++ b/source/RobotAPI/components/RobotHealth/RobotHealth.h
@@ -47,6 +47,7 @@ namespace armarx
         {
             defineOptionalProperty<std::string>("EmergencyStopTopicName", "EmergencyStop", "The name of the topic over which changes of the emergencyStopState are sent.");
             defineOptionalProperty<std::string>("RobotHealthTopicName", "RobotHealthTopic", "Name of the RobotHealth topic");
+            defineOptionalProperty<bool>("ReportErrorsWithSpeech", true, "");
             defineOptionalProperty<std::string>("TextToSpeechTopicName", "TextToSpeech", "Name of the TextToSpeech topic");
             defineOptionalProperty<int>("MaximumCycleTimeWarnMS", 50, "Default value of the maximum cycle time for warnings");
             defineOptionalProperty<int>("MaximumCycleTimeErrMS", 100, "Default value of the maximum cycle time for error");
@@ -148,6 +149,7 @@ namespace armarx
         RemoteGuiInterfacePrx remoteGuiPrx;
         AggregatedRobotHealthInterfacePrx aggregatedRobotHealthTopicPrx;
         TextListenerInterfacePrx textToSpeechTopic;
+        bool reportErrorsWithSpeech;
 
         // RobotHealthInterface interface
     public:
-- 
GitLab