From 167f7fe7e2cd4eb963ae8914759c703428368b6e Mon Sep 17 00:00:00 2001
From: Simon Ottenhaus <simon.ottenhaus@kit.edu>
Date: Mon, 17 Dec 2018 17:23:13 +0100
Subject: [PATCH] speech debug output

---
 source/RobotAPI/components/RobotHealth/RobotHealth.cpp | 2 ++
 source/RobotAPI/components/RobotHealth/RobotHealth.h   | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/source/RobotAPI/components/RobotHealth/RobotHealth.cpp b/source/RobotAPI/components/RobotHealth/RobotHealth.cpp
index 0d6d8ce5d..0d001ba47 100644
--- a/source/RobotAPI/components/RobotHealth/RobotHealth.cpp
+++ b/source/RobotAPI/components/RobotHealth/RobotHealth.cpp
@@ -50,6 +50,7 @@ void RobotHealth::onConnectComponent()
     emergencyStopTopicPrx = getTopic<EmergencyStopListenerPrx>(getProperty<std::string>("EmergencyStopTopicName").getValue());
     //remoteGuiPrx = getProxy<RemoteGuiInterfacePrx>(getProperty<std::string>("RemoteGuiName").getValue());
     aggregatedRobotHealthTopicPrx = getTopic<AggregatedRobotHealthInterfacePrx>(getProperty<std::string>("AggregatedRobotHealthTopicName").getValue());
+    textToSpeechTopic = getTopic<TextListenerInterfacePrx>(getProperty<std::string>("TextToSpeechTopicName").getValue());
 
     /*if(robotUnitRequired)
     {
@@ -86,6 +87,7 @@ 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.");
                 hasNewErr = true;
                 e.isRunning = false;
             }
diff --git a/source/RobotAPI/components/RobotHealth/RobotHealth.h b/source/RobotAPI/components/RobotHealth/RobotHealth.h
index cbf7381b5..989d6170b 100644
--- a/source/RobotAPI/components/RobotHealth/RobotHealth.h
+++ b/source/RobotAPI/components/RobotHealth/RobotHealth.h
@@ -30,6 +30,7 @@
 #include <RobotAPI/interface/units/RobotUnit/RobotUnitInterface.h>
 #include <atomic>
 #include <ArmarXGui/interface/RemoteGuiInterface.h>
+#include <RobotAPI/interface/speech/SpeechInterface.h>
 
 namespace armarx
 {
@@ -46,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<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");
             defineOptionalProperty<std::string>("AggregatedRobotHealthTopicName", "AggregatedRobotHealthTopic", "Name of the AggregatedRobotHealthTopic");
@@ -145,6 +147,7 @@ namespace armarx
         //bool robotUnitRequired;
         RemoteGuiInterfacePrx remoteGuiPrx;
         AggregatedRobotHealthInterfacePrx aggregatedRobotHealthTopicPrx;
+        TextListenerInterfacePrx textToSpeechTopic;
 
         // RobotHealthInterface interface
     public:
-- 
GitLab