1
$\begingroup$

I wrote a Reader and Writer for ROS2bags in python using the Rosbags API (https://ternaris.gitlab.io/rosbags/index.html). I've recently tried writing an Image file into a ROS2bag. However if i try to visualize it using Foxyglove Studio the image seems to be wrongly written and doesn't show up even though apparently the Image message seems to have been written which i can see thanks through the Data Source Info. Now i wanted to ask if someone has a ROS2bag sample file with Images inside that he could send me so that i could check out how they are written into the ROS2bag file and whether or not i am doing something wrong.

$\endgroup$
1
  • $\begingroup$ Can you add the output of ros2 bag info to your question? Also are you able to share the bag you created, maybe make a short version if it is more than 100 MB or so? $\endgroup$ Nov 16, 2023 at 14:04

1 Answer 1

1
$\begingroup$

There is a small short duration mcap bag with images attached to https://github.com/lucasw/ros_one2z/issues/6, and you could run ros2 launch ros2_example_pkg example_launch.xml to generate new synthetic images and use ros2 bag record a new longer bag (and record in db3 instead of mcap if desired).

Try playing back your bag and see if rqt image view can view it.

Also see what ros2 bag info says about your bag (add the output to your question like suggested in the comment):

$ ros2 bag info rosbag2_2023_11_04-07_23_24_bouncing_ball

Files:             rosbag2_2023_11_04-07_23_53_0.mcap
...
Bag size:          10.0 MiB
Storage id:        mcap
Duration:          4.392s
Start:             Nov  4 2023 07:23:53.258 (1699107833.258)
End:               Nov  4 2023 07:23:57.651 (1699107837.651)
Messages:          459
Topic information: Topic: /contour | Type: geometry_msgs/msg/PolygonStamped | Count: 132 | Serialization Format: cdr
                   Topic: /events/write_split | Type: rosbag2_interfaces/msg/WriteSplitEvent | Count: 33 | Serialization Format: cdr
                   Topic: /image | Type: sensor_msgs/msg/Image | Count: 132 | Serialization Format: cdr
                   Topic: /modified_image | Type: sensor_msgs/msg/Image | Count: 133 | Serialization Format: cdr
                   Topic: /parameter_events | Type: rcl_interfaces/msg/ParameterEvent | Count: 0 | Serialization Format: cdr
                   Topic: /rosout | Type: rcl_interfaces/msg/Log | Count: 29 | Serialization Format: cdr

Another debug step is to echo the first part of the image message, see if all the fields are reasonable (add the output to your question so we can look at it):

$ ros2 topic echo /image --once | head -n 20
header:
  stamp:
    sec: 1699107834
    nanosec: 20821000
  frame_id: map
height: 200
width: 320
encoding: rgb8
is_bigendian: 0
step: 960
data:
- 255
- 255
- 255
- 255
- 255
- 255
- 255
- 255
- 255
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.