ROS2 lifecycle node - how to shut down cleanly?

asked 2020-02-10 11:38:12 -0600

wieset gravatar image

updated 2020-02-18 08:17:17 -0600

I am trying to implement a ROS2 lifecycle node that takes the shutdown transition when exiting via CTRL-C.

The shutdown transition in the lifecycle node state machine does not get called automatically when exiting. Thus, I am trying to find a way to call shutdown() on the lifecycle node when CTRL-C is pressed to get it to the finalized state before exiting.

Thanks for any help!

edit retag flag offensive close merge delete

Comments

I am also looking for the answer to this question. Anyone has any idea to kill a node?

frpunzalan gravatar image frpunzalan  ( 2020-03-23 22:09:02 -0600 )edit
1

This was a look at my best attempt, I never got it fully working https://github.com/SteveMacenski/ros2... but hopefully can give you a hint and report back if you make a breakthrough!

stevemacenski gravatar image stevemacenski  ( 2020-03-23 22:59:02 -0600 )edit

Do you guys have any way to catch the finalized state when lifecycle_node crash? Thanks for help!

kangleorc gravatar image kangleorc  ( 2020-09-27 02:43:53 -0600 )edit