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

Radar's profile - activity

2018-08-08 01:32:46 -0500 marked best answer How to run ROS command from a python script?

Hello! I need some help as I was trying to write a python script which could run some ROS commands, such as $rostopic list and $rostopic echo(while some nodes are running). I tried something like the following, but none of them works. when I tried this:

os.system("rostopic list")

I got this error when I ran the above: sh: 1: rostopic: not found

Or this:

subprocess.call(["rostopic", "list"])

It was not working and a error message was given like this "FileNotFoundError: [Errno 2] No such file or directory: 'rostopic'"

I was thinking about execute a shell script from my python script, but I don't know how to write one for running ROS commands.

I appreciate any help!

2017-07-27 16:49:33 -0500 received badge  Famous Question (source)
2017-05-30 03:04:59 -0500 received badge  Notable Question (source)
2017-05-29 08:08:07 -0500 received badge  Popular Question (source)
2017-05-29 05:12:17 -0500 asked a question How to run ROS command from a python script?

How to run ROS command from a python script? Hello! I need some help as I was trying to write a python script which coul