Save image and depth topic from bag file to data frame or csv

asked 2021-03-22 05:49:31 -0500

ninafiona gravatar image

updated 2021-03-22 10:43:19 -0500

I have a bag file that contains image and depth data. I know how to extract images and convert them to a video, but I would also like to extract the data and save it into one big csv/txt/h5/... (one file for all timesteps per topic).

I tried using this command:

rostopic echo -b ./data/recorded_bag_files/4.bag -p /camera/depth/image_rect_raw > ./data/recorded_bag_files/4_depth.csv

and equally for color:

rostopic echo -b ./data/recorded_bag_files/4.bag -p /camera/color/image_raw > ./data/recorded_bag_files/4_color.csv

.. but it only saves the meta data. Without the -p it seems to work, but then it's not easily readable via Python. Any other ideas?

I use: Ubuntu 20.04. ROS Noetic, Python 3.7

Update: I think this error only occurs on ROS Noetic, seems to work in ROS Melodic.

edit retag flag offensive close merge delete