Skip to content
Snippets Groups Projects
Commit de5c9678 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Merge branch 'feature/robot-health-updates' into 'master'

Feature/robot health updates

See merge request !374
parents 160a1e0d 586e20c3
No related branches found
No related tags found
1 merge request!374Feature/robot health updates
Pipeline #12054 passed
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<scenario name="RobotHealthTest" creation="2018-11-30.11:42:03" globalConfigName="./config/global.cfg" package="RobotAPI" deploymentType="local" nodeName="NodeMain"> <scenario name="RobotHealthTest" creation="2018-11-30.11:42:03" globalConfigName="./config/global.cfg" package="RobotAPI" deploymentType="local" nodeName="NodeMain">
<application name="RobotHealthApp" instance="" package="RobotAPI" nodeName="" enabled="true" iceAutoRestart="false"/> <application name="RobotHealthApp" instance="" package="RobotAPI" nodeName="" enabled="false" iceAutoRestart="false"/>
<application name="RobotHealthDummyApp" instance="HealthDummy1" package="RobotAPI" nodeName="" enabled="true" iceAutoRestart="false"/> <application name="RobotHealthDummyApp" instance="HealthDummy1" package="RobotAPI" nodeName="" enabled="true" iceAutoRestart="false"/>
<application name="RobotHealthDummyApp" instance="HealthDummy2" package="RobotAPI" nodeName="" enabled="true" iceAutoRestart="false"/> <application name="RobotHealthDummyApp" instance="HealthDummy2" package="RobotAPI" nodeName="" enabled="true" iceAutoRestart="false"/>
</scenario> </scenario>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# ArmarX.ApplicationName = "" # ArmarX.ApplicationName = ""
# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_USER_CONFIG_DIR is set, the cache path will be made relative to ARMARX_USER_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${HOME}/.armarx) # ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_CONFIG_DIR is set, the cache path will be made relative to ARMARX_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${ARMARX_WORKSPACE}/armarx_config)
# Attributes: # Attributes:
# - Default: mongo/.cache # - Default: mongo/.cache
# - Case sensitivity: yes # - Case sensitivity: yes
...@@ -109,20 +109,12 @@ ...@@ -109,20 +109,12 @@
# ArmarX.RemoteHandlesDeletionTimeout = 3000 # ArmarX.RemoteHandlesDeletionTimeout = 3000
# ArmarX.RobotHealth.AggregatedRobotHealthTopicName: Name of the AggregatedRobotHealthTopic # ArmarX.RobotHealth.DebugObserverTopicName: Name of the topic the DebugObserver listens on
# Attributes: # Attributes:
# - Default: AggregatedRobotHealthTopic # - Default: DebugObserver
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.RobotHealth.AggregatedRobotHealthTopicName = AggregatedRobotHealthTopic # ArmarX.RobotHealth.DebugObserverTopicName = DebugObserver
# ArmarX.RobotHealth.EmergencyStopTopicName: The name of the topic over which changes of the emergencyStopState are sent.
# Attributes:
# - Default: EmergencyStop
# - Case sensitivity: yes
# - Required: no
# ArmarX.RobotHealth.EmergencyStopTopicName = EmergencyStop
# ArmarX.RobotHealth.EnableProfiling: enable profiler which is used for logging performance events # ArmarX.RobotHealth.EnableProfiling: enable profiler which is used for logging performance events
...@@ -159,37 +151,36 @@ ...@@ -159,37 +151,36 @@
# ArmarX.RobotHealth.MinimumLoggingLevel = Undefined # ArmarX.RobotHealth.MinimumLoggingLevel = Undefined
# ArmarX.RobotHealth.ObjectName: Name of IceGrid well-known object # ArmarX.RobotHealth.Name of the AggregatedRobotHealthTopic: Name of the `AggregatedRobotHealth` topic to publish data to.
# Attributes: # Attributes:
# - Default: "" # - Default: AggregatedRobotHealthTopic
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.RobotHealth.ObjectName = "" # ArmarX.RobotHealth.Name of the AggregatedRobotHealthTopic = AggregatedRobotHealthTopic
# ArmarX.RobotHealth.ReportErrorsWithSpeech: # ArmarX.RobotHealth.ObjectName: Name of IceGrid well-known object
# Attributes: # Attributes:
# - Default: true # - Default: ""
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# - Possible values: {0, 1, false, no, true, yes} # ArmarX.RobotHealth.ObjectName = ""
# ArmarX.RobotHealth.ReportErrorsWithSpeech = true
# ArmarX.RobotHealth.RequiredComponents: Comma separated list of required components # ArmarX.RobotHealth.RequiredTags: Tags that should be requested.
# Attributes: # Attributes:
# - Default: "" # - Default: ""
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.RobotHealth.RequiredComponents = "" # ArmarX.RobotHealth.RequiredTags = ""
# ArmarX.RobotHealth.RobotHealthTopicName: Name of the RobotHealth topic # ArmarX.RobotHealth.RobotHealthTopic: Name of the RobotHealth topic
# Attributes: # Attributes:
# - Default: RobotHealthTopic # - Default: RobotHealthTopic
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.RobotHealth.RobotHealthTopicName = RobotHealthTopic # ArmarX.RobotHealth.RobotHealthTopic = RobotHealthTopic
# ArmarX.RobotHealth.RobotUnitName: No Description # ArmarX.RobotHealth.RobotUnitName: No Description
...@@ -208,20 +199,12 @@ ArmarX.RobotHealth.RobotUnitName = RobotUnitSimulation ...@@ -208,20 +199,12 @@ ArmarX.RobotHealth.RobotUnitName = RobotUnitSimulation
ArmarX.RobotHealth.RobotUnitRequired = 0 ArmarX.RobotHealth.RobotUnitRequired = 0
# ArmarX.RobotHealth.SpeechMinimumReportInterval: Time that has to pass between reported messages in seconds. # ArmarX.RobotHealth.The name of the topic over which changes of the emergencyStopState are sent.: Name of the `EmergencyStop` topic to publish data to.
# Attributes: # Attributes:
# - Default: 60 # - Default: EmergencyStop
# - Case sensitivity: yes
# - Required: no
# ArmarX.RobotHealth.SpeechMinimumReportInterval = 60
# ArmarX.RobotHealth.TextToSpeechTopicName: Name of the TextToSpeech topic
# Attributes:
# - Default: TextToSpeech
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.RobotHealth.TextToSpeechTopicName = TextToSpeech # ArmarX.RobotHealth.The name of the topic over which changes of the emergencyStopState are sent. = EmergencyStop
# ArmarX.SecondsStartupDelay: The startup will be delayed by this number of seconds (useful for debugging) # ArmarX.SecondsStartupDelay: The startup will be delayed by this number of seconds (useful for debugging)
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# ArmarX.ApplicationName = "" # ArmarX.ApplicationName = ""
# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_USER_CONFIG_DIR is set, the cache path will be made relative to ARMARX_USER_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${HOME}/.armarx) # ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_CONFIG_DIR is set, the cache path will be made relative to ARMARX_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${ARMARX_WORKSPACE}/armarx_config)
# Attributes: # Attributes:
# - Default: mongo/.cache # - Default: mongo/.cache
# - Case sensitivity: yes # - Case sensitivity: yes
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# ArmarX.ApplicationName = "" # ArmarX.ApplicationName = ""
# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_USER_CONFIG_DIR is set, the cache path will be made relative to ARMARX_USER_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${HOME}/.armarx) # ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_CONFIG_DIR is set, the cache path will be made relative to ARMARX_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${ARMARX_WORKSPACE}/armarx_config)
# Attributes: # Attributes:
# - Default: mongo/.cache # - Default: mongo/.cache
# - Case sensitivity: yes # - Case sensitivity: yes
...@@ -148,7 +148,7 @@ ArmarX.RobotHealthDummy.ObjectName = HealthDummy2 ...@@ -148,7 +148,7 @@ ArmarX.RobotHealthDummy.ObjectName = HealthDummy2
# - Default: nanosleep # - Default: nanosleep
# - Case sensitivity: yes # - Case sensitivity: yes
# - Required: no # - Required: no
# ArmarX.RobotHealthDummy.SleepMode = nanosleep ArmarX.RobotHealthDummy.SleepMode = std::this_thread::sleep_for
# ArmarX.SecondsStartupDelay: The startup will be delayed by this number of seconds (useful for debugging) # ArmarX.SecondsStartupDelay: The startup will be delayed by this number of seconds (useful for debugging)
......
...@@ -80,7 +80,7 @@ namespace armarx ...@@ -80,7 +80,7 @@ namespace armarx
} }
void void
RobotHealthDummy::busydwait(long microseconds) RobotHealthDummy::busywait(long microseconds)
{ {
long start = TimeUtil::GetTime().toMicroSeconds(); long start = TimeUtil::GetTime().toMicroSeconds();
auto end = start + microseconds; auto end = start + microseconds;
...@@ -95,51 +95,60 @@ namespace armarx ...@@ -95,51 +95,60 @@ namespace armarx
{ {
auto args = RobotHealthHeartbeatArgs(); auto args = RobotHealthHeartbeatArgs();
args.identifier = getName(); args.identifier = getName();
armarx::core::time::toIce(args.maximumCycleTimeError, armarx::core::time::Duration::MilliSeconds(1000));
armarx::core::time::toIce(args.maximumCycleTimeWarning, armarx::core::time::Duration::MilliSeconds(500));
robotHealthTopicPrx->signUp(args); robotHealthTopicPrx->signUp(args);
ARMARX_INFO << "starting rinning task"; ARMARX_INFO << "starting rinning task";
while (!dummyTask->isStopped()) while (!dummyTask->isStopped())
{ {
long beforeTopicCall = TimeUtil::GetTime().toMicroSeconds(); auto beforeTopicCall = armarx::core::time::DateTime::Now();
//ARMARX_INFO << "send heartbeat"; //ARMARX_INFO << "send heartbeat";
armarx::core::time::dto::DateTime now; armarx::core::time::dto::DateTime now;
armarx::core::time::toIce(now, armarx::core::time::DateTime::Now()); armarx::core::time::toIce(now, armarx::core::time::DateTime::Now());
robotHealthTopicPrx->heartbeat(getName(), now); robotHealthTopicPrx->heartbeat(getName(), now);
long afterTopicCall = TimeUtil::GetTime().toMicroSeconds(); auto afterTopicCall = armarx::core::time::DateTime::Now();
if (sleepmode == "nanosleep") if (sleepmode == "nanosleep")
{ {
NanoSleep(10 * 1000 * 1000); NanoSleep(10 * 1000 * 1000); // wait 10 milliseconds
} }
else if (sleepmode == "sleepwait") else if (sleepmode == "sleepwait")
{ {
sleepwait(10 * 1000); sleepwait(10 * 1000); // wait 10 milliseconds
} }
else if (sleepmode == "yieldwait") else if (sleepmode == "yieldwait")
{ {
yieldwait(10 * 1000); yieldwait(10 * 1000); // wait 10 milliseconds
} }
else if (sleepmode == "busywait") else if (sleepmode == "busywait")
{ {
busydwait(10 * 1000); busywait(10 * 1000); // wait 10 milliseconds
}
else if (sleepmode == "std::this_thread::sleep_for")
{
std::this_thread::sleep_for(std::chrono::microseconds(10 * 1000));
} }
else else
{ {
throw LocalException("Unknown sleepmode."); throw LocalException("Unknown sleepmode.");
} }
long afterSleep = TimeUtil::GetTime().toMicroSeconds(); auto afterSleep = armarx::core::time::DateTime::Now();
long topicCallDelay = afterTopicCall - beforeTopicCall; auto topicCallDelay = afterTopicCall - beforeTopicCall;
long sleepDelay = afterSleep - afterTopicCall; auto sleepDelay = afterSleep - afterTopicCall;
if (sleepDelay > 20000) if (sleepDelay.toMicroSeconds() > 20000)
{ {
ARMARX_IMPORTANT << sleepmode << ": " << sleepDelay << "us"; ARMARX_IMPORTANT << sleepmode << " took long: " << sleepDelay << "us";
} }
if (topicCallDelay > 1000) if (topicCallDelay.toMicroSeconds() > 1000)
{ {
ARMARX_IMPORTANT << "topic: " << topicCallDelay << "us"; ARMARX_IMPORTANT << "topic took long: " << topicCallDelay << "us";
} }
} }
robotHealthTopicPrx->unregister(args.identifier);
} }
void void
......
...@@ -78,7 +78,7 @@ namespace armarx ...@@ -78,7 +78,7 @@ namespace armarx
int NanoSleep(long nanosec); int NanoSleep(long nanosec);
void yieldwait(long microseconds); void yieldwait(long microseconds);
void busydwait(long microseconds); void busywait(long microseconds);
void sleepwait(long microseconds); void sleepwait(long microseconds);
protected: protected:
......
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