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

using python subprocess to execute ros commands with verbosity

asked 2020-05-28 15:56:45 -0600

azerila gravatar image

The following is an example for starting a roscore, however, I haven't been able to execute them with verbosity similar to how their output is printed while executing them in terminal. Basically, the following code gets stuck at proc3.communicate() which is necessary to print the stdout.

import subprocess
proc1 = subprocess.Popen(['killall', 'roscore'])
proc2 = subprocess.Popen(['killall', 'rosmaster'])
proc3 = subprocess.Popen(['roscore'], stdout=subprocess.PIPE, 
lines, err = proc3.communicate()

Is there a way to do this with verbosity while having the content printed like in terminal? I have also tried other solitions on internet regarding when proc.communicate() remains stuck.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-04-05 02:37:46 -0600

jangali8 gravatar image

Look at this link

edit flag offensive delete link more

Question Tools



Asked: 2020-05-28 15:56:45 -0600

Seen: 934 times

Last updated: May 28 '20