ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

awaldrum's profile - activity

2016-02-17 16:31:39 -0500 answered a question How to run multiple roscore/master in multiple machine?

If you mean have multiple roscores on multiple machines then yes, that is how ros works. You can have multiple laptops as long as they are mostly listening(as in not actively competing with each other to command the other nodes). If you mean multiple roscore instances on one machine, then no, that is not how ros works.

If you want to be sure the roscore stays active on the main machine, I suggest creating a script that would check and make sure roscore is still active. Here is an untested simplified version of what I have used for this purpose.

#! /bin/bash
keep_alive()
  process=$(basename $1)
  process="${process%%.*}" #remove timestamp
  while [ true ]
  do
    if pgrep "$process" > /dev/null
    then
        local returnVal=0;
    else
        echo "$process stopped"
        $process &
        local returnVal=1;
    fi
    sleep 5
  done
}

keep_alive roscore

In my case I wrapped the launch file launch with a bash script that was easily pgrep-able.

2015-09-18 14:02:29 -0500 received badge  Supporter (source)