ROS2 lifecycle node - how to shut down cleanly?
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!
I am also looking for the answer to this question. Anyone has any idea to kill a node?
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!
Do you guys have any way to catch the finalized state when lifecycle_node crash? Thanks for help!