ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The (ugly) way that I have done this in the past, is roughly like this:
import subprocess, shlex
command = "rosbag record -O subset /camera/depth/image_raw /camera/rgb/image_raw /joy /mobile_base/sensors/imu_data_raw"
command = shlex.split(command)
rosbag_proc = subprocess.Popen(command)
and this is how you can kill the recording process:
rosbag_proc.send_signal(subprocess.signal.SIGINT)
2 | No.2 Revision |
The (ugly) way that I have done this in the past, is roughly like this:
import subprocess, shlex
shlex, psutil
command = "rosbag record -O subset /camera/depth/image_raw /camera/rgb/image_raw /joy /mobile_base/sensors/imu_data_raw"
command = shlex.split(command)
rosbag_proc = subprocess.Popen(command)
and this is how you can kill the recording process:
for proc in psutil.process_iter():
if "record" in proc.name() and set(command[2:]).issubset(proc.cmdli ne()):
proc.send_signal(subprocess.signal.SIGINT)
rosbag_proc.send_signal(subprocess.signal.SIGINT)
3 | No.3 Revision |
The (ugly) way that I have done this in the past, is roughly like this:
import subprocess, shlex, psutil
command = "rosbag record -O subset /camera/depth/image_raw /camera/rgb/image_raw /joy /mobile_base/sensors/imu_data_raw"
command = shlex.split(command)
rosbag_proc = subprocess.Popen(command)
and this is how you can kill the recording process:
for proc in psutil.process_iter():
if "record" in proc.name() and set(command[2:]).issubset(proc.cmdli ne()):
set(command[2:]).issubset(proc.cmdline()):
proc.send_signal(subprocess.signal.SIGINT)
rosbag_proc.send_signal(subprocess.signal.SIGINT)