Fast-DDS-python icon indicating copy to clipboard operation
Fast-DDS-python copied to clipboard

DataWriter loan_sample

Open SilverIce opened this issue 1 year ago • 1 comments

Hello,

I’m trying to use the standard “Hello World” Python example provided in the documentation to implement the zero-copy approach. I’m not entirely sure if I am passing the arguments correctly or if there is an actual problem. Before I provide more details, my question is: Does the Python API support the zero-copy approach?

I encountered the following issue:

        self.writer: fastdds.DataWriter = self.publisher.create_datawriter(self.topic, self.writer_qos, self.listener)
        sample_ptr = ctypes.c_void_p()
        sample_ptr_ref = ctypes.byref(sample_ptr)
        # here I assume the result is error_code
        result = self.writer.loan_sample(sample_ptr_ref)
  File "/home/daniel/dev/misc/fastdds/FastDDSGenHelloWorld/HelloWorldPublisher.py", line 96, in write_zc
    res, data = self.writer.loan_sample(sample_ptr_ref)
  File "/home/daniel/dev/misc/fastdds/fastddspython/install/fastdds_python/lib/python3.10/site-packages/fastdds/__init__.py", line 6038, in loan_sample
    return _fastdds_python.DataWriter_loan_sample(self, *args)
TypeError: in method 'DataWriter_loan_sample', argument 2 of type 'void *&'

Thank you.

P.S. I use latest master from https://raw.githubusercontent.com/eProsima/Fast-DDS-python/main/fastdds_python.repos

SilverIce avatar Nov 26 '24 13:11 SilverIce

Bump

andreclerigo avatar Feb 26 '25 11:02 andreclerigo