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

using python subprocess to execute ros commands with verbosity

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

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, 
                                      stderr=subprocess.PIPE)
lines, err = proc3.communicate()
print(lines.decode("utf-8"))

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
0

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

jangali8 gravatar image

Look at this link

edit flag offensive delete link more

Question Tools

2 followers

Stats

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

Seen: 1,083 times

Last updated: May 28 '20