Writing order seems to be wrong in new rosbag writer
fnobis opened this issue · 4 comments
The writing of ros messages to file seems to have changed again since:
#49
Since the newest update of the debian packages of ros humble, I notice an error in my script which is caused by the message order in a rosbag I create.
I write a rosbag with the API as shown here:
https://mcap.dev/docs/python/ros2_example.html
Then I read the same rosbag again and I need the messages to have the same order as I have written them.
E.g.
- camera t=0.0
- camera_markers t=0.1
- camera t=1.0
- camera_markers t=1.1
and not
camera_markers
camera
camera
camera_markers
I set the timestamps as above for both the header and the bag time while writing the messages, and write the messages to teh bag in that order (checked in the debugger).
When I read the rosbag, however the rosbag API shows me the camera_markers message first.
I expected that camera would be first, since it is written first via the code and has the lower timestamp in both the header and in the rosbag.
What defines the ordering in the bag file now? Is there anyway to set the mesage ordering with the new version?
Thanks for the report. Our first step will be trying to reproduce the issue. Are you still using the gist from #49 (comment) or can you share a script that reproduces the problem without needing any separate input files (or if you can provide the input files)?
@fnobis just following up on this issue to see if you can provide more info on reproducing the problem.
Yes, the general workflow is still the same as above. I create and write the messages "a" and "b" in an alternating order: "abab". I read with "while has_next" and an if statement to handle different topics, when i reqd the back it first jumps into the "b" if statement.
I might be able to provide more data on this mid december.
in rolling
you are able to set the read order using set_read_order() on SequentialReader
instances and also when directly using the rosbag2_storage
plugin API.