理论:
测试运行:roscore -p 1234 ... logging to /home/xuting/.ros/log/7e20e3fe-a0be-11e6-ae70-00150064e94c/roslaunch-ubuntu-710.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
WARNING: disk usage in log directory [/home/xuting/.ros/log] is over 1GB.
It's recommended that you use the 'rosclean' command.
started roslaunch server http://192.168.8.109:39086/
ros_comm version 1.11.16
SUMMARY
========
PARAMETERS
* /rosdistro: indigo
* /rosversion: 1.11.16
NODES
WARNING: ROS_MASTER_URI port [11311] does not match this roscore [1234]
auto-starting new master
process[master]: started with pid [724]
ROS_MASTER_URI=http://192.168.8.109:1234/
setting /run_id to 7e20e3fe-a0be-11e6-ae70-00150064e94c
process[rosout-1]: started with pid [737]
started core service [/rosout]
显示进程:
xuting 1309 0.3 0.2 296472 23404 pts/0 Sl+ 13:48 0:01 /usr/bin/python /opt/ros/indigo/bin/roscore
xuting 1322 0.3 0.2 430128 21332 ? Ssl 13:48 0:01 /usr/bin/python /opt/ros/indigo/bin/rosmaster --core -p 11311 -w 3 __log:=/home/xuting/.ros/log/02b0383a-a0c0-11e6-aaa5-00150064e94c/master.log
xuting 1348 0.1 0.1 259500 10188 ? Ssl 13:48 0:00 /opt/ros/indigo/lib/rosout/rosout __name:=rosout __log:=/home/xuting/.ros/log/02b0383a-a0c0-11e6-aaa5-00150064e94c/rosout-1.log
xuting 1604 0.0 0.0 15956 2496 pts/13 S+ 13:53 0:00 grep --color=auto ros
xuting@ubuntu:~$ rosnode list /rosout 这里只有rosout,无他. 也就是说存在这样的进程roscore,rosmaster但不作为node进行显示.
找到配置文件: The nodes launched as part of roscore are defined in roslaunch/roscore.xml.
It will also automatically be launched part of any roslaunch process if roslaunch detects that it is not running.
roslaunch treats nodes listed in roscore.xml differently: it searches for nodes running with the same name and will only launch ones that aren't already running.
xuting@ubuntu:/opt/ros/indigo/share/roslaunch$ cat resources/roscore.xml <!-- ROS Core Stack definition Before making any modifications to this file, please read: http://ros.org/wiki/roscore --> <launch> <group ns="/"> <param name="rosversion" command="rosversion roslaunch" /> <param name="rosdistro" command="rosversion -d" /> <node pkg="rosout" type="rosout" name="rosout" respawn="true"/> </group> </launch>
The ROS Master provides naming and registration services to the rest of the nodes in the ROS system. It tracks publishers and subscribers to topics as well as services. The role of the Master is to enable individual ROS nodes to locate one another. Once these nodes have located each other they communicate with each other peer-to-peer.
The Master also provides the Parameter Server. The Master is most commonly run using the
roscore command, which loads the ROS Master along with other essential components.
再执行一下rosnode kill -a 一次全杀的方案.原来想着杀掉一个roscore(实际验证是可以的pkill roscore即可将三个进程一起杀死)或rosmaster(只能杀掉master进程自己,roscore,rosout不受影响)这样的node,就可以将其他进程顺带一起杀死,这下不用了.kill -a即可.而且,只存在进程而不存在node信息.
正式运行时pkill roslaunch即可.因为此时已经找不到roscore进程了.
log 如下:
[rosout-1] process has finished cleanly log file: /home/xuting/.ros/log/02b0383a-a0c0-11e6-aaa5-00150064e94c/rosout-1*.log [rosout-1] restarting process process[rosout-1]: started with pid [1984] |