diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/HeartbeatComponentPlugin.cpp b/source/RobotAPI/libraries/RobotAPIComponentPlugins/HeartbeatComponentPlugin.cpp index b0ad0e37fe12f626c82e0c7d1c6ec0cf320bcead..1730634c3aad2149d1be1d4486f65960a5286401 100644 --- a/source/RobotAPI/libraries/RobotAPIComponentPlugins/HeartbeatComponentPlugin.cpp +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/HeartbeatComponentPlugin.cpp @@ -59,50 +59,50 @@ namespace armarx::plugins HeartbeatComponentPlugin::signUp(const RobotHealthHeartbeatArgs& args) { ARMARX_TRACE; - ARMARX_CHECK_NOT_NULL(rhprx); + ARMARX_CHECK_NOT_NULL(robotHealthComponentPrx); if (args.identifier.empty()) { RobotHealthHeartbeatArgs argsCopy = args; argsCopy.identifier = parent().getName(); - rhprx->signUp(argsCopy); + robotHealthComponentPrx->signUp(argsCopy); } else { // add component name prefix to identifier RobotHealthHeartbeatArgs argsCopy = args; argsCopy.identifier = parent().getName() + "_" + argsCopy.identifier; - rhprx->signUp(argsCopy); + robotHealthComponentPrx->signUp(argsCopy); } } void HeartbeatComponentPlugin::heartbeat() { - if (robotHealthTopic) + if (robotHealthComponentPrx) { armarx::core::time::dto::DateTime now; armarx::core::time::toIce(now, armarx::core::time::DateTime::Now()); - robotHealthTopic->heartbeat(parent().getName(), now); + robotHealthComponentPrx->heartbeat(parent().getName(), now); } else { - ARMARX_WARNING << "No robot health topic available!"; + ARMARX_WARNING << "No robot health proxy available!"; } } void HeartbeatComponentPlugin::heartbeatOnChannel(const std::string& channelName) { - if (robotHealthTopic) + if (robotHealthComponentPrx) { armarx::core::time::dto::DateTime now; armarx::core::time::toIce(now, armarx::core::time::DateTime::Now()); - robotHealthTopic->heartbeat(parent().getName() + "_" + channelName, now); + robotHealthComponentPrx->heartbeat(parent().getName() + "_" + channelName, now); } else { - ARMARX_WARNING << "No robot health topic available!"; + ARMARX_WARNING << "No robot health proxy available!"; } } @@ -131,9 +131,7 @@ namespace armarx::plugins void HeartbeatComponentPlugin::postOnConnectComponent() { - ARMARX_CHECK_NOT_NULL(rhprx); - topicName = rhprx->getTopicName(); - robotHealthTopic = parent<Component>().getTopic<RobotHealthInterfacePrx>(topicName); + ARMARX_CHECK_NOT_NULL(robotHealthComponentPrx); } void @@ -142,19 +140,19 @@ namespace armarx::plugins if (!properties->hasDefinition(makePropertyName(healthPropertyName))) { properties->component( - rhprx, "RobotHealth", healthPropertyName, "Name of the robot health component."); + robotHealthComponentPrx, "RobotHealth", healthPropertyName, "Name of the robot health component."); } if (not properties->hasDefinition(makePropertyName(maximumCycleTimeWarningMSPropertyName))) { - properties->required(p.maximumCycleTimeWarningMS, + properties->optional(p.maximumCycleTimeWarningMS, maximumCycleTimeWarningMSPropertyName, "maximum cycle time before warning is emitted"); } if (not properties->hasDefinition(makePropertyName(maximumCycleTimeErrorMSPropertyName))) { - properties->required(p.maximumCycleTimeErrorMS, + properties->optional(p.maximumCycleTimeErrorMS, maximumCycleTimeErrorMSPropertyName, "maximum cycle time before error is emitted"); } diff --git a/source/RobotAPI/libraries/RobotAPIComponentPlugins/HeartbeatComponentPlugin.h b/source/RobotAPI/libraries/RobotAPIComponentPlugins/HeartbeatComponentPlugin.h index 7b3654e84562fdbc5386eedb70e86424701592af..8a7f4a42ca0e8a603945535445a0f35abf3110c6 100644 --- a/source/RobotAPI/libraries/RobotAPIComponentPlugins/HeartbeatComponentPlugin.h +++ b/source/RobotAPI/libraries/RobotAPIComponentPlugins/HeartbeatComponentPlugin.h @@ -88,11 +88,7 @@ namespace armarx::plugins void postCreatePropertyDefinitions(PropertyDefinitionsPtr& properties) override; private: - //! heartbeat topic name (outgoing) - RobotHealthInterfacePrx robotHealthTopic; - std::string topicName{"RobotHealthTopic"}; - - RobotHealthComponentInterfacePrx rhprx; + RobotHealthComponentInterfacePrx robotHealthComponentPrx; // static constexpr auto healthPropertyName = "heartbeat.ComponentName"; @@ -103,8 +99,8 @@ namespace armarx::plugins struct Properties { - long maximumCycleTimeWarningMS = 50; - long maximumCycleTimeErrorMS = 100; + long maximumCycleTimeWarningMS = 100; // [ms] + long maximumCycleTimeErrorMS = 200; // [ms] } p; //! default config used in heartbeat(), set via properties