ros2 / rclcpp

rclcpp (ROS Client Library for C++)
Apache License 2.0
536 stars 417 forks source link

call shutdown in LifecycleNode dtor to avoid leaving the device in un… #2450

Closed fujitatomoya closed 6 months ago

fujitatomoya commented 6 months ago

…known state.

address https://github.com/ros2/rclcpp/issues/997

fujitatomoya commented 6 months ago

@Barry-Xu-2018 @alsora could you take a look as 1st review?

Barry-Xu-2018 commented 6 months ago

I agree with adding tests for destructing LifecycleNode under different states of lifecycle node. However, the code added in this PR indeed is difficult to check by tests.

Maybe we should register a callback function (register_on_shutdown) in the tests to confirm that the state transitions to 'Finalized' when LifecycleNode is destructed.

fujitatomoya commented 6 months ago

@alsora requesting another review! thanks in advance.

alsora commented 6 months ago
alsora commented 6 months ago

Running Linux CI again. The previous failure seems unrelated.

fujitatomoya commented 6 months ago

@Mergifyio backport iron humble

mergify[bot] commented 6 months ago

backport iron humble

✅ Backports have been created

* [#2490 call shutdown in LifecycleNode dtor to avoid leaving the device in un… (backport #2450)](https://github.com/ros2/rclcpp/pull/2490) has been created for branch `iron` * [#2491 call shutdown in LifecycleNode dtor to avoid leaving the device in un… (backport #2450)](https://github.com/ros2/rclcpp/pull/2491) has been created for branch `humble`