Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I solved my problem using a bash script to keep checking until my_param changes to true to rosrun and kill the node when needed. This is as follows:

#!/bin/bash
rosparam set my_param false
while :
do
  node_name="/my_node"
  node_search=$(rosnode list | grep $node_name)
  if [ $(rosparam get my_param) == false ]
  then
    if [ "$node_search" == $node_name ]
    then
      rosnode kill $node_name
      fi
  else
    if ! [ "$node_search" == $node_name ]
    then
      rosrun my_package my_node
    fi
  fi
done