Skip to content
Snippets Groups Projects
Commit 7e88f0dc authored by Your Name's avatar Your Name
Browse files

replacing topic by proxy call (already available); fixing property defs

parent 28c437b3
No related branches found
No related tags found
1 merge request!353Feature/robot health update
......@@ -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");
}
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment