Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
RobotAPI
Commits
4a674296
Commit
4a674296
authored
1 year ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
changes likely by FPK. Getting rid of IceUtil::Time
parent
27d3928e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!374
Feature/robot health updates
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/RobotAPI/components/RobotHealth/RobotHealthDummy.cpp
+23
-14
23 additions, 14 deletions
source/RobotAPI/components/RobotHealth/RobotHealthDummy.cpp
source/RobotAPI/components/RobotHealth/RobotHealthDummy.h
+1
-1
1 addition, 1 deletion
source/RobotAPI/components/RobotHealth/RobotHealthDummy.h
with
24 additions
and
15 deletions
source/RobotAPI/components/RobotHealth/RobotHealthDummy.cpp
+
23
−
14
View file @
4a674296
...
...
@@ -80,7 +80,7 @@ namespace armarx
}
void
RobotHealthDummy
::
busy
d
wait
(
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
...
...
This diff is collapsed.
Click to expand it.
source/RobotAPI/components/RobotHealth/RobotHealthDummy.h
+
1
−
1
View file @
4a674296
...
...
@@ -78,7 +78,7 @@ namespace armarx
int
NanoSleep
(
long
nanosec
);
void
yieldwait
(
long
microseconds
);
void
busy
d
wait
(
long
microseconds
);
void
busywait
(
long
microseconds
);
void
sleepwait
(
long
microseconds
);
protected
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment