How can I control roscore from a Python script? [closed]

asked 2017-09-14 04:08:27 -0500

thinwybk gravatar image

updated 2017-11-10 07:17:32 -0500

I would like to start, stop, etc. the roscore from within a Python script.

I do already know how to spawn a child process and start roscore like suggested here. However I would like to avoid using subprocesses.

It seems like the class Master (in ros_comm) provides the required functionality. It can be used like in this function which starts a ROS master (in ros_comm), somehow like follows.

import rosmaster.master
from rosmaster.master_api import NUM_WORKERS

master = rosmaster.master.Master(DEFAULT_PORT, NUM_WORKERS)


However in this function there is stated something like Standalone zenmaster has been deprecated, please use 'roscore' instead.

Q: Can I use the Master class to start/stop the roscore? Or could I use some other functionality in addition or instead?

The roscorescript calls roslaunch.main. But it is not clear to me where the rosmaster and the other required components are configured and started.

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by 130s
close date 2018-04-24 05:23:50.156874



Although #q289514 is newer, there's active discussion, so closing this as duplicate.

130s gravatar image 130s  ( 2018-04-24 05:23:45 -0500 )edit