[SOLVED] [ROS2 humble linux] Wait until a node has been destroyed in launch_testing
Hello. This is what I am trying to do:
- Create a lifecycle-managed C++ node using launch_testing
- Perform a test on the node
- Stop the node
- Wait until the node has been destroyed
- Exit the test
My question is: how would you approach problem 4.?
Here is what I came up with:
inside the node under test:
LifecycleNodeInterface::CallbackReturn on_shutdown(const rclcpp_lifecycle::State& state) { RCLCPP_INFO(get_logger(), "on shutdown() is called from state %s.", state.label().c_str()); std::raise(SIGINT); return LifecycleNode::on_shutdown(state); }
inside the test routine:
proc_info.assertWaitForShutdown(process=node, timeout=60)
This is working somehow but it is ugly as hell. Why should I manually raise SIGINT just to destroy a node?
I have tried to use theTRANSITION_DESTROY
but run into this bug.