diff --git a/source/RobotAPI/components/RobotHealth/CMakeLists.txt b/source/RobotAPI/components/RobotHealth/CMakeLists.txt index 065edb26d7c32cf48a6cdacfaeabd2baacb12d25..0a59a5003c21651eb32bcfd51ec2179d212d4dc2 100644 --- a/source/RobotAPI/components/RobotHealth/CMakeLists.txt +++ b/source/RobotAPI/components/RobotHealth/CMakeLists.txt @@ -1,7 +1,7 @@ armarx_component_set_name("RobotHealth") set(COMPONENT_LIBS - ArmarXCoreInterfaces ArmarXCore + ArmarXCoreInterfaces ArmarXCore ArmarXCoreComponentPlugins RemoteGui ArmarXGuiInterfaces RobotAPIInterfaces) diff --git a/source/RobotAPI/components/RobotHealth/RobotHealth.cpp b/source/RobotAPI/components/RobotHealth/RobotHealth.cpp index 934b88073535870c139d3677e45d8dcdc19bbf57..0e4b7f72ac1cc1f5f9b69b678c2d2f790c479184 100644 --- a/source/RobotAPI/components/RobotHealth/RobotHealth.cpp +++ b/source/RobotAPI/components/RobotHealth/RobotHealth.cpp @@ -49,6 +49,8 @@ namespace armarx //usingProxy(getProperty<std::string>("RemoteGuiName").getValue()); + + setDebugObserverBatchModeEnabled(true); } @@ -157,6 +159,8 @@ namespace armarx catch(...) {} }*/ + + reportDebugObserver(); } void RobotHealth::onDisconnectComponent() @@ -296,4 +300,16 @@ namespace armarx } return ss.str(); } + + void RobotHealth::reportDebugObserver() + { + for(const auto& entry: entries) + { + setDebugObserverDatafield("RobotHealth_" + entry.name + "_lastDelta", entry.lastDelta); + setDebugObserverDatafield("RobotHealth_" + entry.name + "_maximumCycleTimeWarn", entry.maximumCycleTimeWarn); + setDebugObserverDatafield("RobotHealth_" + entry.name + "_maximumCycleTimeErr", entry.maximumCycleTimeErr); + } + + sendDebugObserverBatch(); + } } diff --git a/source/RobotAPI/components/RobotHealth/RobotHealth.h b/source/RobotAPI/components/RobotHealth/RobotHealth.h index 49ca51167f87d7c83636c7d7d8f744797dd2d5e2..3da12c1797ffa0afbc9af7310ec40953ecc51309 100644 --- a/source/RobotAPI/components/RobotHealth/RobotHealth.h +++ b/source/RobotAPI/components/RobotHealth/RobotHealth.h @@ -32,6 +32,7 @@ #include <ArmarXCore/core/Component.h> #include <ArmarXCore/core/services/tasks/PeriodicTask.h> #include <ArmarXCore/interface/components/EmergencyStopInterface.h> +#include <ArmarXCore/libraries/ArmarXCoreComponentPlugins/DebugObserverComponentPlugin.h> #include <atomic> #include <mutex> @@ -82,7 +83,8 @@ namespace armarx */ class RobotHealth : virtual public RobotHealthComponentInterface, - virtual public armarx::Component + virtual public armarx::Component, + virtual public armarx::DebugObserverComponentPluginUser { public: /** @@ -145,6 +147,8 @@ namespace armarx void monitorHealthTaskClb(); Entry& findOrCreateEntry(const std::string& name); + void reportDebugObserver(); + std::mutex mutex; std::deque<Entry> entries; std::atomic_size_t validEntries {0};