Processing ROS bags in parallel?

asked 2022-06-09 11:14:40 -0500

Hi there,

I'm trying to process data from a number of pcap ouster files, and have a workflow that is sucessful when I process one file at a time. I don’t understand how to scale this up to parallel processing though. let’s say that there are two processes that are each executing this python code which just makes ros command line calls

 roscore_proc = subprocess.Popen(f"roslaunch -p {process_port} ouster_ros ouster.launch replay:=true metadata:='{os.path.abspath(json_file_name)}'", shell=True)
time.sleep(10)
print("Starting recording")
recording_proc = subprocess.Popen(f"rosbag record /rec{index}/os_cloud_node/points -O {pcap_bag_name[:-4]}-pc __name:=recording_proc{index}", shell=True)
time.sleep(10)
print("Starting playback")
subprocess.run(f"rosbag play --prefix=rec{index} {pcap_bag_name}", shell=True)
time.sleep(2)

How can I ensure that the recording and playback are associated with the right roscore and ouster_ros nodes? I don’t see any -p specific flags that I can pass in their documentation pages. Thanks for your assistance!

I'm using ubuntu 20.04 ros noetic, and the ouster_ros package (https://github.com/ouster-lidar/ouste...) as well as the pcap_to_bag package (https://github.com/Krishtof-Korda/pca...).

edit retag flag offensive close merge delete