newpavlov / rosbag-rs

Reading rosbag files in pure Rust
Apache License 2.0
9 stars 5 forks source link

Support for modifying and writing rosbags #3

Open ssnover opened 1 year ago

ssnover commented 1 year ago

Was looking to write a quick program to modify a value on some data in a rosbag I had recorded and realized this nifty crate didn't support writing; only reading.

Would you accept an MR to support modifying data and writing the modified rosbag back to disk?

newpavlov commented 1 year ago

IIRC there is a lot to consider for implementing proper writing of rosbag files. I would prefer to not add a partial solution.

Do you simply want to tweak the data field in MessageData? Can you guarantee that its size does not change? I think we could add an API for getting offset of data in original file, you then could use it to modify bytes directly using other means.

ssnover commented 1 year ago

I agree, best to implement a full solution rather than a partial solution. I've already circumvented my original use case with C++, but this seemed like an opportunity to improve the ecosystem and I've been working with the messages' internals a lot as part of roslibrust.

If you think it's appropriate for this crate to expand to a scope closer to what's offered by the official rosbag package, I'd be happy to come up with an API to review and, if it looks good, take a crack at implementing it. No sweat if not though, it certainly grows the amount of code to be maintained in this repo.

newpavlov commented 1 year ago

I am not opposed to expanding the scope, but it looks like a sizable undertaking, which probably should be done in cooperation with folks from rosrust and similar projects. I think a higher priority should be to add a proper integration with ROS types instead of returning raw byte slices. Since I do not currently actively work with ROS, I am open to transferring this crate to an organization or developer with the goal of developing pure Rust ROS ecosystem.

Either way, feel free to open a draft PR. I will try to give you my feedback when I can.

NerdToMars commented 8 months ago

I created a simple rust lib for rosbag2, feel free to comments/advise if you also interested to create similar thing: https://github.com/NerdToMars/rosbag2-rs