Skip to content

Support loaned message for serialized data #1837

@Barry-Xu-2018

Description

@Barry-Xu-2018

rosbag2 sends serialized data by rclcpp::GenericPublisher.
Now there is no interface to use loaned message for serialized data (DDS not support it).
In order to use current loaned message implementation, whether we can add new interface to rclcpp::GenericPublisher ?

e.g.

void GenericPublisher::try_publish_loaned_msg(const rclcpp::SerializedMessage & message)
{
    if (this->can_loan_messages()) {
      rcl_borrow_loaned_message(.., loaned_msg);
      rmw_deserialize(message.get_rcl_serialized_message(), .., loaned_msg);
      rcl_publish_loaned_message(..., loaned_msg, null);
    } else {
      publish(message); // Call original publish()
    }
}

Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions