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
b65131fd
Commit
b65131fd
authored
5 years ago
by
Francisco Martin Rico
Browse files
Options
Downloads
Patches
Plain Diff
Explicit way of specifying the order for bringing up or shutting down the nodes
Signed-off-by:
Francisco Martin Rico
<
fmrico@gmail.com
>
parent
f798cc21
No related branches found
Branches containing commit
No related tags found
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
+9
-8
9 additions, 8 deletions
nav2_lifecycle_manager/src/lifecycle_manager.cpp
with
10 additions
and
9 deletions
nav2_lifecycle_manager/include/nav2_lifecycle_manager/lifecycle_manager.hpp
+
1
−
1
View file @
b65131fd
...
...
@@ -129,7 +129,7 @@ protected:
/**
* @brief For each node in the map, transition to the new target state
*/
bool
changeStateForAllNodes
(
std
::
uint8_t
transition
,
bool
reverse_order
=
false
);
bool
changeStateForAllNodes
(
std
::
uint8_t
transition
);
// Convenience function to highlight the output on the console
/**
...
...
This diff is collapsed.
Click to expand it.
nav2_lifecycle_manager/src/lifecycle_manager.cpp
+
9
−
8
View file @
b65131fd
...
...
@@ -153,9 +153,11 @@ LifecycleManager::changeStateForNode(const std::string & node_name, std::uint8_t
}
bool
LifecycleManager
::
changeStateForAllNodes
(
std
::
uint8_t
transition
,
bool
reverse_order
)
LifecycleManager
::
changeStateForAllNodes
(
std
::
uint8_t
transition
)
{
if
(
!
reverse_order
)
{
if
(
transition
==
Transition
::
TRANSITION_CONFIGURE
||
transition
==
Transition
::
TRANSITION_ACTIVATE
)
{
for
(
auto
&
node_name
:
node_names_
)
{
if
(
!
changeStateForNode
(
node_name
,
transition
))
{
return
false
;
...
...
@@ -169,7 +171,6 @@ LifecycleManager::changeStateForAllNodes(std::uint8_t transition, bool reverse_o
}
}
}
return
true
;
}
...
...
@@ -177,9 +178,9 @@ void
LifecycleManager
::
shutdownAllNodes
()
{
message
(
"Deactivate, cleanup, and shutdown nodes"
);
changeStateForAllNodes
(
Transition
::
TRANSITION_DEACTIVATE
,
true
);
changeStateForAllNodes
(
Transition
::
TRANSITION_CLEANUP
,
true
);
changeStateForAllNodes
(
Transition
::
TRANSITION_UNCONFIGURED_SHUTDOWN
,
true
);
changeStateForAllNodes
(
Transition
::
TRANSITION_DEACTIVATE
);
changeStateForAllNodes
(
Transition
::
TRANSITION_CLEANUP
);
changeStateForAllNodes
(
Transition
::
TRANSITION_UNCONFIGURED_SHUTDOWN
);
}
bool
...
...
@@ -213,8 +214,8 @@ LifecycleManager::reset()
{
message
(
"Resetting managed nodes..."
);
// Should transition in reverse order
if
(
!
changeStateForAllNodes
(
Transition
::
TRANSITION_DEACTIVATE
,
true
)
||
!
changeStateForAllNodes
(
Transition
::
TRANSITION_CLEANUP
,
true
))
if
(
!
changeStateForAllNodes
(
Transition
::
TRANSITION_DEACTIVATE
)
||
!
changeStateForAllNodes
(
Transition
::
TRANSITION_CLEANUP
))
{
RCLCPP_ERROR
(
get_logger
(),
"Failed to reset nodes: aborting reset"
);
return
false
;
...
...
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