Skip to content
Snippets Groups Projects
Commit a988a5e2 authored by armar-user's avatar armar-user
Browse files

Merge branch 'master' of https://gitlab.com/ArmarX/RobotAPI into armem/ltm/dev

parents b4453830 c3ef194c
No related branches found
No related tags found
1 merge request!226armem/ltm/dev
......@@ -7,92 +7,79 @@
namespace armarx::plugins
{
void
HeartbeatComponentPlugin::configureHeartbeatChannel(const std::string& channel,
const RobotHealthHeartbeatArgs& args)
void HeartbeatComponentPlugin::configureHeartbeatChannel(const std::string& channel,
const RobotHealthHeartbeatArgs& args)
{
channelHeartbeatConfig.emplace(channel, args);
}
void
HeartbeatComponentPlugin::heartbeat()
void HeartbeatComponentPlugin::heartbeat()
{
if (robotHealthTopic)
{
robotHealthTopic->heartbeat(componentName, heartbeatArgs);
}
else
} else
{
ARMARX_WARNING << "No robot health topic available!";
}
}
void
HeartbeatComponentPlugin::heartbeat(const std::string& channel)
void HeartbeatComponentPlugin::heartbeat(const std::string& channel)
{
const auto argsIt = channelHeartbeatConfig.find(channel);
ARMARX_CHECK(argsIt != channelHeartbeatConfig.end())
<< "heartbeat() called for unknown channel '" << channel << "'."
<< "You must register the config using configureHeartbeatChannel(channel) first!";
ARMARX_CHECK(argsIt != channelHeartbeatConfig.end()) << "heartbeat() called for unknown channel '" << channel
<< "'."
<< "You must register the config using configureHeartbeatChannel(channel) first!";
const auto& args = argsIt->second;
if (robotHealthTopic)
{
robotHealthTopic->heartbeat(componentName + "_" + channel, args);
}
else
} else
{
ARMARX_WARNING << "No robot health topic available!";
}
}
void
HeartbeatComponentPlugin::preOnInitComponent()
void HeartbeatComponentPlugin::preOnInitComponent()
{
if (topicName.empty())
{
parent<Component>().getProperty(topicName, makePropertyName(topicPropertyName));
}
parent<Component>().offeringTopic(topicName);
// if (topicName.empty())
// {
// parent<Component>().getProperty(topicName, makePropertyName(topicPropertyName));
// }
// parent<Component>().offeringTopic(topicName);
}
void
HeartbeatComponentPlugin::postOnInitComponent()
void HeartbeatComponentPlugin::postOnInitComponent()
{
}
void
HeartbeatComponentPlugin::preOnConnectComponent()
void HeartbeatComponentPlugin::preOnConnectComponent()
{
robotHealthTopic = parent<Component>().getTopic<RobotHealthInterfacePrx>(topicName);
// robotHealthTopic = parent<Component>().getTopic<RobotHealthInterfacePrx>(topicName);
componentName = parent<Component>().getName();
}
void
HeartbeatComponentPlugin::postCreatePropertyDefinitions(PropertyDefinitionsPtr& properties)
void HeartbeatComponentPlugin::postCreatePropertyDefinitions(PropertyDefinitionsPtr& properties)
{
if (!properties->hasDefinition(makePropertyName(topicPropertyName)))
{
properties->defineOptionalProperty<std::string>(
makePropertyName(topicPropertyName),
"DebugObserver",
"Name of the topic the DebugObserver listens on");
properties->topic(robotHealthTopic, topicName, topicPropertyName,
"Name of the topic the DebugObserver listens on");
}
if (not properties->hasDefinition(makePropertyName(maximumCycleTimeWarningMSPropertyName)))
{
properties->defineRequiredProperty<std::string>(
makePropertyName(maximumCycleTimeWarningMSPropertyName),
"TODO: maximumCycleTimeWarningMS");
properties->required(heartbeatArgs.maximumCycleTimeWarningMS, maximumCycleTimeWarningMSPropertyName,
"maximum cycle time before warning is emitted");
}
if (not properties->hasDefinition(makePropertyName(maximumCycleTimeErrorMSPropertyName)))
{
properties->defineRequiredProperty<std::string>(
makePropertyName(maximumCycleTimeErrorMSPropertyName),
"TODO: maximumCycleTimeErrorMS");
properties->required(heartbeatArgs.maximumCycleTimeErrorMS, maximumCycleTimeErrorMSPropertyName,
"maximum cycle time before error is emitted");
}
}
......
......@@ -66,7 +66,7 @@ namespace armarx::plugins
private:
//! heartbeat topic name (outgoing)
std::string topicName;
std::string topicName{"DebugObserver"};
//! name of this component used as identifier for heartbeats
std::string componentName;
......
......@@ -38,6 +38,11 @@ namespace armarx::filters
int newValue = dataHistory.rbegin()->second->getInt() - initialValue->getInt();
newVariant = new Variant(newValue);
}
else if (type == VariantType::Long)
{
long newValue = dataHistory.rbegin()->second->getLong() - initialValue->getLong();
newVariant = new Variant(newValue);
}
else if (type == VariantType::Float)
{
float newValue = dataHistory.rbegin()->second->getFloat() - initialValue->getFloat();
......@@ -80,6 +85,7 @@ namespace armarx::filters
{
ParameterTypeList result;
result.push_back(VariantType::Int);
result.push_back(VariantType::Long);
result.push_back(VariantType::Float);
result.push_back(VariantType::Double);
result.push_back(VariantType::FramedDirection);
......
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