Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request is to have mROS2 use the additional feature (fragmented data sending) added in the PR below.
mROS-base/embeddedRTPS#11
The main modification is in the function publish(). It checks if the message should be fragmented, and send with the proper mechanism.
The judgment is based on the message size, and the size is gotten by calcTotalSize() added to the mROS2 serializer. If the calculated size is larger than the size of buf, publish() calls the newly added interface newChangeCallback() of embeddedRTPS to send it as fragmented data. If not, it calls the existing newChange().
A function object is passed to newChangeCallback() that calls it to get fragmented data for each UDP frame. And, the function object shall return the pointer to the fragmented buffer and its size.
To implement this function object, I added some interfaces below to the mROS2 serializer.
This method copies the serialized message to the given buffer and returns the type below.
typedef std::pair<bool, uint32_t> FragCopyReturnType;
The first is if there is any data serialized.
The second is the serialized size.
This method returns the serialized data size.
This method resets the counter of serialized data size
I also modify the existing serializer template and std_msgs to add the additional interfaces above. But, for the template, the implementation is insufficient, and we have to extend the generator to generate code for the fragmentation mechanism.
To demonstrato this new feature, I added a specific perpose message type sensor_msgs/msg/Image. But this type should be generated by the generator in the future.
Lastly, this pull request currently points a submodule (embeddedRTPS) in my repository. However, after we find this acceptable, I will modified it to the this repository's one.