Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSON<->ROS message serialization/deserialization. #3

Closed
wants to merge 4 commits into from
Closed

Add JSON<->ROS message serialization/deserialization. #3

wants to merge 4 commits into from

Conversation

ahmad-ra
Copy link
Contributor

@ahmad-ra ahmad-ra commented Mar 3, 2024

Enhancing the capabilities by adding support for converting JSON strings into/from ROS messages at runtime. IMO, this functionality fills a crucial gap in the ROS ecosystem, particularly for scenarios where integration with external systems like MQTT brokers is required.

The motivation behind this PR is to provide a dynamic integration mechanism similar to what is offered by the Python-based ros_bridge package, but for C++.

The core reason is to bridge ROS C++ with MQTT brokers using json payloads, dynamically casting json objects into ROS messages.

I edited mqtt_client and did PR, which depends on the updates of this package.

The mqtt_client already have a couple of open issues regarding this functionality.

Key Contributions:
-Implemented the JSON<->ROS-msg Serializer/Deserializer and added the required tests to ensure correctness.
-Demonstrated the correct integration into the existing package by adding a test of the complete cycle of serialization, deserializeIntoJson, and serializeFromJson into a ROS message.
-Most importantly, I tried my best to integrate it correctly into the code base following the same coding style, so that the code base remains homogeneous, and also insuring backward compatibility.

I believe this PR benefits ROS interoperability, and is important to the community,

@ahmad-ra
Copy link
Contributor Author

Update: Fixed ROS2 support and updated CMakeLists

…eeded to be built separately

_Add rapidjson dependency in the include path
@facontidavide
Copy link
Owner

Hi,

I finally decided to look into this and I can not accept it the way it is (too many changes).
I will start adding rapidjson as a dependency, here:

https://github.com/facontidavide/rosx_introspection/blob/master/package.xml#L23

To even consider mergin a PR, it must be MUCH smaller. Let me cheery pick some of your code and we can discuss if I need anything later

@facontidavide
Copy link
Owner

I also added pre-commit and clang-format, to make sure that your future PR will not include any formatting change (that add a lot of noise!!!!!).

I would like to keep rapidjson in the private API, therefore we should not include it in ros_parser.hpp.

Better to use Pimpl idiom, if necessary (but I don't think it is?).

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.

2 participants