-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Hi there!
I have a rosbag with a few image topics that I am trying to export. I was able to build your Docker image, get a workspace built with your package, and then run the utility to export from a ros bag with the bag_to_image launch file. However, there seems to be a problem with the output filepath of each image file.
Specifically, I believe the issue is that this node assumes that each of the messages you are trying to export is "stamped"--I.e., contains a header with a timestamp. For my particular use case, these image messages don't have their timestamps set properly (yet).
My particular use case and output looks like this, for reference:
ros2 launch ros2_bag_to_image bag_to_image.xml input/path:=/home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2/workzone_boundary_detection_pipeline_images_2_0.db3 input/topics:="['/result_image', '/boundary_image']" output/path:=/home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png/
And the output that follows looks like this:
[INFO] [launch]: All log files can be found below /home/nlitz88/.ros/log/2024-04-22-20-21-43-930541-b683bef1f499-481
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [bag_to_image_node-1]: process started with pid [482]
[bag_to_image_node-1] [INFO] [1713831704.112200246] [bag_to_image_node]: Using bag format: 'cdr'
[bag_to_image_node-1] [INFO] [1713831704.112279615] [bag_to_image_node]: Using bag storage_id: 'sqlite3'
[bag_to_image_node-1] [INFO] [1713831704.112400941] [bag_to_image_node]: Saving Images PNGs to:/home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png/
[bag_to_image_node-1] [INFO] [1713831704.112415748] [bag_to_image_node]: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2/workzone_boundary_detection_pipeline_images_2_0.db3
[bag_to_image_node-1] [INFO] [1713831704.112421842] [bag_to_image_node]: sqlite3
[bag_to_image_node-1] [INFO] [1713831704.112427711] [bag_to_image_node]: cdr
[bag_to_image_node-1] [INFO] [1713831704.112433155] [bag_to_image_node]: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png/
[bag_to_image_node-1] [INFO] [1713831704.112444970] [bag_to_image_node]: /result_image
[bag_to_image_node-1] [INFO] [1713831704.112878970] [bag_to_image_node]: /boundary_image
[bag_to_image_node-1] created: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png/result_image
[bag_to_image_node-1] created: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png/boundary_image
[bag_to_image_node-1] [INFO] [1713831704.115028613] [rosbag2_storage]: Opened database '/home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2/workzone_boundary_detection_pipeline_images_2_0.db3' for READ_ONLY.
[bag_to_image_node-1] [INFO] [1713831704.129542774] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//result_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.137748402] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//boundary_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.145742231] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//result_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.152676010] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//boundary_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.159884524] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//result_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.167009065] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//result_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.174369170] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//boundary_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.181280828] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//boundary_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.188460978] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//result_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.195304223] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//boundary_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.201408062] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//result_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.208343054] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//boundary_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.215605250] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//result_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.222662456] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//boundary_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.229948645] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//result_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.236998884] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//boundary_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.244346854] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//result_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.251422649] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//boundary_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.258960605] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//result_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.266249477] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//boundary_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.273581719] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//result_image_0.0.png
[bag_to_image_node-1] [INFO] [1713831704.280489216] [bag_to_image_node]: Image saved to: /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png//boundary_image_0.0.png
...and so on until it finishes. However, in the output directory, I am only left with this:
nlitz88@b683bef1f499:/workspaces/isaac_ros-dev/18744/rosbag_export_ws$ ls -l /home/nlitz88/Documents/workzone_boundary_detection_pipeline_images_2_png/
total 36
drwxr-xr-x 2 nlitz88 nlitz88 4096 Apr 22 20:19 boundary_image
-rw-r--r-- 1 nlitz88 nlitz88 5546 Apr 22 20:21 boundary_image_0.0.png
drwxr-xr-x 2 nlitz88 nlitz88 4096 Apr 22 20:19 result_image
-rw-r--r-- 1 nlitz88 nlitz88 19612 Apr 22 20:21 result_image_0.0.png
where the directories boundary_image and result_image are empty.
I added a simple workaround/fix in place of this code where I just create a static counter variable and name the images accordingly like this:
static size_t message_count = 0;
fname = output_path_ + "/" + target_topic_name + "_" +
boost::lexical_cast<std::string>(message_count) + ".png";
message_count += 1;
Might not be worth "fixing" depending on your needs--particularly because my image messages should have valid timestamp values--but this is an edge case where the source of these messages isn't doing something right and this is all I have at the moment. Just wanted to leave this here in case someone else runs into it.