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

How to kill Roscore programatically

asked 2014-12-18 10:42:03 -0500

Demian S. gravatar image

I am using Pharo to launch roscore, and thus I cannot simply CTRL+C in the terminal, because that shuts down pharo as well. Pharo allows me to send commands to the console. How do I end the roscore process, then, with a command? $ ps aux | grep ros gives me a list, but I need to automate the Roscore killing (for test purposes, I have to invoce roscore, run several tests, and then shut it down automatically).


edit retag flag offensive close merge delete


How do you actually start roscore? That is, I'd never heard of Pharo until your mention of it...if you can start a process, surely there's a way to halt it, right?

kramer gravatar image kramer  ( 2014-12-18 17:59:17 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2014-12-19 03:17:57 -0500

JohnDoe2991 gravatar image

I have never heard of Pharo, but if you can send commands to a console, you can just use a command to stop the roscore process. For example in Ubuntu, just send the command "killall roscore" and the master should shutdown. Just a quick and dirty solution.

edit flag offensive delete link more


Thats it! It worked perfect, thanks a lot!

Demian S. gravatar image Demian S.  ( 2014-12-19 06:41:45 -0500 )edit

answered 2015-06-25 01:35:00 -0500

killall would kill all eventual roscore, if there are maybe two better choose by port.

export PORT=11311
export ROS_HOME=$HOME/.ros
if [ -e ${ROS_HOME}/roscore-${PORT}.pid ]; then kill `cat  ${ROS_HOME}/roscore-${PORT}.pid`; fi
edit flag offensive delete link more

Question Tools


Asked: 2014-12-18 10:42:03 -0500

Seen: 7,581 times

Last updated: Dec 19 '14