gaia-platform / rosbag2_snapshot

A ROS2 port of rosbag_snapshot
18 stars 12 forks source link

Unable to get data in bag #6

Closed CourchesneA closed 2 years ago

CourchesneA commented 2 years ago

I am having trouble figuring how the time is supposed to work. I am trying a basic example, with default values.

I have a webcam streaming on topic /camera_raw/compressed that I know is publishing at 1fps. The snapshot server is running with the following config file:

/**:
  ros__parameters:
    default_duration_limit: 15.0
    default_memory_limit: 1024.0 

and I take a snapshot with the CLI service call:

ros2 service call /trigger_snapshot rosbag2_snapshot_msgs/srv/TriggerSnapshot "{filename: 'logs/bag1', topics: [], start_time: {sec: 0, nanosec: 0}, stop_time: {sec: 0, nanosec: 0}}"

but no messages are logged into the bag: (bag1/metadata.yaml)

    - topic_metadata:
        name: /camera_raw/compressed
        type: sensor_msgs/msg/CompressedImage
        serialization_format: cdr 
        offered_qos_profiles: ""
      message_count: 0

I tried setting the end_time to max_int to make sure the messages were in the time window but it does not seem to change anything. What time format is expected ? Would it be possible to have some more examples commands ?

CourchesneA commented 2 years ago

digging a bit deeper, it seems a string topic was getting recorded properly. The issue seems to be with the memory limit. Removing the limit or setting it to 1000000 fixes the problem. I think the node might be computing the size of the message in a different unit than MB, since I know from ros2 topic bw that the recorded messages have a size of ~63 KB

JWhitleyWork commented 2 years ago

@CourchesneA Looking down into the rcl and the rmw layers where the SerializedMessage and serialized_message objects are allocated, it looks like the size() attribute being used to get the size of the message is in BYTES and the conversion to MB is not being done (at all). Would you mind taking a look at #8 for a fix?

CourchesneA commented 2 years ago

I tested the PR and it does fix the issue. We are not using the memory option so it is not a problem for us, but it might be a good idea to apply the fix to memory limits for each topic too https://github.com/gaia-platform/rosbag2_snapshot/blob/0adc67f656b9ae5582ee10299fe173da44e70418/rosbag2_snapshot/param/multiple_topics.params.yaml#L13

JWhitleyWork commented 2 years ago

Much appreciated! I will open that as a separate issue to work on when I've got time.