How can I kill a ros2 node with rclpy?
Hi, I have a launch file that launches 3 ROS2 nodes and the nodes are wrote using rclpy. Now, I'm planning to write a service call that will kill 2 of those nodes. After doing some research, I found something called "lifecycle Node", but as far as I know "lifecycle" still only supports C++ (according to the outlook https://github.com/ros2/demos/blob/fo...).
I did found a hacky way (https://answers.ros.org/question/3781...) but I'm not confident with that approach.
So, my questions are: 1) Is there any other way I can kill the ROS2 node other than using pressing ctrl+c and lifecycle node? 2) How can I do the killing of a node properly in rclpy?
I'm using OS=Linux 20.04 LTS | ROS_DISTRO=Foxy | ROS_PYTHON_VERSION=3
Please specify how to use os to find the node's names and PID numbers?