Skip to content

Commit

Permalink
add debug notice that prints LifecycleNode is not shutdown in dtor.
Browse files Browse the repository at this point in the history
  Currently it is user application responsibility to manage the all state control.
  See more details for #2520.

Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
  • Loading branch information
fujitatomoya committed Jun 12, 2024
1 parent c01aaf5 commit 9dd396b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rclcpp_lifecycle/src/lifecycle_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@ LifecycleNode::LifecycleNode(

LifecycleNode::~LifecycleNode()
{
auto current_state = LifecycleNode::get_current_state().id();
if (current_state != lifecycle_msgs::msg::State::PRIMARY_STATE_FINALIZED) {
// This might be leaveing sensors and devices without shutting down unintentionally.
// It is user's responsibility to call shutdown to avoid leaving them unknow states.
RCLCPP_DEBUG(
rclcpp::get_logger("rclcpp_lifecycle"),
"LifecycleNode is not shut down: Node still in state(%u) in destructor",
current_state);
}

// release sub-interfaces in an order that allows them to consult with node_base during tear-down
node_waitables_.reset();
node_type_descriptions_.reset();
Expand Down

0 comments on commit 9dd396b

Please sign in to comment.