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

changes likely by FPK. Getting rid of IceUtil::Time

parent 27d3928e
No related branches found
No related tags found
1 merge request!374Feature/robot health updates
......@@ -80,7 +80,7 @@ namespace armarx
}
void
RobotHealthDummy::busydwait(long microseconds)
RobotHealthDummy::busywait(long microseconds)
{
long start = TimeUtil::GetTime().toMicroSeconds();
auto end = start + microseconds;
......@@ -95,51 +95,60 @@ namespace armarx
{
auto args = RobotHealthHeartbeatArgs();
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);
ARMARX_INFO << "starting rinning task";
while (!dummyTask->isStopped())
{
long beforeTopicCall = TimeUtil::GetTime().toMicroSeconds();
auto beforeTopicCall = armarx::core::time::DateTime::Now();
//ARMARX_INFO << "send heartbeat";
armarx::core::time::dto::DateTime now;
armarx::core::time::toIce(now, armarx::core::time::DateTime::Now());
robotHealthTopicPrx->heartbeat(getName(), now);
long afterTopicCall = TimeUtil::GetTime().toMicroSeconds();
auto afterTopicCall = armarx::core::time::DateTime::Now();
if (sleepmode == "nanosleep")
{
NanoSleep(10 * 1000 * 1000);
NanoSleep(10 * 1000 * 1000); // wait 10 milliseconds
}
else if (sleepmode == "sleepwait")
{
sleepwait(10 * 1000);
sleepwait(10 * 1000); // wait 10 milliseconds
}
else if (sleepmode == "yieldwait")
{
yieldwait(10 * 1000);
yieldwait(10 * 1000); // wait 10 milliseconds
}
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
{
throw LocalException("Unknown sleepmode.");
}
long afterSleep = TimeUtil::GetTime().toMicroSeconds();
long topicCallDelay = afterTopicCall - beforeTopicCall;
long sleepDelay = afterSleep - afterTopicCall;
if (sleepDelay > 20000)
auto afterSleep = armarx::core::time::DateTime::Now();
auto topicCallDelay = afterTopicCall - beforeTopicCall;
auto sleepDelay = afterSleep - afterTopicCall;
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
......
......@@ -78,7 +78,7 @@ namespace armarx
int NanoSleep(long nanosec);
void yieldwait(long microseconds);
void busydwait(long microseconds);
void busywait(long microseconds);
void sleepwait(long microseconds);
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