Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
210910794
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2021
210910794
Commits
f955a04c
Commit
f955a04c
authored
5 years ago
by
bpwilcox
Browse files
Options
Downloads
Patches
Plain Diff
reverse order of shutdown nodes
shutdown nodes in reverse order of bringup
parent
ea39ef2b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nav2_lifecycle_manager/include/nav2_lifecycle_manager/lifecycle_manager.hpp
+1
-1
1 addition, 1 deletion
...ager/include/nav2_lifecycle_manager/lifecycle_manager.hpp
nav2_lifecycle_manager/src/lifecycle_manager.cpp
+16
-7
16 additions, 7 deletions
nav2_lifecycle_manager/src/lifecycle_manager.cpp
with
17 additions
and
8 deletions
nav2_lifecycle_manager/include/nav2_lifecycle_manager/lifecycle_manager.hpp
+
1
−
1
View file @
f955a04c
...
...
@@ -67,7 +67,7 @@ protected:
bool
changeStateForNode
(
const
std
::
string
&
node_name
,
std
::
uint8_t
transition
);
// For each node in the map, transition to the new target state
bool
changeStateForAllNodes
(
std
::
uint8_t
transition
);
bool
changeStateForAllNodes
(
std
::
uint8_t
transition
,
bool
reverse_order
=
false
);
// Convenience function to highlight the output on the console
void
message
(
const
std
::
string
&
msg
);
...
...
This diff is collapsed.
Click to expand it.
nav2_lifecycle_manager/src/lifecycle_manager.cpp
+
16
−
7
View file @
f955a04c
...
...
@@ -126,11 +126,20 @@ LifecycleManager::changeStateForNode(const std::string & node_name, std::uint8_t
}
bool
LifecycleManager
::
changeStateForAllNodes
(
std
::
uint8_t
transition
)
LifecycleManager
::
changeStateForAllNodes
(
std
::
uint8_t
transition
,
bool
reverse_order
)
{
for
(
const
auto
&
kv
:
node_map_
)
{
if
(
!
changeStateForNode
(
kv
.
first
,
transition
))
{
return
false
;
if
(
!
reverse_order
)
{
for
(
auto
&
node_name
:
node_names_
)
{
if
(
!
changeStateForNode
(
node_name
,
transition
))
{
return
false
;
}
}
}
else
{
std
::
vector
<
std
::
string
>::
reverse_iterator
rit
;
for
(
rit
=
node_names_
.
rbegin
();
rit
!=
node_names_
.
rend
();
++
rit
)
{
if
(
!
changeStateForNode
(
*
rit
,
transition
))
{
return
false
;
}
}
}
...
...
@@ -154,9 +163,9 @@ void
LifecycleManager
::
shutdownAllNodes
()
{
message
(
"Deactivate, cleanup, and shutdown nodes"
);
changeStateForAllNodes
(
Transition
::
TRANSITION_DEACTIVATE
);
changeStateForAllNodes
(
Transition
::
TRANSITION_CLEANUP
);
changeStateForAllNodes
(
Transition
::
TRANSITION_UNCONFIGURED_SHUTDOWN
);
changeStateForAllNodes
(
Transition
::
TRANSITION_DEACTIVATE
,
true
);
changeStateForAllNodes
(
Transition
::
TRANSITION_CLEANUP
,
true
);
changeStateForAllNodes
(
Transition
::
TRANSITION_UNCONFIGURED_SHUTDOWN
,
true
);
}
void
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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