How can I retrieve a list of process IDs of ROS nodes?
I would like to get the process ID of ROS nodes (preferably by ROS node name). Are there any limitations when getting the pid by ROS node name? Are there any generic patterns which I can refer to?
I thought about "grepping" for "ros" in the ps
listed processes:
ps ax | grep ros
17963 pts/1 Sl+ 0:00 /usr/bin/python /opt/ros/indigo/bin/roscore
17975 ? Ssl 0:00 /usr/bin/python /opt/ros/indigo/bin/rosmaster --core -p 11311 -w 3 __log:=/home/kromer/.ros/log/9db6e284-a466-11e7-b8cd-28f10e310550/master.log
17988 ? Ssl 0:00 /opt/ros/indigo/lib/rosout/rosout __name:=rosout __log:=/home/kromer/.ros/log/9db6e284-a466-11e7-b8cd-28f10e310550/rosout-1.log
18007 pts/16 S+ 0:00 grep --color=auto ros
... or using pgrep
to get the pid by ROS node name:
pgrep roscore
17963
pgrep rosmaster
17975
pgrep rosout
17988
(top
and htop
seemed not suitable.)
Note btw that this is a classic xy-problem: you ask "how to identify ROS node processes", but you really just want to retrieve of list of PIDs of ROS nodes.
That's true, thanks for that hint.
are you looking for the "system" ros nodes (roscore, etc.) or are you looking for ros nodes that users (including yourself) have compiled and started on your machine?
I am looking primarily for ROS nodes that users are running... not on my machine but on a remote machine.
@Kurt Leucht: small nitpick: afaik,
roscore
is not considered a node.Good to know. Thanks.
There are not elfin_joint_controller_spawner spawned nodes. Is it a bug?
Did you post this under the right question?