Robotics StackExchange | Archived questions

how to stop the nodes launch by lanunch file

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

 #!/bin/bash
#Provide path of the source file for setting environment of ROS 
#CATKIN_SHELL=bash
#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"
        break
    fi
done


#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 ROSLISP_PACKAGE_DIRECTORIES=
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

Asked by can-43811 on 2017-06-22 21:36:55 UTC

Comments

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

Asked by gvdhoorn on 2017-06-23 01:36:08 UTC

Answers