how to stop the nodes launch by lanunch file

asked 2017-06-22 21:36:55 -0500

can-43811 gravatar image

updated 2017-06-22 21:38:07 -0500

Hi All,

I am using below script to execute the launch file in order to launch my all the nodes. Now i want to stop all the nodes in this launch file in other programme .

rosnode kill -a option will kill all the nodes including roscore which i don't want. Can anybody suggest about this?

it would be great if same can be implemented through service daemon so that below operation can be performed.

service script name start service script name stop

service script name restart

#Provide path of the source file for setting environment of ROS 
#source /opt/ros/kinetic/setup.bash
. /opt/ros/kinetic/setup.bash
#While Loop for waiting until IP address is set inside computer
while true;do
    #IP="`ifconfig | grep 'inet addr:'"$IP_conf"''| cut -d: -f2 | awk '{ print $1}'`"
    ip=$(hostname - I)    
    if [ "$IP" ]; then
        echo "Found"

#Exporting ROS Packages PATH
export ROS_ROOT=/opt/ros/kinetic/share/ros
export ROS_PACKAGE_PATH=/opt/ros/kinetic/share
export ROS_MASTER_URI=http://localhost:11311
export ROS_DISTRO=kinetic
export ROS_ETC_DIR=/opt/ros/kinetic/etc/ros

source /home/user/robo_whether_ws/devel/setup.bash 

roslaunch launch_pkg whether_launch.launch
edit retag flag offensive close merge delete


Just checking (and not an answer, but may save you some work): have you seen wiki/robot_upstart?

gvdhoorn gravatar image gvdhoorn  ( 2017-06-23 01:36:08 -0500 )edit