Robotics StackExchange | Archived questions

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!

Asked by wieset on 2020-02-10 12:38:12 UTC

Comments

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

Asked by frpunzalan on 2020-03-23 22:09:02 UTC

This was a look at my best attempt, I never got it fully working https://github.com/SteveMacenski/ros2_ouster_drivers/blob/eloquent-devel/ros2_ouster/launch/os1_launch.py#L74 but hopefully can give you a hint and report back if you make a breakthrough!

Asked by stevemacenski on 2020-03-23 22:59:02 UTC

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

Asked by kangleorc on 2020-09-27 02:43:53 UTC

Answers