strands-project / mongodb_store

MongoDB tools for storing and analysing runs of ROS systems.
BSD 3-Clause "New" or "Revised" License
49 stars 72 forks source link

C++ JSON serialization of ROS messages #260

Closed nilsbore closed 4 years ago

nilsbore commented 4 years ago

Hi guys! I implemented a C++ serializer/deserializer for ROS msgs for a project I'm working on atm. From what I remember, mongodb_store does that part in python and then sends it on to c++ for insertion in mongodb. Would there be any obvious gain from doing it in c++ instead (e.g. speed, less traffic?). In case you would be interested, I think I could get serialization to be compliant with whatever you're using. There is already a test suite that makes sure it does not corrupt most messages. Cheers!

hawesie commented 4 years ago

Hey @nilsbore lovely to hear from you!

Both C++ and Python do it natively using ROS code. Here are the C++ bits: https://github.com/strands-project/mongodb_store/blob/melodic-devel/mongodb_store/include/mongodb_store/message_store.h#L33

nilsbore commented 4 years ago

Hi @hawesie ! Ok, I see! But from what I understand this is binary serialization of the messages. Wasn't there an option to also have them as json dicts within mongodb?

nilsbore commented 4 years ago

Basically, my library does the same things as the two functions you pointed to, but serializing to json.

hawesie commented 4 years ago

Understood!

That would probably be nicer, but I'm not sure it's necessary at this point (everything works, no-one is actively changing this code). When the message infrastrucutre changes for ROS2, it would be worth looking again.