Skip to content

Conversation

@S-Dafarra
Copy link
Collaborator

This PR allows the BufferManager users to know when a mat file is about to be saved. This is to synchronize with other logging tools. Before this PR there was no way to understand when the mat file was about to be saved when the periodic save is on. More importantly, the saveToFile method does not prevent any concurrent push_back on the channels, since it does not lock any mutex. This means that if we have a series of channels that we want to be aligned, when pushing to the channels sequentially, some data could end in one file, and other data in the next one. While we are not loosing any data, this could lead to channels of different lengths within a file (I think this is also something that @valegagge and @PasMarra experienced once).

On our side, in the BipedalLocomotionFramework::YarpRobotLoggerDevice we store a set of images periodically in a different thread. We also periodically push to the buffer manager the corresponding frame timestamp. In this case, this callback is even more important, because if the periodic save of the mat file is triggered, we can keep saving frames in the corresponding folder and push the timestamp to the buffer manager, and we don't realize it until the saving is completed. This means that the frames stored while the mat file was being saved will be stored in a folder with the name of the mat file being just saved, but the corresponding timestamps are saved in the next file.

This pre save callback allows to notify the buffer manager user that the file is about to be save, and also delaying or cancel its saving if necessary.

cc @GiulioRomualdi @traversaro

@S-Dafarra S-Dafarra requested a review from Nicogene October 23, 2025 15:19
@Nicogene Nicogene merged commit 7b0dac1 into master Oct 24, 2025
2 checks passed
@Nicogene Nicogene deleted the pre_save_callback branch October 24, 2025 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants