How to kill nodes in ROS2?
In ROS we have rosnode kill -a
. Do we have something like this in ROS2?
I tried ros2 node kill
, but it didn't work.
I am using Ubuntu 18.04 LTS | ROS2 Crystal | Gazebo 9.
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
In ROS we have rosnode kill -a
. Do we have something like this in ROS2?
I tried ros2 node kill
, but it didn't work.
I am using Ubuntu 18.04 LTS | ROS2 Crystal | Gazebo 9.
Afaik there is no rosnode kill
in ROS 2.
ROS 2 introduces the concept of managed nodes, which have a node lifecycle (ROS2 Design: Managed nodes).
With nodes that support it you can then use
ros2 lifecycle set <nodename> shutdown
which should make the node with name nodename
transition to its shutdown state and consequently shutdown the process.
Nothing has really changed since May 2019 when you answered this question?
well, 'nothing' is a bit strong, but I don't believe there is a "kill node" command in ROS 2 in general, and I doubt it will ever be added.
See the rationale added by @William.
Killing nodes is process management, which is something the OS does best. ROS should not duplicate that (unloading components is something else).
in order to kill a node that is not a lifecycle node, i have used the killall command, $killall "name_of_the_node" the name of the node is the one you use to launch the node and not the one you see after running $ros2 node list example: start: $ros2 run may_package my_node stop: $killall my_node
Asked: 2019-05-16 06:02:43 -0500
Seen: 24,181 times
Last updated: May 16 '19
Kill python nodes in ROS2 Galactic
URDF models for all ROS Robots
how to organize data transfer between nodes on multiple PCs on ROS2
robot slips after upgrade to kinetic
Catkin_Make problem with ubuntu 20
start rviz2 failed in the docker container for jetson agx xavier
ROS2 topic echo Selected field
Which options are available for output in a ros2 Node launch action?