Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wolf_ros_node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_ros
wolf_ros_node
Commits
52ea5123
Commit
52ea5123
authored
4 years ago
by
Joaquim Casals Buñuel
Browse files
Options
Downloads
Patches
Plain Diff
WIP
parent
b9677075
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/node.h
+2
-0
2 additions, 0 deletions
include/node.h
src/node.cpp
+24
-9
24 additions, 9 deletions
src/node.cpp
with
26 additions
and
9 deletions
include/node.h
+
2
−
0
View file @
52ea5123
...
...
@@ -82,9 +82,11 @@ class WolfRosNode
void
solve
();
void
solveLoop
();
void
broadcastTf
();
void
visualize
();
void
visualizeLoop
();
bool
updateTf
();
};
This diff is collapsed.
Click to expand it.
src/node.cpp
+
24
−
9
View file @
52ea5123
...
...
@@ -179,6 +179,7 @@ void WolfRosNode::solveLoop()
{
ros
::
Rate
solverRate
(
1
/
solver_
->
getPeriod
());
WOLF_DEBUG
(
"Started solver loop"
);
WOLF_TRACE
(
"HI SOLVER"
);
while
(
ros
::
ok
())
{
...
...
@@ -191,6 +192,27 @@ void WolfRosNode::solveLoop()
solverRate
.
sleep
();
}
WOLF_DEBUG
(
"Solver loop finished"
);
WOLF_TRACE
(
"BYE SOLVER"
);
}
void
WolfRosNode
::
visualizeLoop
()
{
ros
::
Rate
visualizerRate
(
1
/
viz_period_
);
// visualize periodically
WOLF_DEBUG
(
"Started visualize loop"
);
WOLF_TRACE
(
"HI VISUALIZE"
);
while
(
ros
::
ok
())
{
visualize
();
if
(
ros
::
isShuttingDown
())
break
;
// relax to fit output rate
visualizerRate
.
sleep
();
}
WOLF_DEBUG
(
"Visualize loop finished"
);
WOLF_TRACE
(
"BYE VISUALIZE"
);
}
int
main
(
int
argc
,
char
**
argv
)
...
...
@@ -208,6 +230,8 @@ int main(int argc, char **argv)
// Solver thread
std
::
thread
solver_thread
(
&
WolfRosNode
::
solveLoop
,
&
wolf_node
);
// Visualizer thread
std
::
thread
visualizer_thread
(
&
WolfRosNode
::
visualizeLoop
,
&
wolf_node
);
while
(
ros
::
ok
())
{
...
...
@@ -215,15 +239,6 @@ int main(int argc, char **argv)
wolf_node
.
updateTf
();
wolf_node
.
broadcastTf
();
// visualize periodically
auto
start3
=
std
::
chrono
::
high_resolution_clock
::
now
();
if
((
ros
::
Time
::
now
()
-
last_viz_time
).
toSec
()
>=
wolf_node
.
viz_period_
)
{
std
::
cout
<<
"Last Viz since/viz_period_ "
<<
(
ros
::
Time
::
now
()
-
last_viz_time
).
toSec
()
<<
" / "
<<
wolf_node
.
viz_period_
<<
std
::
endl
;
wolf_node
.
visualize
();
last_viz_time
=
ros
::
Time
::
now
();
}
// publish periodically
for
(
auto
pub
:
wolf_node
.
publishers_
)
if
(
pub
->
ready
())
...
...
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